Skip to content

Apache DataFusion SQL Query Engine

[sqllogictest] Define output types and check them in tests (#5253)

Yevhenii Melnyk22b974fce9b3
diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml
index ca00e64f29..15702c29c5 100644
--- a/datafusion/core/Cargo.toml
+++ b/datafusion/core/Cargo.toml
@@ -117,7 +117,7 @@ postgres-protocol = "0.6.4"
postgres-types = { version = "0.2.4", features = ["derive", "with-chrono-0_4"] }
rstest = "0.16.0"
rust_decimal = { version = "1.27.0", features = ["tokio-pg"] }
-sqllogictest = "0.12.0"
+sqllogictest = "0.13.0"
test-utils = { path = "../../test-utils" }
thiserror = "1.0.37"
tokio-postgres = "0.7.7"
diff --git a/datafusion/core/tests/sqllogictests/README.md b/datafusion/core/tests/sqllogictests/README.md
index 72a6c69048..2f697921a0 100644
--- a/datafusion/core/tests/sqllogictests/README.md
+++ b/datafusion/core/tests/sqllogictests/README.md
@@ -105,10 +105,13 @@ query <type_string> <sort_mode>
- `test_name`: Uniquely identify the test name (arrow-datafusion only)
- `type_string`: A short string that specifies the number of result columns and the expected datatype of each result column. There is one character in the <type_string> for each result column. The characters codes are:
- - "T" for a text result,
- - "I" for an integer result,
- - "R" for a floating-point result,
- - "?" for any other type.
+ - 'B' - **B**oolean,
+ - 'D' - **D**atetime,
+ - 'I' - **I**nteger,
+ - 'P' - timestam**P**,
+ - 'R' - floating-point results,
+ - 'T' - **T**ext,
+ - "?" - any other types
- `expected_result`: In the results section, some values are converted according to some rules:
- floating point values are rounded to the scale of "12",
- NULL values are rendered as `NULL`,
diff --git a/datafusion/core/tests/sqllogictests/src/engines/datafusion/create_table.rs b/datafusion/core/tests/sqllogictests/src/engines/datafusion/create_table.rs
index b891ab8c8b..981dd75b56 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/datafusion/create_table.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/datafusion/create_table.rs
@@ -16,8 +16,9 @@
// under the License.
use super::error::Result;
+use crate::engines::datafusion::error::DFSqlLogicTestError;
use crate::engines::datafusion::util::LogicTestContextProvider;
-use crate::{engines::datafusion::error::DFSqlLogicTestError, output::DFOutput};
+use crate::engines::output::DFOutput;
use datafusion::datasource::MemTable;
use datafusion::prelude::SessionContext;
use datafusion_common::{DataFusionError, OwnedTableReference};
diff --git a/datafusion/core/tests/sqllogictests/src/engines/datafusion/insert.rs b/datafusion/core/tests/sqllogictests/src/engines/datafusion/insert.rs
index cb8e15591d..a8fca3b16c 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/datafusion/insert.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/datafusion/insert.rs
@@ -16,7 +16,8 @@
// under the License.
use super::error::Result;
-use crate::{engines::datafusion::util::LogicTestContextProvider, output::DFOutput};
+use crate::engines::datafusion::util::LogicTestContextProvider;
+use crate::engines::output::DFOutput;
use arrow::record_batch::RecordBatch;
use datafusion::datasource::MemTable;
use datafusion::prelude::SessionContext;
diff --git a/datafusion/core/tests/sqllogictests/src/engines/datafusion/mod.rs b/datafusion/core/tests/sqllogictests/src/engines/datafusion/mod.rs
index 918419370f..1f8f7feb36 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/datafusion/mod.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/datafusion/mod.rs
@@ -18,7 +18,7 @@
use std::path::PathBuf;
use std::time::Duration;
-use crate::output::{DFColumnType, DFOutput};
+use crate::engines::output::{DFColumnType, DFOutput};
use self::error::{DFSqlLogicTestError, Result};
use async_trait::async_trait;
@@ -27,6 +27,7 @@ use datafusion::arrow::record_batch::RecordBatch;
use datafusion::prelude::SessionContext;
use datafusion_sql::parser::{DFParser, Statement};
use insert::insert;
+use sqllogictest::DBOutput;
use sqlparser::ast::Statement as SQLStatement;
mod create_table;
@@ -108,7 +109,14 @@ async fn run_query(ctx: &SessionContext, sql: impl Into<String>) -> Result<DFOut
}
}
let df = ctx.sql(sql.as_str()).await?;
+
+ let types = normalize::convert_schema_to_types(df.schema().fields());
let results: Vec<RecordBatch> = df.collect().await?;
- let formatted_batches = normalize::convert_batches(results)?;
- Ok(formatted_batches)
+ let rows = normalize::convert_batches(results)?;
+
+ if rows.is_empty() && types.is_empty() {
+ Ok(DBOutput::StatementComplete(0))
+ } else {
+ Ok(DBOutput::Rows { types, rows })
+ }
}
diff --git a/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs b/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs
index 2f0705bf14..5fad28f733 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs
@@ -17,53 +17,43 @@
use arrow::datatypes::SchemaRef;
use arrow::{array, array::ArrayRef, datatypes::DataType, record_batch::RecordBatch};
+use datafusion_common::DFField;
use datafusion_common::DataFusionError;
use lazy_static::lazy_static;
-use sqllogictest::DBOutput;
use std::path::PathBuf;
-use crate::output::{DFColumnType, DFOutput};
+use crate::engines::output::DFColumnType;
use super::super::conversion::*;
use super::error::{DFSqlLogicTestError, Result};
-/// Converts `batches` to a DBOutput as expected by sqllogicteset.
-///
-/// Assumes empty record batches are a successful statement completion
-///
-pub fn convert_batches(batches: Vec<RecordBatch>) -> Result<DFOutput> {
+/// Converts `batches` to a result as expected by sqllogicteset.
+pub fn convert_batches(batches: Vec<RecordBatch>) -> Result<Vec<Vec<String>>> {
if batches.is_empty() {
- // DataFusion doesn't report number of rows complete
- return Ok(DBOutput::StatementComplete(0));
- }
+ Ok(vec![])
+ } else {
+ let schema = batches[0].schema();
+ let mut rows = vec![];
+ for batch in batches {
+ // Verify schema
+ if !equivalent_names_and_types(&schema, batch.schema()) {
+ return Err(DFSqlLogicTestError::DataFusion(DataFusionError::Internal(
+ format!(
+ "Schema mismatch. Previously had\n{:#?}\n\nGot:\n{:#?}",
+ &schema,
+ batch.schema()
+ ),
+ )));
+ }
- let schema = batches[0].schema();
-
- // TODO: report the the actual types of the result
- // https://github.com/apache/arrow-datafusion/issues/4499
- let types = vec![DFColumnType::Any; batches[0].num_columns()];
-
- let mut rows = vec![];
- for batch in batches {
- // Verify schema
- if !equivalent_names_and_types(&schema, batch.schema()) {
- return Err(DFSqlLogicTestError::DataFusion(DataFusionError::Internal(
- format!(
- "Schema mismatch. Previously had\n{:#?}\n\nGot:\n{:#?}",
- &schema,
- batch.schema()
- ),
- )));
+ let new_rows = convert_batch(batch)?
+ .into_iter()
+ .flat_map(expand_row)
+ .map(normalize_paths);
+ rows.extend(new_rows);
}
-
- let new_rows = convert_batch(batch)?
- .into_iter()
- .flat_map(expand_row)
- .map(normalize_paths);
- rows.extend(new_rows);
+ Ok(rows)
}
-
- Ok(DBOutput::Rows { types, rows })
}
/// special case rows that have newlines in them (like explain plans)
@@ -233,3 +223,34 @@ pub fn cell_to_string(col: &ArrayRef, row: usize) -> Result<String> {
.map_err(DFSqlLogicTestError::Arrow)
}
}
+
+/// Converts columns to a result as expected by sqllogicteset.
+pub fn convert_schema_to_types(columns: &[DFField]) -> Vec<DFColumnType> {
+ columns
+ .iter()
+ .map(|f| f.data_type())
+ .map(|data_type| match data_type {
+ DataType::Boolean => DFColumnType::Boolean,
+ DataType::Int8
+ | DataType::Int16
+ | DataType::Int32
+ | DataType::Int64
+ | DataType::UInt8
+ | DataType::UInt16
+ | DataType::UInt32
+ | DataType::UInt64 => DFColumnType::Integer,
+ DataType::Float16
+ | DataType::Float32
+ | DataType::Float64
+ | DataType::Decimal128(_, _)
+ | DataType::Decimal256(_, _) => DFColumnType::Float,
+ DataType::Utf8 | DataType::LargeUtf8 => DFColumnType::Text,
+ DataType::Date32
+ | DataType::Date64
+ | DataType::Time32(_)
+ | DataType::Time64(_) => DFColumnType::DateTime,
+ DataType::Timestamp(_, _) => DFColumnType::Timestamp,
+ _ => DFColumnType::Another,
+ })
+ .collect()
+}
diff --git a/datafusion/core/tests/sqllogictests/src/engines/mod.rs b/datafusion/core/tests/sqllogictests/src/engines/mod.rs
index 2d05e5d584..a2657bb600 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/mod.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/mod.rs
@@ -17,4 +17,5 @@
mod conversion;
pub mod datafusion;
+mod output;
pub mod postgres;
diff --git a/datafusion/core/tests/sqllogictests/src/engines/output.rs b/datafusion/core/tests/sqllogictests/src/engines/output.rs
new file mode 100644
index 0000000000..0682f5df97
--- /dev/null
+++ b/datafusion/core/tests/sqllogictests/src/engines/output.rs
@@ -0,0 +1,57 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use sqllogictest::{ColumnType, DBOutput};
+
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum DFColumnType {
+ Boolean,
+ DateTime,
+ Integer,
+ Float,
+ Text,
+ Timestamp,
+ Another,
+}
+
+impl ColumnType for DFColumnType {
+ fn from_char(value: char) -> Option<Self> {
+ match value {
+ 'B' => Some(Self::Boolean),
+ 'D' => Some(Self::DateTime),
+ 'I' => Some(Self::Integer),
+ 'P' => Some(Self::Timestamp),
+ 'R' => Some(Self::Float),
+ 'T' => Some(Self::Text),
+ _ => Some(Self::Another),
+ }
+ }
+
+ fn to_char(&self) -> char {
+ match self {
+ Self::Boolean => 'B',
+ Self::DateTime => 'D',
+ Self::Integer => 'I',
+ Self::Timestamp => 'P',
+ Self::Float => 'R',
+ Self::Text => 'T',
+ Self::Another => '?',
+ }
+ }
+}
+
+pub type DFOutput = DBOutput<DFColumnType>;
diff --git a/datafusion/core/tests/sqllogictests/src/engines/postgres/mod.rs b/datafusion/core/tests/sqllogictests/src/engines/postgres/mod.rs
index 5284111887..2c6287b97b 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/postgres/mod.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/postgres/mod.rs
@@ -25,9 +25,8 @@ use log::debug;
use sqllogictest::DBOutput;
use tokio::task::JoinHandle;
-use crate::output::{DFColumnType, DFOutput};
-
use super::conversion::*;
+use crate::engines::output::{DFColumnType, DFOutput};
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
use postgres_types::Type;
use rust_decimal::Decimal;
@@ -212,55 +211,15 @@ impl Drop for Postgres {
}
}
-macro_rules! make_string {
- ($row:ident, $idx:ident, $t:ty) => {{
- let value: Option<$t> = $row.get($idx);
- match value {
- Some(value) => value.to_string(),
- None => NULL_STR.to_string(),
- }
- }};
- ($row:ident, $idx:ident, $t:ty, $convert:ident) => {{
- let value: Option<$t> = $row.get($idx);
- match value {
- Some(value) => $convert(value).to_string(),
- None => NULL_STR.to_string(),
- }
- }};
-}
-
-fn cell_to_string(row: &Row, column: &Column, idx: usize) -> String {
- match column.type_().clone() {
- Type::CHAR => make_string!(row, idx, i8),
- Type::INT2 => make_string!(row, idx, i16),
- Type::INT4 => make_string!(row, idx, i32),
- Type::INT8 => make_string!(row, idx, i64),
- Type::NUMERIC => make_string!(row, idx, Decimal, decimal_to_str),
- Type::DATE => make_string!(row, idx, NaiveDate),
- Type::TIME => make_string!(row, idx, NaiveTime),
- Type::TIMESTAMP => {
- let value: Option<NaiveDateTime> = row.get(idx);
- value
- .map(|d| format!("{d:?}"))
- .unwrap_or_else(|| "NULL".to_string())
- }
- Type::BOOL => make_string!(row, idx, bool, bool_to_str),
- Type::BPCHAR | Type::VARCHAR | Type::TEXT => {
- make_string!(row, idx, &str, varchar_to_str)
- }
- Type::FLOAT4 => make_string!(row, idx, f32, f32_to_str),
- Type::FLOAT8 => make_string!(row, idx, f64, f64_to_str),
- Type::REGTYPE => make_string!(row, idx, PgRegtype),
- _ => unimplemented!("Unsupported type: {}", column.type_().name()),
- }
-}
-
#[async_trait]
impl sqllogictest::AsyncDB for Postgres {
type Error = Error;
type ColumnType = DFColumnType;
- async fn run(&mut self, sql: &str) -> Result<DFOutput, Self::Error> {
+ async fn run(
+ &mut self,
+ sql: &str,
+ ) -> Result<DBOutput<Self::ColumnType>, Self::Error> {
println!(
"[{}] Running query: \"{}\"",
self.relative_path.display(),
@@ -290,27 +249,29 @@ impl sqllogictest::AsyncDB for Postgres {
return Ok(DBOutput::StatementComplete(0));
}
let rows = self.client.query(sql, &[]).await?;
- let output = rows
- .iter()
- .map(|row| {
- row.columns()
- .iter()
- .enumerate()
- .map(|(idx, column)| cell_to_string(row, column, idx))
- .collect::<Vec<String>>()
- })
- .collect::<Vec<_>>();
- if output.is_empty() {
- let stmt = self.client.prepare(sql).await?;
- Ok(DBOutput::Rows {
- types: vec![DFColumnType::Any; stmt.columns().len()],
- rows: vec![],
- })
+ let types: Vec<Type> = if rows.is_empty() {
+ self.client
+ .prepare(sql)
+ .await?
+ .columns()
+ .iter()
+ .map(|c| c.type_().clone())
+ .collect()
+ } else {
+ rows[0]
+ .columns()
+ .iter()
+ .map(|c| c.type_().clone())
+ .collect()
+ };
+
+ if rows.is_empty() && types.is_empty() {
+ Ok(DBOutput::StatementComplete(0))
} else {
Ok(DBOutput::Rows {
- types: vec![DFColumnType::Any; output[0].len()],
- rows: output,
+ types: convert_types(types),
+ rows: convert_rows(rows),
})
}
}
@@ -319,3 +280,73 @@ impl sqllogictest::AsyncDB for Postgres {
"postgres"
}
}
+
+fn convert_rows(rows: Vec<Row>) -> Vec<Vec<String>> {
+ rows.iter()
+ .map(|row| {
+ row.columns()
+ .iter()
+ .enumerate()
+ .map(|(idx, column)| cell_to_string(row, column, idx))
+ .collect::<Vec<String>>()
+ })
+ .collect::<Vec<_>>()
+}
+
+macro_rules! make_string {
+ ($row:ident, $idx:ident, $t:ty) => {{
+ let value: Option<$t> = $row.get($idx);
+ match value {
+ Some(value) => value.to_string(),
+ None => NULL_STR.to_string(),
+ }
+ }};
+ ($row:ident, $idx:ident, $t:ty, $convert:ident) => {{
+ let value: Option<$t> = $row.get($idx);
+ match value {
+ Some(value) => $convert(value).to_string(),
+ None => NULL_STR.to_string(),
+ }
+ }};
+}
+
+fn cell_to_string(row: &Row, column: &Column, idx: usize) -> String {
+ match column.type_().clone() {
+ Type::CHAR => make_string!(row, idx, i8),
+ Type::INT2 => make_string!(row, idx, i16),
+ Type::INT4 => make_string!(row, idx, i32),
+ Type::INT8 => make_string!(row, idx, i64),
+ Type::NUMERIC => make_string!(row, idx, Decimal, decimal_to_str),
+ Type::DATE => make_string!(row, idx, NaiveDate),
+ Type::TIME => make_string!(row, idx, NaiveTime),
+ Type::TIMESTAMP => {
+ let value: Option<NaiveDateTime> = row.get(idx);
+ value
+ .map(|d| format!("{d:?}"))
+ .unwrap_or_else(|| "NULL".to_string())
+ }
+ Type::BOOL => make_string!(row, idx, bool, bool_to_str),
+ Type::BPCHAR | Type::VARCHAR | Type::TEXT => {
+ make_string!(row, idx, &str, varchar_to_str)
+ }
+ Type::FLOAT4 => make_string!(row, idx, f32, f32_to_str),
+ Type::FLOAT8 => make_string!(row, idx, f64, f64_to_str),
+ Type::REGTYPE => make_string!(row, idx, PgRegtype),
+ _ => unimplemented!("Unsupported type: {}", column.type_().name()),
+ }
+}
+
+fn convert_types(types: Vec<Type>) -> Vec<DFColumnType> {
+ types
+ .into_iter()
+ .map(|t| match t {
+ Type::BOOL => DFColumnType::Boolean,
+ Type::INT2 | Type::INT4 | Type::INT8 => DFColumnType::Integer,
+ Type::BPCHAR | Type::VARCHAR | Type::TEXT => DFColumnType::Text,
+ Type::FLOAT4 | Type::FLOAT8 | Type::NUMERIC => DFColumnType::Float,
+ Type::DATE | Type::TIME => DFColumnType::DateTime,
+ Type::TIMESTAMP => DFColumnType::Timestamp,
+ _ => DFColumnType::Another,
+ })
+ .collect()
+}
diff --git a/datafusion/core/tests/sqllogictests/src/main.rs b/datafusion/core/tests/sqllogictests/src/main.rs
index 430d4b4966..556949ec6e 100644
--- a/datafusion/core/tests/sqllogictests/src/main.rs
+++ b/datafusion/core/tests/sqllogictests/src/main.rs
@@ -19,6 +19,7 @@ use std::error::Error;
use std::path::{Path, PathBuf};
use log::info;
+use sqllogictest::strict_column_validator;
use datafusion::prelude::{SessionConfig, SessionContext};
@@ -26,7 +27,6 @@ use crate::engines::datafusion::DataFusion;
use crate::engines::postgres::Postgres;
mod engines;
-mod output;
mod setup;
mod utils;
@@ -68,6 +68,7 @@ async fn run_test_file(
info!("Running with DataFusion runner: {}", path.display());
let ctx = context_for_test_file(&relative_path).await;
let mut runner = sqllogictest::Runner::new(DataFusion::new(ctx, relative_path));
+ runner.with_column_validator(strict_column_validator);
runner.run_file_async(path).await?;
Ok(())
}
@@ -77,13 +78,10 @@ async fn run_test_file_with_postgres(
relative_path: PathBuf,
) -> Result<(), Box<dyn Error>> {
info!("Running with Postgres runner: {}", path.display());
-
let postgres_client = Postgres::connect(relative_path).await?;
-
- sqllogictest::Runner::new(postgres_client)
- .run_file_async(path)
- .await?;
-
+ let mut runner = sqllogictest::Runner::new(postgres_client);
+ runner.with_column_validator(strict_column_validator);
+ runner.run_file_async(path).await?;
Ok(())
}
@@ -98,9 +96,13 @@ async fn run_complete_file(
let ctx = context_for_test_file(&relative_path).await;
let mut runner = sqllogictest::Runner::new(DataFusion::new(ctx, relative_path));
let col_separator = " ";
- let validator = default_validator;
runner
- .update_test_file(path, col_separator, validator)
+ .update_test_file(
+ path,
+ col_separator,
+ default_validator,
+ strict_column_validator,
+ )
.await
.map_err(|e| e.to_string())?;
diff --git a/datafusion/core/tests/sqllogictests/src/output.rs b/datafusion/core/tests/sqllogictests/src/output.rs
deleted file mode 100644
index 26d26eabaa..0000000000
--- a/datafusion/core/tests/sqllogictests/src/output.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use sqllogictest::{DBOutput, DefaultColumnType};
-
-pub type DFColumnType = DefaultColumnType;
-
-/// The output type fed to the sqllogictest Runner
-///
-/// See <https://github.com/apache/arrow-datafusion/issues/4499> for
-/// potentially more full featured support.
-pub type DFOutput = DBOutput<DFColumnType>;
diff --git a/datafusion/core/tests/sqllogictests/test_files/aggregate.slt b/datafusion/core/tests/sqllogictests/test_files/aggregate.slt
index 2b280a5c85..694b062c7f 100644
--- a/datafusion/core/tests/sqllogictests/test_files/aggregate.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/aggregate.slt
@@ -106,7 +106,7 @@ select covar_pop(sq.column1, sq.column2) from (values (1.1, 2.2)) as sq
0
# all_nulls_query_covar
-query R
+query RR
with data as (
select null::int as f, null::int as b
union all
@@ -118,7 +118,7 @@ from data
NULL NULL
# covar_query_with_nulls
-query R
+query RR
with data as (
select 1 as f, 4 as b
union all
@@ -344,13 +344,13 @@ SELECT median(a) FROM median_f64
3.3
# median_f64_nan
-query T
+query R
SELECT median(a) FROM median_f64_nan
----
NaN
# approx_median_f64_nan
-query T
+query R
SELECT approx_median(a) FROM median_f64_nan
----
NaN
@@ -365,13 +365,13 @@ create table cpu (host string, usage float) as select * from (values
('host1', 90.4)
);
-query CI rowsort
+query TR rowsort
select host, median(usage) from cpu group by host;
----
host0 90.1
host1 90.3
-query CI
+query R
select median(usage) from cpu;
----
90.2
@@ -395,7 +395,7 @@ create table cpu (host string, usage float) as select * from (values
('host1', 89.3)
);
-query CI rowsort
+query TR rowsort
select host, median(usage) from cpu group by host;
----
host0 90.2
@@ -410,7 +410,7 @@ drop table cpu;
statement ok
create table cpu (host string, usage float) as select * from (values ('host0', 90.2), ('host1', 90.1), ('host1', 90.5), ('host0', 90.5), ('host1', 90.0), ('host1', 90.3), ('host1', 90.2), ('host1', 90.3));
-query CI rowsort
+query TR rowsort
select host, median(usage) from cpu group by host;
----
host0 90.35
@@ -499,161 +499,161 @@ SELECT approx_distinct(c9) AS a, approx_distinct(c9) AS b FROM aggregate_test_10
## float values.
#csv_query_approx_percentile_cont (c2)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c2, 0.1) AS DOUBLE) / 1.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c2, 0.5) AS DOUBLE) / 3.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c2, 0.9) AS DOUBLE) / 5.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c3)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c3, 0.1) AS DOUBLE) / -95.3) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c3, 0.5) AS DOUBLE) / 15.5) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c3, 0.9) AS DOUBLE) / 102.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c4)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c4, 0.1) AS DOUBLE) / -22925.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c4, 0.5) AS DOUBLE) / 4599.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c4, 0.9) AS DOUBLE) / 25334.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c5)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c5, 0.1) AS DOUBLE) / -1882606710.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c5, 0.5) AS DOUBLE) / 377164262.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c5, 0.9) AS DOUBLE) / 1991374996.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c6)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c6, 0.1) AS DOUBLE) / -7250000000000000000) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c6, 0.5) AS DOUBLE) / 1130000000000000000) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c6, 0.9) AS DOUBLE) / 7370000000000000000) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c7)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c7, 0.1) AS DOUBLE) / 18.9) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c7, 0.5) AS DOUBLE) / 134.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c7, 0.9) AS DOUBLE) / 231.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c8)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c8, 0.1) AS DOUBLE) / 2671.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c8, 0.5) AS DOUBLE) / 30634.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c8, 0.9) AS DOUBLE) / 57518.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c9)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c9, 0.1) AS DOUBLE) / 472608672.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c9, 0.5) AS DOUBLE) / 2365817608.0) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c9, 0.9) AS DOUBLE) / 3776538487.0) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c10)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c10, 0.1) AS DOUBLE) / 1830000000000000000) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c10, 0.5) AS DOUBLE) / 9300000000000000000) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c10, 0.9) AS DOUBLE) / 16100000000000000000) < 0.05) AS q FROM aggregate_test_100
----
true
# csv_query_approx_percentile_cont (c11)
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c11, 0.1) AS DOUBLE) / 0.109) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c11, 0.5) AS DOUBLE) / 0.491) < 0.05) AS q FROM aggregate_test_100
----
true
-query T
+query B
SELECT (ABS(1 - CAST(approx_percentile_cont(c11, 0.9) AS DOUBLE) / 0.834) < 0.05) AS q FROM aggregate_test_100
----
true
@@ -986,19 +986,19 @@ SELECT count(1 + 1)
1
# csv_query_array_agg
-query T
+query ?
SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 2) test
----
[0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm, 0keZ5G8BffGwgF2RwQD59TFzMStxCB]
# csv_query_array_agg_empty
-query I
+query ?
SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 LIMIT 0) test
----
[]
# csv_query_array_agg_one
-query I
+query ?
SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1) test
----
[0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm]
@@ -1218,13 +1218,13 @@ e 4
# array_agg_zero
-query U
+query ?
SELECT ARRAY_AGG([]);
----
[]
# array_agg_one
-query U
+query ?
SELECT ARRAY_AGG([1]);
----
[[1]]
@@ -1261,7 +1261,7 @@ NULL 1
NULL 2
# avg should be null
-query II
+query RI
SELECT avg(column1), column2 from the_nulls group by column2 order by column2;
----
NULL 1
diff --git a/datafusion/core/tests/sqllogictests/test_files/dates.slt b/datafusion/core/tests/sqllogictests/test_files/dates.slt
index f66fd9eeb4..65234b29d2 100644
--- a/datafusion/core/tests/sqllogictests/test_files/dates.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/dates.slt
@@ -38,7 +38,7 @@ CREATE TABLE test(
;
-query C rowsort
+query T rowsort
select i_item_desc
from test
where d3_date > d2_date + INTERVAL '1 days';
@@ -50,7 +50,7 @@ f
g
h
-query C rowsort
+query T rowsort
select i_item_desc
from test
where d3_date > d2_date + INTERVAL '5 days';
@@ -59,7 +59,7 @@ g
h
# date and other predicate
-query C rowsort
+query T rowsort
select i_item_desc
from test
where d3_date > d2_date + INTERVAL '5 days' AND i_item_desc != 'g';
@@ -67,7 +67,7 @@ where d3_date > d2_date + INTERVAL '5 days' AND i_item_desc != 'g';
h
# swap predicate order
-query C rowsort
+query T rowsort
select i_item_desc
from test
where i_item_desc != 'g' AND d3_date > d2_date + INTERVAL '5 days';
@@ -75,7 +75,7 @@ where i_item_desc != 'g' AND d3_date > d2_date + INTERVAL '5 days';
h
## Use OR
-query C rowsort
+query T rowsort
select i_item_desc from test
where d3_date > d2_date + INTERVAL '5 days'
OR d3_date = d2_date + INTERVAL '3 days';
diff --git a/datafusion/core/tests/sqllogictests/test_files/ddl.slt b/datafusion/core/tests/sqllogictests/test_files/ddl.slt
index e59971ee9e..642093c364 100644
--- a/datafusion/core/tests/sqllogictests/test_files/ddl.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/ddl.slt
@@ -209,7 +209,7 @@ CREATE external table aggregate_simple(c1 real, c2 double, c3 boolean) STORED as
statement ok
CREATE TABLE my_table AS SELECT * FROM aggregate_simple
-query II rowsort
+query RRB rowsort
SELECT * FROM my_table order by c1 LIMIT 1
----
0.00001 0.000000000001 true
@@ -234,7 +234,7 @@ DROP TABLE non_existent_table;
statement ok
CREATE TABLE my_table(c1 float, c2 double, c3 boolean, c4 varchar) AS SELECT *,c3 as c4_tmp FROM aggregate_simple;
-query II rowsort
+query RRBT rowsort
SELECT * FROM my_table order by c1 LIMIT 1
----
0.00001 0.000000000001 true 1
@@ -254,7 +254,7 @@ CREATE TABLE my_table(c1 float, c2 double, c3 boolean, c4 varchar) AS SELECT * F
statement ok
CREATE TABLE my_table(c1 int, c2 float, c3 varchar) AS VALUES(1, 2, 'hello')
-query II rowsort
+query IRT rowsort
SELECT * FROM my_table;
----
1 2 hello
@@ -326,7 +326,7 @@ STORED AS CSV
WITH HEADER ROW
LOCATION '../../testing/data/csv/aggregate_test_100.csv';
-query IIIIIIIIIIIII
+query TIIIIIIIIIRRT
SELECT c1, c2, c3, c4, c5, c6, c7, c8, c9, 10, c11, c12, c13 FROM aggregate_test_100 LIMIT 1;
----
c 2 1 18109 2033001162 -6513304855495910254 25 43062 1491205016 10 0.110830784 0.929409733247 6WfVFBVGJSQb7FhA7E0lBwdvjfZnSW
@@ -340,7 +340,7 @@ name VARCHAR,
ts TIMESTAMP
) STORED AS CSV LOCATION 'tests/data/timestamps.csv';
-query CC
+query TP
SELECT * from csv_with_timestamps
----
Jorge 2018-12-13T12:12:10.011
@@ -366,7 +366,7 @@ STORED AS CSV
PARTITIONED BY (c_date)
LOCATION 'tests/data/partitioned_table';
-query CCC
+query TP?
SELECT * from csv_with_timestamps where c_date='2018-11-13'
----
Jorge 2018-12-13T12:12:10.011 2018-11-13
@@ -406,12 +406,12 @@ statement ok
CREATE EXTERNAL TABLE aggregate_simple STORED AS CSV WITH HEADER ROW DELIMITER '|' LOCATION 'tests/data/aggregate_simple_pipe.csv';
-query CCC
+query RRB
SELECT * FROM aggregate_simple order by c1 LIMIT 1;
----
0.00001 0.000000000001 true
-query CCC
+query RRB
SELECT * FROM aggregate_simple order by c1 DESC LIMIT 1;
----
0.00005 0.000000000005 true
@@ -474,13 +474,13 @@ statement ok
CREATE OR REPLACE TABLE TABLE_WITH_NORMALIZATION(FIELD1 BIGINT, FIELD2 BIGINT);
# Check table name is in lowercase
-query CCCC
+query TTTT
show create table table_with_normalization
----
datafusion public table_with_normalization NULL
# Check column name is in uppercase
-query CCC
+query TTT
describe table_with_normalization
----
field1 Int64 NO
@@ -494,13 +494,13 @@ statement ok
CREATE TABLE TABLE_WITHOUT_NORMALIZATION(FIELD1 BIGINT, FIELD2 BIGINT) AS VALUES (1,2);
# Check table name is in uppercase
-query CCCC
+query TTTT
show create table TABLE_WITHOUT_NORMALIZATION
----
datafusion public TABLE_WITHOUT_NORMALIZATION NULL
# Check column name is in uppercase
-query CCC
+query TTT
describe TABLE_WITHOUT_NORMALIZATION
----
FIELD1 Int64 YES
@@ -511,7 +511,7 @@ select 10000000000000000000.01
----
10000000000000000000
-query C
+query T
select arrow_typeof(10000000000000000000.01)
----
Float64
@@ -524,7 +524,7 @@ select 10000000000000000000.01
----
10000000000000000000.01
-query C
+query T
select arrow_typeof(10000000000000000000.01)
----
Decimal128(22, 2)
@@ -534,4 +534,4 @@ statement ok
set datafusion.sql_parser.parse_float_as_decimal = false;
statement ok
-set datafusion.sql_parser.enable_ident_normalization = true;
\ No newline at end of file
+set datafusion.sql_parser.enable_ident_normalization = true;
diff --git a/datafusion/core/tests/sqllogictests/test_files/decimal.slt b/datafusion/core/tests/sqllogictests/test_files/decimal.slt
index 10c11f574d..f369225356 100644
--- a/datafusion/core/tests/sqllogictests/test_files/decimal.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/decimal.slt
@@ -15,27 +15,27 @@
# specific language governing permissions and limitations
# under the License.
-query ?R
+query TR
select arrow_typeof(cast(1.23 as decimal(10,4))),
cast(1.23 as decimal(10,4));
----
Decimal128(10, 4) 1.23
-query ?R
+query TR
select arrow_typeof(cast(cast(1.23 as decimal(10,3)) as decimal(10,4))),
cast(cast(1.23 as decimal(10,3)) as decimal(10,4));
----
Decimal128(10, 4) 1.23
-query ?R
+query TR
select arrow_typeof(cast(1.2345 as decimal(24,2))), cast(1.2345 as decimal(24,2));
----
Decimal128(24, 2) 1.23
-query ok
+statement ok
CREATE EXTERNAL TABLE decimal_simple (
c1 DECIMAL(10,6) NOT NULL,
c2 DOUBLE NOT NULL,
@@ -48,7 +48,7 @@ WITH HEADER ROW
LOCATION 'tests/data/decimal_data.csv';
-query ??
+query TT
select arrow_typeof(c1), arrow_typeof(c5) from decimal_simple where c1 > c5 limit 1;
----
Decimal128(10, 6) Decimal128(12, 7)
@@ -88,7 +88,7 @@ select c1 from decimal_simple where c1 > 0.000030;
0.00005
-query RRI?R rowsort
+query RRIBR rowsort
select * from decimal_simple where c1 > c5;
----
0.00002 0.000000000002 3 false 0.000019
@@ -96,13 +96,13 @@ select * from decimal_simple where c1 > c5;
0.00005 0.000000000005 8 false 0.000033
-query ?R
+query TR
select arrow_typeof(min(c1)), min(c1) from decimal_simple where c4=false;
----
Decimal128(10, 6) 0.00002
-query ?R
+query TR
select arrow_typeof(max(c1)), max(c1) from decimal_simple where c4=false;
----
Decimal128(10, 6) 0.00005
@@ -110,7 +110,7 @@ Decimal128(10, 6) 0.00005
# inferred precision is 10+10
# inferred scale is the original scale
-query R
+query TR
select arrow_typeof(sum(c1)), sum(c1) from decimal_simple;
----
Decimal128(20, 6) 0.00055
@@ -118,13 +118,13 @@ Decimal128(20, 6) 0.00055
# inferred precision is original precision + 4
# inferred scale is the original scale + 4
-query ?R
+query TR
select arrow_typeof(avg(c1)), avg(c1) from decimal_simple;
----
Decimal128(14, 10) 0.0000366666
-query RRI?R rowsort
+query RRIBR rowsort
select * from decimal_simple where c1=CAST(0.00002 as Decimal(10,8));
----
0.00002 0.000000000002 2 true 0.000025
@@ -149,13 +149,13 @@ select c2,c3 from decimal_simple where c1!=0.00002;
0.000000000005 9
-query RRI?R
+query RRIBR
select * from decimal_simple where 0.00002 > c1;
----
0.00001 0.000000000001 1 true 0.000014
-query RRI?R rowsort
+query RRIBR rowsort
select * from decimal_simple where c1 <= 0.00002;
----
0.00001 0.000000000001 1 true 0.000014
@@ -163,7 +163,7 @@ select * from decimal_simple where c1 <= 0.00002;
0.00002 0.000000000002 3 false 0.000019
-query RRI?R rowsort
+query RRIBR rowsort
select * from decimal_simple where c1 > 0.00002;
----
0.00003 0.000000000003 4 true 0.000032
@@ -180,7 +180,7 @@ select * from decimal_simple where c1 > 0.00002;
0.00005 0.000000000005 9 true 0.000052
-query RRI?R rowsort
+query RRIBR rowsort
select * from decimal_simple where c1 >= 0.00002;
----
0.00002 0.000000000002 2 true 0.000025
@@ -199,7 +199,7 @@ select * from decimal_simple where c1 >= 0.00002;
0.00005 0.000000000005 9 true 0.000052
-query ?
+query T
select arrow_typeof(c1+1) from decimal_simple limit 1;
----
Decimal128(27, 6)
@@ -226,7 +226,7 @@ select c1+1 from decimal_simple;
# array decimal(10,6) + array decimal(12,7) => decimal(13,7)
-query ?
+query T
select arrow_typeof(c1+c5) from decimal_simple limit 1;
----
Decimal128(13, 7)
@@ -252,7 +252,7 @@ select c1+c5 from decimal_simple;
0.00015
-query ?
+query T
select arrow_typeof(c1-1) from decimal_simple limit 1;
----
Decimal128(27, 6)
@@ -278,7 +278,7 @@ select c1-1 from decimal_simple;
-0.99999
-query ?
+query T
select arrow_typeof(c1-c5) from decimal_simple limit 1;
----
Decimal128(13, 7)
@@ -304,7 +304,7 @@ select c1-c5 from decimal_simple;
0.000019
-query ?
+query T
select arrow_typeof(c1*20) from decimal_simple limit 1;
----
Decimal128(31, 6)
@@ -330,7 +330,7 @@ select c1*20 from decimal_simple;
0.001
-query ?
+query T
select arrow_typeof(c1*c5) from decimal_simple limit 1;
----
Decimal128(23, 13)
@@ -356,7 +356,7 @@ select c1*c5 from decimal_simple;
0.000000005
-query ?
+query T
select arrow_typeof(c1/cast(0.00001 as decimal(5,5))) from decimal_simple limit 1;
----
Decimal128(21, 12)
@@ -382,7 +382,7 @@ select c1/cast(0.00001 as decimal(5,5)) from decimal_simple;
5
-query ?
+query T
select arrow_typeof(c1/c5) from decimal_simple limit 1;
----
Decimal128(30, 19)
@@ -408,7 +408,7 @@ select c1/c5 from decimal_simple;
2.727272727273
-query ?
+query T
select arrow_typeof(c5%cast(0.00001 as decimal(5,5))) from decimal_simple limit 1;
----
Decimal128(7, 7)
@@ -434,7 +434,7 @@ select c5%cast(0.00001 as decimal(5,5)) from decimal_simple;
0.000009
-query ?
+query T
select arrow_typeof(c1%c5) from decimal_simple limit 1;
----
Decimal128(11, 7)
@@ -460,7 +460,7 @@ select c1%c5 from decimal_simple;
0.00005
-query ?
+query T
select arrow_typeof(abs(c1)) from decimal_simple limit 1;
----
Float64
@@ -486,7 +486,7 @@ SELECT abs(c1) from decimal_simple;
0.00005
-query RRI?R
+query RRIBR
select * from decimal_simple where c1 >= 0.00004 order by c1;
----
0.00004 0.000000000004 5 true 0.000044
@@ -500,7 +500,7 @@ select * from decimal_simple where c1 >= 0.00004 order by c1;
0.00005 0.000000000005 1 false 0.0001
-query RRI?R
+query RRIBR
select * from decimal_simple where c1 >= 0.00004 order by c1 limit 10;
----
0.00004 0.000000000004 5 true 0.000044
@@ -514,7 +514,7 @@ select * from decimal_simple where c1 >= 0.00004 order by c1 limit 10;
0.00005 0.000000000005 1 false 0.0001
-query RRI?R
+query RRIBR
select * from decimal_simple where c1 >= 0.00004 order by c1 limit 5;
----
0.00004 0.000000000004 5 true 0.000044
@@ -524,7 +524,7 @@ select * from decimal_simple where c1 >= 0.00004 order by c1 limit 5;
0.00005 0.000000000005 9 true 0.000052
-query RRI?R
+query RRIBR
select * from decimal_simple where c1 >= 0.00004 order by c1 desc;
----
0.00005 0.000000000005 9 true 0.000052
@@ -538,7 +538,7 @@ select * from decimal_simple where c1 >= 0.00004 order by c1 desc;
0.00004 0.000000000004 8 false 0.000044
-query RRI?R
+query RRIBR
select * from decimal_simple where c1 < 0.00003 order by c1 desc,c4;
----
0.00002 0.000000000002 3 false 0.000019
@@ -556,7 +556,7 @@ select count(*),c1 from decimal_simple group by c1 order by c1;
5 0.00005
-query IR?
+query IRB
select count(*),c1,c4 from decimal_simple group by c1,c4 order by c1,c4;
----
1 0.00001 true
@@ -570,25 +570,25 @@ select count(*),c1,c4 from decimal_simple group by c1,c4 order by c1,c4;
3 0.00005 true
-query R
+query TR
select arrow_typeof(cast(400420638.54 as decimal(12,2))), cast(400420638.54 as decimal(12,2));
----
Decimal128(12, 2) 400420638.54
-query R
+query TR
select arrow_typeof(cast(400420638.54 as decimal(12,2)) * 1.0), cast(400420638.54 as decimal(12,2)) * 1.0;
----
Float64 400420638.54
-query ??
+query TB
select arrow_typeof(a < null), a < null from (values (1.1::decimal)) as t(a);
----
Boolean NULL
-query ??
+query TB
select arrow_typeof(null <= a), null <= a from (values (1.1::decimal)) as t(a);
----
Boolean NULL
diff --git a/datafusion/core/tests/sqllogictests/test_files/describe.slt b/datafusion/core/tests/sqllogictests/test_files/describe.slt
index 2b7f118a48..9862f65806 100644
--- a/datafusion/core/tests/sqllogictests/test_files/describe.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/describe.slt
@@ -26,7 +26,7 @@ set datafusion.catalog.information_schema = true
statement ok
CREATE external table aggregate_simple(c1 real, c2 double, c3 boolean) STORED as CSV WITH HEADER ROW LOCATION 'tests/data/aggregate_simple.csv';
-query C1 rowsort
+query TTT rowsort
DESCRIBE aggregate_simple;
----
c1 Float32 NO
@@ -46,7 +46,7 @@ set datafusion.catalog.information_schema = false
statement ok
CREATE external table aggregate_simple(c1 real, c2 double, c3 boolean) STORED as CSV WITH HEADER ROW LOCATION 'tests/data/aggregate_simple.csv';
-query C2 rowsort
+query TTT rowsort
DESCRIBE aggregate_simple;
----
c1 Float32 NO
diff --git a/datafusion/core/tests/sqllogictests/test_files/explain.slt b/datafusion/core/tests/sqllogictests/test_files/explain.slt
index 9192a09471..9eca732c45 100644
--- a/datafusion/core/tests/sqllogictests/test_files/explain.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/explain.slt
@@ -35,7 +35,7 @@ STORED AS CSV
WITH HEADER ROW
LOCATION '../../testing/data/csv/aggregate_test_100.csv';
-query ??
+query TT
explain SELECT c1 FROM aggregate_test_100 where c2 > 10
----
logical_plan
@@ -55,7 +55,7 @@ ProjectionExec: expr=[c1@0 as c1]
statement ok
set datafusion.explain.physical_plan_only = true
-query ??
+query TT
EXPLAIN select count(*) from (values ('a', 1, 100), ('a', 2, 150)) as t (c1,c2,c3)
----
physical_plan
diff --git a/datafusion/core/tests/sqllogictests/test_files/information_schema.slt b/datafusion/core/tests/sqllogictests/test_files/information_schema.slt
index 75eca2ddff..99fdfe30a6 100644
--- a/datafusion/core/tests/sqllogictests/test_files/information_schema.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/information_schema.slt
@@ -30,7 +30,7 @@ statement ok
set datafusion.catalog.information_schema = true;
# Verify the information schema now does exist and is empty
-query CCC rowsort
+query TTTT rowsort
SELECT * from information_schema.tables;
----
datafusion information_schema columns VIEW
@@ -61,7 +61,7 @@ set datafusion.catalog.information_schema = true
statement ok
create table t as values (1);
-query CCC rowsort
+query TTTT rowsort
SELECT * from information_schema.tables;
----
datafusion information_schema columns VIEW
@@ -74,7 +74,7 @@ datafusion public t BASE TABLE
statement ok
create table t2 as values (1);
-query CCC rowsort
+query TTTT rowsort
SELECT * from information_schema.tables;
----
datafusion information_schema columns VIEW
@@ -102,7 +102,7 @@ statement ok
SET datafusion.execution.target_partitions=7
# show all variables
-query R rowsort
+query TT rowsort
SHOW ALL
----
datafusion.catalog.create_default_catalog_and_schema true
@@ -142,21 +142,21 @@ datafusion.sql_parser.enable_ident_normalization true
datafusion.sql_parser.parse_float_as_decimal false
# show_variable_in_config_options
-query R
+query TT
SHOW datafusion.execution.batch_size
----
datafusion.execution.batch_size 8192
# show_time_zone_default_utc
# https://github.com/apache/arrow-datafusion/issues/3255
-query R
+query TT
SHOW TIME ZONE
----
datafusion.execution.time_zone +00:00
# show_timezone_default_utc
# https://github.com/apache/arrow-datafusion/issues/3255
-query R
+query TT
SHOW TIMEZONE
----
datafusion.execution.time_zone +00:00
@@ -168,7 +168,7 @@ datafusion.execution.time_zone +00:00
statement ok
CREATE OR REPLACE TABLE some_table AS VALUES (1,2),(3,4);
-query R rowsort
+query TTT rowsort
DESCRIBE some_table
----
column1 Int64 YES
@@ -182,7 +182,7 @@ DROP TABLE public.some_table;
statement ok
CREATE OR REPLACE TABLE public.some_table AS VALUES (1,2),(3,4);
-query R rowsort
+query TTT rowsort
DESCRIBE public.some_table
----
column1 Int64 YES
@@ -196,7 +196,7 @@ DROP TABLE public.some_table;
statement ok
CREATE OR REPLACE TABLE datafusion.public.some_table AS VALUES (1,2),(3,4);
-query R rowsort
+query TTT rowsort
DESCRIBE datafusion.public.some_table
----
column1 Int64 YES
@@ -212,7 +212,7 @@ describe table;
# information_schema_show_tables
-query CCCC rowsort
+query TTTT rowsort
SHOW TABLES
----
datafusion information_schema columns VIEW
@@ -243,7 +243,7 @@ SHOW COLUMNS FROM t LIKE 'f';
statement error Error during planning: SHOW COLUMNS with WHERE or LIKE is not supported
SHOW COLUMNS FROM t WHERE column_name = 'bar';
-query CCCCCC
+query TTTTTT
SHOW COLUMNS FROM t;
----
datafusion public t i Int32 NO
@@ -253,13 +253,13 @@ statement error Error during planning: table 'datafusion.public.T' not found
SHOW columns from "T"
# information_schema_show_columns_full_extended
-query CCCCCC
+query TTTTITTTIIIIIIT
SHOW FULL COLUMNS FROM t;
----
datafusion public t i 0 NULL NO Int32 NULL NULL 32 2 NULL NULL NULL
# expect same as above
-query CCCCCC
+query TTTTITTTIIIIIIT
SHOW EXTENDED COLUMNS FROM t;
----
datafusion public t i 0 NULL NO Int32 NULL NULL 32 2 NULL NULL NULL
@@ -277,12 +277,12 @@ set datafusion.catalog.information_schema = true;
# information_schema_show_columns_names()
-query CCCCCC
+query TTTTTT
SHOW columns from public.t
----
datafusion public t i Int32 NO
-query CCCCCC
+query TTTTTT
SHOW columns from datafusion.public.t
----
datafusion public t i Int32 NO
@@ -297,9 +297,8 @@ SHOW columns from datafusion.public.t2
# show_non_existing_variable
# FIXME
# currently we cannot know whether a variable exists, this will output 0 row instead
-query C
+statement ok
SHOW SOMETHING_UNKNOWN;
-----
statement ok
DROP TABLE t;
@@ -324,7 +323,7 @@ CREATE TABLE abc AS VALUES (1,2,3), (4,5,6);
statement ok
CREATE VIEW xyz AS SELECT * FROM abc
-query CCCC
+query TTTT
SHOW CREATE TABLE xyz
----
datafusion public xyz CREATE VIEW xyz AS SELECT * FROM abc
@@ -345,7 +344,7 @@ CREATE SCHEMA test;
statement ok
CREATE VIEW test.xyz AS SELECT * FROM abc;
-query CCCC
+query TTTT
SHOW CREATE TABLE test.xyz
----
datafusion test xyz CREATE VIEW test.xyz AS SELECT * FROM abc
@@ -366,7 +365,7 @@ CREATE EXTERNAL TABLE abc
STORED AS CSV
WITH HEADER ROW LOCATION '../../testing/data/csv/aggregate_test_100.csv';
-query CCCC
+query TTTT
SHOW CREATE TABLE abc;
----
datafusion public abc CREATE EXTERNAL TABLE abc STORED AS CSV LOCATION ../../testing/data/csv/aggregate_test_100.csv
diff --git a/datafusion/core/tests/sqllogictests/test_files/misc.slt b/datafusion/core/tests/sqllogictests/test_files/misc.slt
index ab17062ade..848cdc9439 100644
--- a/datafusion/core/tests/sqllogictests/test_files/misc.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/misc.slt
@@ -20,7 +20,7 @@
# Show string normalization working
# '' --> (empty)
# '' --> NULL
-query II
+query TT?
select 'foo', '', NULL
----
-foo (empty) NULL
\ No newline at end of file
+foo (empty) NULL
diff --git a/datafusion/core/tests/sqllogictests/test_files/nullif.slt b/datafusion/core/tests/sqllogictests/test_files/nullif.slt
index 9db3b5c01b..f8240f70e3 100644
--- a/datafusion/core/tests/sqllogictests/test_files/nullif.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/nullif.slt
@@ -31,7 +31,7 @@ CREATE TABLE test(
;
# Arrays tests
-query T rowsort
+query I rowsort
SELECT NULLIF(int_field, 2) FROM test;
----
1
@@ -42,7 +42,7 @@ NULL
NULL
-query T rowsort
+query B rowsort
SELECT NULLIF(bool_field, false) FROM test;
----
NULL
@@ -64,7 +64,7 @@ def
ghij
-query T rowsort
+query I rowsort
SELECT NULLIF(int_field, more_ints) FROM test;
----
1
@@ -75,7 +75,7 @@ NULL
NULL
-query T rowsort
+query I rowsort
SELECT NULLIF(3, int_field) FROM test;
----
3
@@ -87,17 +87,17 @@ NULL
# Scalar values tests
-query T
+query I
SELECT NULLIF(1, 1);
----
NULL
-query T
+query I
SELECT NULLIF(1, 3);
----
1
-query T
+query I
SELECT NULLIF(NULL, NULL);
----
NULL
diff --git a/datafusion/core/tests/sqllogictests/test_files/order.slt b/datafusion/core/tests/sqllogictests/test_files/order.slt
index f6477cb713..2ae39712c9 100644
--- a/datafusion/core/tests/sqllogictests/test_files/order.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/order.slt
@@ -61,7 +61,7 @@ SELECT MIN(c12) FROM aggregate_test_100 ORDER BY MIN(c12)
# test_nulls_first_asc
-query RC
+query IT
SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three')) AS t (num,letter) ORDER BY num
----
1 one
@@ -70,7 +70,7 @@ NULL three
# test_nulls_first_desc()
-query RC
+query IT
SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three')) AS t (num,letter) ORDER BY num DESC
----
NULL three
@@ -79,7 +79,7 @@ NULL three
# test_specific_nulls_last_desc
-query RC
+query IT
SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three')) AS t (num,letter) ORDER BY num DESC NULLS LAST
----
2 two
@@ -87,7 +87,7 @@ SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three')) AS t (num,letter)
NULL three
# test_specific_nulls_first_asc
-query RT
+query IT
SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three')) AS t (num,letter) ORDER BY num ASC NULLS FIRST
----
NULL three
@@ -101,13 +101,13 @@ CREATE EXTERNAL TABLE test (c1 int, c2 bigint, c3 boolean)
STORED AS CSV LOCATION 'tests/data/partitioned_csv';
# Demonstrate types
-query RC
+query TTT
SELECT arrow_typeof(c1), arrow_typeof(c2), arrow_typeof(c3) FROM test LIMIT 1;
----
Int32 Int64 Boolean
-query RC
+query II
SELECT c1, c2 FROM test ORDER BY c1 DESC, c2 ASC
----
3 0
@@ -160,9 +160,8 @@ SELECT c1, c2 FROM test ORDER BY c1 DESC, c2 ASC
# sort_empty
# The predicate on this query purposely generates no results
-query RC
+statement ok
SELECT c1, c2 FROM test WHERE c1 > 100000 ORDER BY c1 DESC, c2 ASC
-----
#####
# Sorting and Grouping
@@ -170,42 +169,42 @@ SELECT c1, c2 FROM test WHERE c1 > 100000 ORDER BY c1 DESC, c2 ASC
statement ok
create table foo as values (1, 2), (3, 4), (5, 6);
-query ok rowsort
+query II rowsort
select * from foo
----
1 2
3 4
5 6
-query ok
+query I
select column1 from foo order by column2;
----
1
3
5
-query ok
+query I
select column1 from foo order by column1 + column2;
----
1
3
5
-query ok
+query I
select column1 from foo order by column1 + column2;
----
1
3
5
-query ok rowsort
+query I rowsort
select column1 + column2 from foo group by column1, column2;
----
11
3
7
-query ok
+query I
select column1 + column2 from foo group by column1, column2 ORDER BY column2 desc;
----
11
@@ -230,7 +229,7 @@ create or replace table t as select column1 as value, column2 as time from (sele
) as sq) as sq
-query I,I rowsort
+query IP rowsort
select
sum(value) AS "value",
date_trunc('hour',time) AS "time"
@@ -242,7 +241,7 @@ GROUP BY time;
3 2022-01-02T00:00:00
# should work fine
-query I,I
+query IP
select
sum(value) AS "value",
date_trunc('minute',time) AS "time"
@@ -260,4 +259,4 @@ select * from t SORT BY time;
## Cleanup
statement ok
-drop table t;
\ No newline at end of file
+drop table t;
diff --git a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_simple.slt b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_simple.slt
index 344fe09d82..6026d07b60 100644
--- a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_simple.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_simple.slt
@@ -577,3 +577,15 @@ e 5 64 -26526 1689098844 8950618259486183091 224 45253 662099130 161279954150608
########
statement ok
DROP TABLE aggregate_test_100_by_sql
+
+
+statement ok
+CREATE TABLE empty_table (
+ c1 TEXT,
+ c2 INT
+);
+
+
+query TI
+select * from empty_table;
+----
diff --git a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_type_coercion.slt b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_type_coercion.slt
index 4a85a835c0..188841df94 100644
--- a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_type_coercion.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_type_coercion.slt
@@ -15,108 +15,37 @@
# specific language governing permissions and limitations
# under the License.
-query ??
+query BB
select true and true, false and false;
----
true false
-onlyif DataFusion
-query ??
-select arrow_typeof(true and true), arrow_typeof(false and false);
-----
-Boolean Boolean
-
-
-onlyif postgres
-query ??
-select pg_typeof(true and true), pg_typeof(false and false);
-----
-bool bool
-
-
-query ??
+query BB
select true or true, false or false;
----
true false
-onlyif DataFusion
-query ??
-select arrow_typeof(true or true), arrow_typeof(false or false);
-----
-Boolean Boolean
-
-
-onlyif postgres
-query ??
-select pg_typeof(true or true), pg_typeof(false or false);
-----
-bool bool
-
-
-query ??
+query BB
select false and true, true and false;
----
false false
-onlyif DataFusion
-query ??
-select arrow_typeof(false and true), arrow_typeof(true and false);
-----
-Boolean Boolean
-
-
-onlyif postgres
-query ??
-select pg_typeof(false and true), pg_typeof(true and false);
-----
-bool bool
-
-
-query ??
+query BB
select false or true, true or false;
----
true true
-onlyif DataFusion
-query ??
-select arrow_typeof(false or true), arrow_typeof(true or false);
-----
-Boolean Boolean
-
-
-onlyif postgres
-query ??
-select pg_typeof(false or true), pg_typeof(true or false);
-----
-bool bool
-
-
-query ??
+query BB
select null and null, null or null;
----
NULL NULL
-onlyif DataFusion
-query ??
-select arrow_typeof(null and null), arrow_typeof(null or null);
-----
-Boolean Boolean
-
-
-onlyif postgres
-query ??
-select pg_typeof(null and null), pg_typeof(null or null);
-----
-bool bool
-
-
-onlyif postgres
-query ????
+query BBBB
select true and null,
false and null,
null and true,
@@ -125,51 +54,10 @@ select true and null,
NULL false NULL false
-onlyif DataFusion
-query ????
-select arrow_typeof(true and null),
- arrow_typeof(false and null),
- arrow_typeof(null and true),
- arrow_typeof(null and false);
-----
-Boolean Boolean Boolean Boolean
-
-
-onlyif postgres
-query ????
-select pg_typeof(true and null),
- pg_typeof(false and null),
- pg_typeof(null and true),
- pg_typeof(null and false);
-----
-bool bool bool bool
-
-
-onlyif postgres
-query ????
+query BBBB
select true or null,
false or null,
null or true,
null or false;
----
true NULL true NULL
-
-
-onlyif DataFusion
-query ????
-select arrow_typeof(true or null),
- arrow_typeof(false or null),
- arrow_typeof(null or true),
- arrow_typeof(null or false);
-----
-Boolean Boolean Boolean Boolean
-
-
-onlyif postgres
-query ????
-select pg_typeof(true or null),
- pg_typeof(false or null),
- pg_typeof(null or true),
- pg_typeof(null or false);
-----
-bool bool bool bool
diff --git a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_types.slt b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_types.slt
index ebe4df92ac..b7497429fa 100644
--- a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_types.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_types.slt
@@ -101,22 +101,22 @@ select 1.0::DECIMAL(5,3) as one, 2.023::DECIMAL(5,3) as two, 3.023::DECIMAL(5,2)
----
1 2.023 3.02
-query ?
+query D
select '2018-01-01'::DATE
----
2018-01-01
-query ?
+query D
select '12:00:01'::TIME
----
12:00:01
-query ?
+query P
select '2018-01-01 12:00:00'::TIMESTAMP
----
2018-01-01T12:00:00
-query I
+query BB
select true::BOOLEAN, 'false'::BOOLEAN
----
true false
diff --git a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_union.slt b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_union.slt
index 5b1788bd75..05343de322 100644
--- a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_union.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_union.slt
@@ -151,7 +151,7 @@ SELECT * FROM (
5
-query I rowsort
+query I rowsort
SELECT * FROM (
SELECT c2
FROM aggregate_test_100_by_sql t1
@@ -165,7 +165,7 @@ SELECT * FROM (
4
-query I rowsort
+query I rowsort
SELECT * FROM (
SELECT c2
FROM aggregate_test_100_by_sql t1
diff --git a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_window.slt b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_window.slt
index 36b0fac14f..7218b7d881 100644
--- a/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_window.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_window.slt
@@ -413,8 +413,7 @@ ORDER BY row_number;
99 100 7.81 781 125 -117
100 100 7.81 781 125 -117
-
-query IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+query IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
SELECT
SUM(c4) OVER(ORDER BY c3 DESC GROUPS BETWEEN 3 PRECEDING AND 1 FOLLOWING) as summation1,
SUM(c4) OVER(ORDER BY c3 DESC GROUPS BETWEEN 3 PRECEDING AND 2 PRECEDING) as summation2,
@@ -1146,7 +1145,7 @@ ORDER BY c9;
2025611582 -2269 231997 199008 5 -45840 56 -15880 5 5
-query IIIII
+query IRIIR
select
c9,
cume_dist() OVER (PARTITION BY c2 ORDER BY c3) cume_dist_by_c3,
diff --git a/datafusion/core/tests/sqllogictests/test_files/prepare.slt b/datafusion/core/tests/sqllogictests/test_files/prepare.slt
index 813288e386..ce4b7217f9 100644
--- a/datafusion/core/tests/sqllogictests/test_files/prepare.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/prepare.slt
@@ -22,7 +22,7 @@
statement ok
create table person (id int, first_name varchar, last_name varchar, age int, state varchar, salary double, birthday timestamp, "😀" int) as values (1, 'jane', 'smith', 20, 'MA', 100000.45, '2000-11-12T00:00:00'::timestamp, 99);
-query C rowsort
+query ITTITRPI rowsort
select * from person;
----
1 jane smith 20 MA 100000.45 2000-11-12T00:00:00 99
diff --git a/datafusion/core/tests/sqllogictests/test_files/scalar.slt b/datafusion/core/tests/sqllogictests/test_files/scalar.slt
index bf7d64e8c9..bd6346c166 100644
--- a/datafusion/core/tests/sqllogictests/test_files/scalar.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/scalar.slt
@@ -30,14 +30,14 @@ CREATE TABLE t1(
;
# log scalar function
-query IT rowsort
+query RR rowsort
select log(2, 64) a, log(100) b union all select log(2, 8), log(10);
----
3 1
6 2
# log scalar function
-query IT rowsort
+query RRR rowsort
select log(a, 64) a, log(b), log(10, b) from t1;
----
3.7855785 4 4
@@ -45,26 +45,26 @@ select log(a, 64) a, log(b), log(10, b) from t1;
Infinity 2 2
# log scalar nulls
-query IT rowsort
+query RR rowsort
select log(null, 64) a, log(null) b
----
NULL NULL
# log scalar nulls 1
-query IT rowsort
+query RR rowsort
select log(2, null) a, log(null) b
----
NULL NULL
# log scalar nulls 2
-query IT rowsort
+query RR rowsort
select log(null, null) a, log(null) b
----
NULL NULL
# log scalar ops with zero edgecases
# please see https://github.com/apache/arrow-datafusion/pull/5245#issuecomment-1426828382
-query IT rowsort
+query RR rowsort
select log(0) a, log(1, 64) b
----
--Infinity Infinity
\ No newline at end of file
+-Infinity Infinity
diff --git a/datafusion/core/tests/sqllogictests/test_files/select.slt b/datafusion/core/tests/sqllogictests/test_files/select.slt
index 65353b0c1c..a1bc524313 100644
--- a/datafusion/core/tests/sqllogictests/test_files/select.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/select.slt
@@ -21,9 +21,8 @@
##########
# all where empty
-query II
+statement ok
SELECT * FROM aggregate_test_100 WHERE 1=2
-----
# Simple values function
query I
@@ -38,7 +37,7 @@ VALUES (-1)
-1
# foo bar
-query IIC
+query IIB
VALUES (2+1,2-1,2>1)
----
3 1 true
@@ -51,7 +50,7 @@ VALUES (1),(2)
2
# multiple rows and columns from VALUES
-query IC rowsort
+query IT rowsort
VALUES (1,'a'),(2,'b')
----
1 a
@@ -65,19 +64,19 @@ CREATE TABLE foo AS VALUES
(5, 6);
# foo distinct
-query I
+query T
select distinct '1' from foo;
----
1
# foo order by
-query I
+query T
select '1' from foo order by column1;
----
1
1
1
-# foo distinct order by
+# foo distinct order by
statement error DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions column1 must appear in select list
-select distinct '1' from foo order by column1;
\ No newline at end of file
+select distinct '1' from foo order by column1;
diff --git a/datafusion/core/tests/sqllogictests/test_files/timestamps.slt b/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
index 6b13c42f49..dce6213f7e 100644
--- a/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
@@ -22,7 +22,7 @@
statement ok
create table foo (val int, ts timestamp) as values (1, '2000-01-01T00:00:00'::timestamp), (2, '2000-02-01T00:00:00'::timestamp), (3, '2000-03-01T00:00:00'::timestamp);
-query C rowsort
+query IP rowsort
select * from foo;
----
1 2000-01-01T00:00:00
@@ -30,36 +30,36 @@ select * from foo;
3 2000-03-01T00:00:00
# Test that we can compare a timestamp to a casted string
-query C rowsort
+query IP rowsort
select * from foo where ts > '2000-01-01T00:00:00'::timestamp;
----
2 2000-02-01T00:00:00
3 2000-03-01T00:00:00
# Test that we can compare a timestamp to a string and it will be coerced
-query C rowsort
+query IP rowsort
select * from foo where ts > '2000-01-01T00:00:00';
----
2 2000-02-01T00:00:00
3 2000-03-01T00:00:00
-query C rowsort
+query IP rowsort
select * from foo where ts < '2000-02-01T00:00:00';
----
1 2000-01-01T00:00:00
-query C rowsort
+query IP rowsort
select * from foo where ts <= '2000-02-01T00:00:00';
----
1 2000-01-01T00:00:00
2 2000-02-01T00:00:00
-query C rowsort
+query IP rowsort
select * from foo where ts = '2000-02-01T00:00:00';
----
2 2000-02-01T00:00:00
-query C rowsort
+query IP rowsort
select * from foo where ts != '2000-02-01T00:00:00';
----
1 2000-01-01T00:00:00
@@ -71,58 +71,58 @@ drop table foo;
###
## test date_bin function
###
-query T
+query P
SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T00:00:00Z')
----
2022-08-03T14:30:00
# Can coerce string interval arguments
-query T
+query P
SELECT DATE_BIN('15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T00:00:00Z')
----
2022-08-03T14:30:00
# Can coerce all string arguments
-query T
+query P
SELECT DATE_BIN('15 minutes', '2022-08-03 14:38:50Z', '1970-01-01T00:00:00Z')
----
2022-08-03T14:30:00
# Shift forward by 5 minutes
-query T
+query P
SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T00:05:00Z')
----
2022-08-03T14:35:00
# Shift backward by 5 minutes
-query T
+query P
SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T23:55:00Z')
----
2022-08-03T14:25:00
# origin after source, timestamp in previous bucket
-query T
+query P
SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '2022-08-03 14:40:00Z')
----
2022-08-03T14:25:00
# stride by 7 days
-query T
+query P
SELECT DATE_BIN(INTERVAL '7 days', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01 00:00:00Z')
----
2022-07-28T00:00:00
# origin shifts bins forward 1 day
-query T
+query P
SELECT DATE_BIN(INTERVAL '7 days', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-02 00:00:00Z')
----
2022-07-29T00:00:00
# demonstrates array values (rather than scalar) for the source argument
-query T rowsort
+query PR rowsort
SELECT
DATE_BIN(INTERVAL '15' minute, time, TIMESTAMP '2001-01-01T00:00:00Z') AS time,
val
@@ -149,37 +149,37 @@ FROM (
###
## test date_trunc function
###
-query T
+query P
SELECT DATE_TRUNC('year', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-01-01T00:00:00
-query T
+query P
SELECT DATE_TRUNC('quarter', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-07-01T00:00:00
-query T
+query P
SELECT DATE_TRUNC('month', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-08-01T00:00:00
-query T
+query P
SELECT DATE_TRUNC('day', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-08-03T00:00:00
-query T
+query P
SELECT DATE_TRUNC('hour', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-08-03T14:00:00
-query T
+query P
SELECT DATE_TRUNC('minute', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-08-03T14:38:00
-query T
+query P
SELECT DATE_TRUNC('second', TIMESTAMP '2022-08-03 14:38:50Z');
----
2022-08-03T14:38:50
@@ -187,7 +187,7 @@ SELECT DATE_TRUNC('second', TIMESTAMP '2022-08-03 14:38:50Z');
# Demonstrate that strings are automatically coerced to timestamps (don't use TIMESTAMP)
-query T
+query P
SELECT DATE_TRUNC('second', '2022-08-03 14:38:50Z');
----
2022-08-03T14:38:50
diff --git a/datafusion/core/tests/sqllogictests/test_files/tpch.slt b/datafusion/core/tests/sqllogictests/test_files/tpch.slt
index 3137451132..ee9b8d92d5 100644
--- a/datafusion/core/tests/sqllogictests/test_files/tpch.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/tpch.slt
@@ -118,7 +118,7 @@ CREATE EXTERNAL TABLE IF NOT EXISTS supplier (
# q1
-query T
+query TTRRRRRRRI
select
l_returnflag,
l_linestatus,
@@ -147,7 +147,7 @@ R F 94 100854.52 92931.39 92931.39 47 50427.26 0.08 2
# q2
-query T
+statement ok
select
s_acctbal,
s_name,
@@ -191,11 +191,10 @@ order by
n_name,
s_name,
p_partkey;
-----
# q3
-query T
+statement ok
select
l_orderkey,
sum(l_extendedprice * (1 - l_discount)) as revenue,
@@ -218,11 +217,10 @@ group by
order by
revenue desc,
o_orderdate;
-----
# q4
-query T
+statement ok
select
l_orderkey,
sum(l_extendedprice * (1 - l_discount)) as revenue,
@@ -245,12 +243,11 @@ group by
order by
revenue desc,
o_orderdate;
-----
# q5
-query T
+statement ok
select
n_name,
sum(l_extendedprice * (1 - l_discount)) as revenue
@@ -275,11 +272,10 @@ group by
n_name
order by
revenue desc;
-----
# q6
-query T
+query R
select
sum(l_extendedprice * l_discount) as revenue
from
@@ -294,7 +290,7 @@ NULL
# q7
-query T
+statement ok
select
supp_nation,
cust_nation,
@@ -334,11 +330,10 @@ order by
supp_nation,
cust_nation,
l_year;
-----
# q8
-query T
+statement ok
select
o_year,
sum(case
@@ -376,11 +371,10 @@ group by
o_year
order by
o_year;
-----
# q9
-query T
+statement ok
select
nation,
o_year,
@@ -413,11 +407,10 @@ group by
order by
nation,
o_year desc;
-----
# q10
-query T
+statement ok
select
c_custkey,
c_name,
@@ -449,11 +442,10 @@ group by
c_comment
order by
revenue desc;
-----
# q11
-query T
+statement ok
select
ps_partkey,
sum(ps_supplycost * ps_availqty) as value
@@ -481,11 +473,10 @@ group by
)
order by
value desc;
-----
# q12
-query T
+statement ok
select
l_shipmode,
sum(case
@@ -516,11 +507,10 @@ group by
l_shipmode
order by
l_shipmode;
-----
# q13
-query T
+query II
select
c_count,
count(*) as custdist
@@ -545,7 +535,7 @@ order by
0 9
# q14
-query T
+query R
select
100.00 * sum(case
when p_type like 'PROMO%'
@@ -576,7 +566,7 @@ create view revenue0 (supplier_no, total_revenue) as
l_suppkey;
# q15
-query T
+statement ok
select
s_suppkey,
s_name,
@@ -596,14 +586,13 @@ where
)
order by
s_suppkey;
-----
statement ok
drop view revenue0;
# q16
-query T
+statement ok
select
p_brand,
p_type,
@@ -634,11 +623,10 @@ order by
p_brand,
p_type,
p_size;
-----
# q17
-query T
+query R
select
sum(l_extendedprice) / 7.0 as avg_yearly
from
@@ -660,7 +648,7 @@ where
NULL
# q18
-query T
+statement ok
select
c_name,
c_custkey,
@@ -693,11 +681,10 @@ group by
order by
o_totalprice desc,
o_orderdate;
-----
# q19
-query T
+query R
select
sum(l_extendedprice* (1 - l_discount)) as revenue
from
@@ -738,7 +725,7 @@ NULL
# q20
-query T
+statement ok
select
s_name,
s_address
@@ -776,11 +763,10 @@ where
and n_name = 'CANADA'
order by
s_name;
-----
# q21
-query T
+statement ok
select
s_name,
count(*) as numwait
@@ -820,11 +806,10 @@ group by
order by
numwait desc,
s_name;
-----
# q22
-query T
+query TIR
select
cntrycode,
count(*) as numcust,
diff --git a/datafusion/core/tests/sqllogictests/test_files/union.slt b/datafusion/core/tests/sqllogictests/test_files/union.slt
index f8467dfc8e..8a13dfe36f 100644
--- a/datafusion/core/tests/sqllogictests/test_files/union.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/union.slt
@@ -57,7 +57,7 @@ Alice
John
# union with type coercion
-query T rowsort
+query IT rowsort
(
SELECT * FROM t1
EXCEPT
diff --git a/datafusion/core/tests/sqllogictests/test_files/window.slt b/datafusion/core/tests/sqllogictests/test_files/window.slt
index f155dc86af..7c83c1b9b5 100644
--- a/datafusion/core/tests/sqllogictests/test_files/window.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/window.slt
@@ -62,7 +62,7 @@ limit 5
# for window functions without order by the first, last, and nth function call does not make sense
# csv_query_window_with_partition_by
-query IIIIII
+query IIRIII
select
c9,
sum(cast(c4 as Int)) over (partition by c3) as sum1,
@@ -83,7 +83,7 @@ limit 5
# async fn csv_query_window_with_order_by
-query IIIIII
+query IIRIIIIII
select
c9,
sum(c5) over (order by c9) as sum1,
@@ -105,7 +105,7 @@ limit 5
145294611 -3251637940 -650327588 5 623103518 -1927628110 61035129 -1899175111 -108973366
# csv_query_window_with_partition_by_order_by
-query IIIIII
+query IIRIIIIII
select
c9,
sum(c5) over (partition by c4 order by c9) as sum1,
@@ -127,7 +127,7 @@ limit 5
145294611 -1899175111 -1899175111 1 -1899175111 -1899175111 -1899175111 -1899175111 NULL
# window()
-query IIIIII
+query IIIIIIR
SELECT
c1,
c2,
@@ -148,7 +148,7 @@ LIMIT 5
# window_order_by
-query IIIIII
+query IIIIIIIIIIR
SELECT
c1,
c2,
@@ -172,7 +172,7 @@ LIMIT 5
0 4 5 0 4 1 10 5 4 0 2
# window_partition_by
-query IIIIII
+query IIIIIIR
SELECT
c1,
c2,
@@ -191,7 +191,7 @@ LIMIT 5
0 3 12 4 3 3 3
0 4 16 4 4 4 4
-query IIIIIIIIII
+query IIIIIIIIIIR
SELECT
c1,
c2,
@@ -220,7 +220,7 @@ LIMIT 5
#####
# window expr is not referenced anywhere, eliminate it.
-query ??
+query TT
EXPLAIN
WITH _sample_data AS (
SELECT 1 as a, 'aa' AS b
@@ -280,7 +280,7 @@ SortPreservingMergeExec: [b@0 ASC NULLS LAST]
EmptyExec: produce_one_row=true
# Check actual result:
-query ?I
+query TI
WITH _sample_data AS (
SELECT 1 as a, 'aa' AS b
UNION ALL
@@ -305,7 +305,7 @@ aa 3
bb 7
# window expr is referenced by the output, keep it
-query ??
+query TT
EXPLAIN
WITH _sample_data AS (
SELECT 1 as a, 'aa' AS b
@@ -375,7 +375,7 @@ SortPreservingMergeExec: [b@0 ASC NULLS LAST]
# check actual result
-query ?II
+query TII
WITH _sample_data AS (
SELECT 1 as a, 'aa' AS b
UNION ALL