Skip to content

Apache DataFusion SQL Query Engine

test: move the creation of the nan_table to slt (#9022)

Jonah Gao7a5f2054305f
diff --git a/datafusion/sqllogictest/src/test_context.rs b/datafusion/sqllogictest/src/test_context.rs
index 889ccdcd66..dd27727e3a 100644
--- a/datafusion/sqllogictest/src/test_context.rs
+++ b/datafusion/sqllogictest/src/test_context.rs
@@ -73,10 +73,6 @@ impl TestContext {
let file_name = relative_path.file_name().unwrap().to_str().unwrap();
match file_name {
- "scalar.slt" => {
- info!("Registering scalar tables");
- register_scalar_tables(test_ctx.session_ctx()).await;
- }
"information_schema_table_types.slt" => {
info!("Registering local temporary table");
register_temp_table(test_ctx.session_ctx()).await;
@@ -170,27 +166,6 @@ pub async fn register_avro_tables(ctx: &mut crate::TestContext) {
.unwrap();
}
-pub async fn register_scalar_tables(ctx: &SessionContext) {
- register_nan_table(ctx)
-}
-
-/// Register a table with a NaN value (different than NULL, and can
-/// not be created via SQL)
-fn register_nan_table(ctx: &SessionContext) {
- let schema = Arc::new(Schema::new(vec![Field::new("c1", DataType::Float64, true)]));
-
- let data = RecordBatch::try_new(
- schema,
- vec![Arc::new(Float64Array::from(vec![
- Some(1.0),
- None,
- Some(f64::NAN),
- ]))],
- )
- .unwrap();
- ctx.register_batch("test_float", data).unwrap();
-}
-
/// Generate a partitioned CSV file and register it with an execution context
pub async fn register_partition_table(test_ctx: &mut TestContext) {
test_ctx.enable_testdir();
diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.slt
index 5b3ecab5fd..0f76c722e9 100644
--- a/datafusion/sqllogictest/test_files/scalar.slt
+++ b/datafusion/sqllogictest/test_files/scalar.slt
@@ -1383,7 +1383,8 @@ create table test_boolean(c1 boolean) as values (false), (null), (true);
statement ok
create table test_int32(c1 int) as values (0), (1), (null), (3);
-## Note that test_float has a NaN (which is not possible to create in SQL) so it is registered via rust.
+statement ok
+create table test_float(c1 double) as values (1.0), (null), ('NaN'::double);
# query_not()