Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqllogictest: move the creation of the nan_table from Rust to slt #9022

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked

❯ select arrow_typeof('NaN'::double), 'NaN'::double;
+---------------------------+-------------+
| arrow_typeof(Utf8("NaN")) | Utf8("NaN") |
+---------------------------+-------------+
| Float64                   | NaN         |
+---------------------------+-------------+
1 row in set. Query took 0.004 seconds.

👍


# query_not()

Expand Down
Loading