Skip to content

Commit

Permalink
test: move the creation of the nan_table to slt (#9022)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgao authored Jan 27, 2024
1 parent a6cdd0d commit 7a5f205
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
25 changes: 0 additions & 25 deletions datafusion/sqllogictest/src/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion datafusion/sqllogictest/test_files/scalar.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 7a5f205

Please sign in to comment.