From 230f88f1d184aea37920beb3811994b7572ff72c Mon Sep 17 00:00:00 2001 From: Adam Gutglick Date: Thu, 23 Jul 2026 12:16:53 +0100 Subject: [PATCH 1/3] Fix Signed-off-by: Adam Gutglick --- .../sqllogictest/src/engines/conversion.rs | 47 +- .../sqllogictest/test_files/aggregate.slt | 48 +- .../test_files/aggregate_skip_partial.slt | 6 +- .../test_files/array/array_min_max.slt | 2 +- .../test_files/array/init_data.slt.part | 1 - .../sqllogictest/test_files/array_add.slt | 2 +- .../sqllogictest/test_files/array_product.slt | 2 +- .../test_files/array_subtract.slt | 2 +- .../sqllogictest/test_files/arrow_typeof.slt | 2 +- .../sqllogictest/test_files/coalesce.slt | 4 +- .../sqllogictest/test_files/decimal.slt | 658 +++++++++--------- datafusion/sqllogictest/test_files/errors.slt | 2 +- .../sqllogictest/test_files/group_by.slt | 2 +- datafusion/sqllogictest/test_files/insert.slt | 2 +- datafusion/sqllogictest/test_files/joins.slt | 18 +- datafusion/sqllogictest/test_files/math.slt | 12 +- .../sqllogictest/test_files/options.slt | 10 +- .../test_files/pg_compat/pg_compat_types.slt | 2 +- .../sqllogictest/test_files/predicates.slt | 2 +- .../sqllogictest/test_files/qualify.slt | 28 +- .../sqllogictest/test_files/repartition.slt | 2 +- .../test_files/run_end_encoded.slt | 8 +- datafusion/sqllogictest/test_files/scalar.slt | 24 +- .../test_files/spark/aggregate/try_sum.slt | 8 +- .../test_files/spark/math/abs.slt | 16 +- .../test_files/spark/math/mod.slt | 2 +- .../test_files/spark/math/pmod.slt | 6 +- .../test_files/spark/math/round.slt | 52 +- datafusion/sqllogictest/test_files/struct.slt | 1 - .../sqllogictest/test_files/subquery.slt | 4 +- datafusion/sqllogictest/test_files/window.slt | 10 +- 31 files changed, 509 insertions(+), 476 deletions(-) diff --git a/datafusion/sqllogictest/src/engines/conversion.rs b/datafusion/sqllogictest/src/engines/conversion.rs index 4447ea9f03bea..bb6b6c7815389 100644 --- a/datafusion/sqllogictest/src/engines/conversion.rs +++ b/datafusion/sqllogictest/src/engines/conversion.rs @@ -50,7 +50,11 @@ pub(crate) fn f16_to_str(value: f16) -> String { } else if value == f16::NEG_INFINITY { "-Infinity".to_string() } else { - big_decimal_to_str(BigDecimal::from_str(&value.to_string()).unwrap(), None) + big_decimal_to_str( + BigDecimal::from_str(&value.to_string()).unwrap(), + None, + true, + ) } } @@ -64,7 +68,11 @@ pub(crate) fn f32_to_str(value: f32) -> String { } else if value == f32::NEG_INFINITY { "-Infinity".to_string() } else { - big_decimal_to_str(BigDecimal::from_str(&value.to_string()).unwrap(), None) + big_decimal_to_str( + BigDecimal::from_str(&value.to_string()).unwrap(), + None, + true, + ) } } @@ -78,7 +86,11 @@ pub(crate) fn f64_to_str(value: f64) -> String { } else if value == f64::NEG_INFINITY { "-Infinity".to_string() } else { - big_decimal_to_str(BigDecimal::from_str(&value.to_string()).unwrap(), None) + big_decimal_to_str( + BigDecimal::from_str(&value.to_string()).unwrap(), + None, + true, + ) } } @@ -92,7 +104,11 @@ pub(crate) fn spark_f64_to_str(value: f64) -> String { } else if value == f64::NEG_INFINITY { "-Infinity".to_string() } else { - big_decimal_to_str(BigDecimal::from_str(&value.to_string()).unwrap(), Some(15)) + big_decimal_to_str( + BigDecimal::from_str(&value.to_string()).unwrap(), + Some(15), + true, + ) } } @@ -105,23 +121,35 @@ pub(crate) fn arrow_decimal_to_str( big_decimal_to_str( BigDecimal::from_str(&value).unwrap(), Some(i64::from(scale)), + false, ) } #[cfg(feature = "postgres")] pub(crate) fn decimal_to_str(value: BigDecimal) -> String { - big_decimal_to_str(value, None) + big_decimal_to_str(value, None, false) } /// Converts a `BigDecimal` to its plain string representation, optionally rounding to a specified number of decimal places. /// /// If `round_digits` is `None`, the value is rounded to 12 decimal places by default. +/// +/// If `normalize` is true, trailing 0s are trimmed. #[expect(clippy::needless_pass_by_value)] -pub(crate) fn big_decimal_to_str(value: BigDecimal, round_digits: Option) -> String { +pub(crate) fn big_decimal_to_str( + value: BigDecimal, + round_digits: Option, + normalize: bool, +) -> String { // Round the value to limit the number of decimal places - let value = value.round(round_digits.unwrap_or(12)).normalized(); + let value = value.round(round_digits.unwrap_or(12)); + // Format the value to a string - value.to_plain_string() + if normalize { + value.normalized().to_plain_string() + } else { + value.to_plain_string() + } } #[cfg(test)] @@ -137,7 +165,8 @@ mod tests { assert_eq!( big_decimal_to_str( BigDecimal::from_bigint(BigInt::from($integer), $scale), - $round_digits + $round_digits, + true ), $expected ); diff --git a/datafusion/sqllogictest/test_files/aggregate.slt b/datafusion/sqllogictest/test_files/aggregate.slt index 26b8a78f3921a..6692f584162f3 100644 --- a/datafusion/sqllogictest/test_files/aggregate.slt +++ b/datafusion/sqllogictest/test_files/aggregate.slt @@ -3337,7 +3337,7 @@ create table t (c1 decimal(10, 0)) as values (1), (2), (3), (4), (5), (6); query RT select avg(c1), arrow_typeof(avg(c1)) from t; ---- -3.5 Decimal128(14, 4) +3.5000 Decimal128(14, 4) statement ok drop table t; @@ -3349,7 +3349,7 @@ create table t (c1 decimal(10, 0)) as values (1), (NULL), (3), (4), (5); query RT select avg(c1), arrow_typeof(avg(c1)) from t; ---- -3.25 Decimal128(14, 4) +3.2500 Decimal128(14, 4) statement ok drop table t; @@ -4857,7 +4857,7 @@ INSERT INTO decimals VALUES (123.0001), (124.00); query RR SELECT MIN(value), MAX(value) FROM decimals; ---- -123 124 +123.00 124.00 statement ok DROP TABLE decimals; @@ -4926,7 +4926,7 @@ INSERT INTO decimals_error VALUES (123.00), (arrow_cast(124.001, 'Decimal128(10, query RR SELECT MIN(value), MAX(value) FROM decimals_error; ---- -123 124 +123.00 124.00 statement ok DROP TABLE decimals_error; @@ -6074,7 +6074,7 @@ NULL query RT select sum(c1), arrow_typeof(sum(c1)) from d_table; ---- -100 Decimal128(20, 3) +100.000 Decimal128(20, 3) # aggregate sum with decimal statement ok @@ -6083,7 +6083,7 @@ create table t (c decimal(35, 3)) as values (10), (null), (20); query RT select sum(c), arrow_typeof(sum(c)) from t; ---- -30 Decimal128(38, 3) +30.000 Decimal128(38, 3) statement ok drop table t; @@ -6162,13 +6162,13 @@ B -1000.045 Decimal128(20, 3) query RT select avg(c1), arrow_typeof(avg(c1)) from d_table ---- -5 Decimal128(14, 7) +5.0000000 Decimal128(14, 7) query TRT select c2, avg(c1), arrow_typeof(avg(c1)) from d_table GROUP BY c2 ORDER BY c2 ---- -A 110.0045 Decimal128(14, 7) -B -100.0045 Decimal128(14, 7) +A 110.0045000 Decimal128(14, 7) +B -100.0045000 Decimal128(14, 7) # aggregate_decimal_count_distinct query I @@ -6403,18 +6403,18 @@ INSERT INTO test_decimal_table VALUES (1, 10.10, 100.1, NULL), (1, 20.20, 200.2, query IIRRRRIIRR rowsort select c1, count(c2), avg(c2), sum(c2), min(c2), max(c2), count(c3), count(c4), sum(c4), avg(c4) from test_decimal_table group by c1 ---- -1 2 15.15 30.3 10.1 20.2 2 0 NULL NULL -2 2 15.15 30.3 10.1 20.2 2 0 NULL NULL -3 2 10.1 20.2 10.1 10.1 1 0 NULL NULL +1 2 15.150000 30.30 10.10 20.20 2 0 NULL NULL +2 2 15.150000 30.30 10.10 20.20 2 0 NULL NULL +3 2 10.100000 20.20 10.10 10.10 1 0 NULL NULL # aggregate_decimal_with_group_by_decimal query RIRRRRIR rowsort select c3, count(c2), avg(c2), sum(c2), min(c2), max(c2), count(c4), sum(c4) from test_decimal_table group by c3 ---- -100.1 2 10.1 20.2 10.1 10.1 0 NULL -200.2 1 20.2 20.2 20.2 20.2 0 NULL -700.1 2 15.15 30.3 10.1 20.2 0 NULL -NULL 1 10.1 10.1 10.1 10.1 0 NULL +100.1 2 10.100000 20.20 10.10 10.10 0 NULL +200.2 1 20.200000 20.20 20.20 20.20 0 NULL +700.1 2 15.150000 30.30 10.10 20.20 0 NULL +NULL 1 10.100000 10.10 10.10 10.10 0 NULL ## Multiple distinct aggregates and dictionaries statement ok @@ -8592,7 +8592,7 @@ create table t_decimal (c decimal(10, 4)) as values (100.00), (125.00), (175.00) query RT select avg(distinct c), arrow_typeof(avg(distinct c)) from t_decimal; ---- -180 Decimal128(14, 8) +180.00000000 Decimal128(14, 8) statement ok drop table t_decimal; @@ -8612,7 +8612,7 @@ create table t_decimal256 (c decimal(50, 2)) as values query RT select avg(distinct c), arrow_typeof(avg(distinct c)) from t_decimal256; ---- -180 Decimal256(54, 6) +180.000000 Decimal256(54, 6) statement ok drop table t_decimal256; @@ -8756,7 +8756,7 @@ select avg(d) from distinct_avg; ---- -3 Float64 37.4255 Float64 698.56005 Decimal128(14, 8) 15041.868333 Decimal256(54, 6) 4 56.52525 957.11074444 1272562.81625 +3 Float64 37.4255 Float64 698.56005000 Decimal128(14, 8) 15041.868333 Decimal256(54, 6) 4 56.52525 957.11074444 1272562.816250 query RRRR rowsort select @@ -8767,11 +8767,11 @@ select from distinct_avg group by b; ---- -1 4.09 4222.124 0 -3 NULL 2161.1901 90251.21 -5 1 100.25625 45125.105 -5 100.5 -49.5781 0.333333 -5 44.112 -132.12 NULL +1 4.09 4222.12400000 0.000000 +3 NULL 2161.19010000 90251.210000 +5 1 100.25625000 45125.105000 +5 100.5 -49.57810000 0.333333 +5 44.112 -132.12000000 NULL query RRRR select diff --git a/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt b/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt index 2ed4c9921f3a7..30c5ce454197d 100644 --- a/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt +++ b/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt @@ -742,9 +742,9 @@ FROM decimal_table CROSS JOIN t GROUP BY i ORDER BY i; ---- -1 66 -2 66 -3 33 +1 66.000 +2 66.000 +3 33.000 # Config reset statement ok diff --git a/datafusion/sqllogictest/test_files/array/array_min_max.slt b/datafusion/sqllogictest/test_files/array/array_min_max.slt index 2e9c1035b765d..108045ef4a008 100644 --- a/datafusion/sqllogictest/test_files/array/array_min_max.slt +++ b/datafusion/sqllogictest/test_files/array/array_min_max.slt @@ -310,7 +310,7 @@ from ( ) as dec_list ) t; ---- -100 300 Decimal128(20, 4) Decimal128(20, 4) +100.0000 300.0000 Decimal128(20, 4) Decimal128(20, 4) diff --git a/datafusion/sqllogictest/test_files/array/init_data.slt.part b/datafusion/sqllogictest/test_files/array/init_data.slt.part index bb8d76809f816..06d029303022b 100644 --- a/datafusion/sqllogictest/test_files/array/init_data.slt.part +++ b/datafusion/sqllogictest/test_files/array/init_data.slt.part @@ -688,4 +688,3 @@ AS arrow_cast(column4, 'FixedSizeList(3, Float64)') AS column4 FROM arrays_distance_table ; - diff --git a/datafusion/sqllogictest/test_files/array_add.slt b/datafusion/sqllogictest/test_files/array_add.slt index e13f6acd269cb..acef9984fdbcc 100644 --- a/datafusion/sqllogictest/test_files/array_add.slt +++ b/datafusion/sqllogictest/test_files/array_add.slt @@ -234,4 +234,4 @@ select array_add(array_add(a, b), c) from (values ---- [111.0, 222.0] NULL -[111.0, NULL] \ No newline at end of file +[111.0, NULL] diff --git a/datafusion/sqllogictest/test_files/array_product.slt b/datafusion/sqllogictest/test_files/array_product.slt index ba60360d1c1a9..a904282358dff 100644 --- a/datafusion/sqllogictest/test_files/array_product.slt +++ b/datafusion/sqllogictest/test_files/array_product.slt @@ -142,4 +142,4 @@ select list_product(column1) from (values ) as t(column1); ---- 6 -NULL \ No newline at end of file +NULL diff --git a/datafusion/sqllogictest/test_files/array_subtract.slt b/datafusion/sqllogictest/test_files/array_subtract.slt index 4a680c93aae95..28edd6ba9b0ed 100644 --- a/datafusion/sqllogictest/test_files/array_subtract.slt +++ b/datafusion/sqllogictest/test_files/array_subtract.slt @@ -234,4 +234,4 @@ select array_subtract(array_subtract(a, b), c) from (values ---- [89.0, 178.0] NULL -[89.0, NULL] \ No newline at end of file +[89.0, NULL] diff --git a/datafusion/sqllogictest/test_files/arrow_typeof.slt b/datafusion/sqllogictest/test_files/arrow_typeof.slt index 17fcb7fa36ed7..02f1911898f3a 100644 --- a/datafusion/sqllogictest/test_files/arrow_typeof.slt +++ b/datafusion/sqllogictest/test_files/arrow_typeof.slt @@ -204,7 +204,7 @@ SELECT col_d256 FROM foo; ---- -100 100 +100.00 100.00 statement ok drop table foo diff --git a/datafusion/sqllogictest/test_files/coalesce.slt b/datafusion/sqllogictest/test_files/coalesce.slt index 79a29f7bf8ec0..c6170e0611852 100644 --- a/datafusion/sqllogictest/test_files/coalesce.slt +++ b/datafusion/sqllogictest/test_files/coalesce.slt @@ -167,14 +167,14 @@ select coalesce(arrow_cast(2, 'Decimal128(7, 2)'), 0), arrow_typeof(coalesce(arrow_cast(2, 'Decimal128(7, 2)'), 0)) ---- -2 Decimal128(22, 2) +2.00 Decimal128(22, 2) query RT select coalesce(arrow_cast(2, 'Decimal256(7, 2)'), 0), arrow_typeof(coalesce(arrow_cast(2, 'Decimal256(7, 2)'), 0)); ---- -2 Decimal256(22, 2) +2.00 Decimal256(22, 2) # coalesce string query TT diff --git a/datafusion/sqllogictest/test_files/decimal.slt b/datafusion/sqllogictest/test_files/decimal.slt index 4335ec06685f2..a1f38cf4f987b 100644 --- a/datafusion/sqllogictest/test_files/decimal.slt +++ b/datafusion/sqllogictest/test_files/decimal.slt @@ -19,14 +19,14 @@ query TR select arrow_typeof(cast(1.23 as decimal(10,4))), cast(1.23 as decimal(10,4)); ---- -Decimal128(10, 4) 1.23 +Decimal128(10, 4) 1.2300 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 +Decimal128(10, 4) 1.2300 query TR @@ -57,55 +57,55 @@ Decimal128(10, 6) Decimal128(12, 7) query R rowsort SELECT c1 from decimal_simple; ---- -0.00001 -0.00002 -0.00002 -0.00003 -0.00003 -0.00003 -0.00004 -0.00004 -0.00004 -0.00004 -0.00005 -0.00005 -0.00005 -0.00005 -0.00005 +0.000010 +0.000020 +0.000020 +0.000030 +0.000030 +0.000030 +0.000040 +0.000040 +0.000040 +0.000040 +0.000050 +0.000050 +0.000050 +0.000050 +0.000050 query R rowsort select c1 from decimal_simple where c1 > 0.000030; ---- -0.00004 -0.00004 -0.00004 -0.00004 -0.00005 -0.00005 -0.00005 -0.00005 -0.00005 +0.000040 +0.000040 +0.000040 +0.000040 +0.000050 +0.000050 +0.000050 +0.000050 +0.000050 query RRIBR rowsort select * from decimal_simple where c1 > c5; ---- -0.00002 0.000000000002 3 false 0.000019 -0.00003 0.000000000003 5 true 0.000011 -0.00005 0.000000000005 8 false 0.000033 +0.000020 0.000000000002 3 false 0.0000190 +0.000030 0.000000000003 5 true 0.0000110 +0.000050 0.000000000005 8 false 0.0000330 query TR select arrow_typeof(min(c1)), min(c1) from decimal_simple where c4=false; ---- -Decimal128(10, 6) 0.00002 +Decimal128(10, 6) 0.000020 query TR select arrow_typeof(max(c1)), max(c1) from decimal_simple where c4=false; ---- -Decimal128(10, 6) 0.00005 +Decimal128(10, 6) 0.000050 # inferred precision is 10+10 @@ -113,7 +113,7 @@ Decimal128(10, 6) 0.00005 query TR select arrow_typeof(sum(c1)), sum(c1) from decimal_simple; ---- -Decimal128(20, 6) 0.00055 +Decimal128(20, 6) 0.000550 # inferred precision is original precision + 4 @@ -127,14 +127,14 @@ Decimal128(14, 10) 0.0000366666 query TR select arrow_typeof(median(c1)), median(c1) from decimal_simple; ---- -Decimal128(10, 6) 0.00004 +Decimal128(10, 6) 0.000040 query RRIBR rowsort select * from decimal_simple where c1=CAST(0.00002 as Decimal(10,8)); ---- -0.00002 0.000000000002 2 true 0.000025 -0.00002 0.000000000002 3 false 0.000019 +0.000020 0.000000000002 2 true 0.0000250 +0.000020 0.000000000002 3 false 0.0000190 query RI rowsort @@ -158,51 +158,51 @@ select c2,c3 from decimal_simple where c1!=0.00002; query RRIBR select * from decimal_simple where 0.00002 > c1; ---- -0.00001 0.000000000001 1 true 0.000014 +0.000010 0.000000000001 1 true 0.0000140 query RRIBR rowsort select * from decimal_simple where c1 <= 0.00002; ---- -0.00001 0.000000000001 1 true 0.000014 -0.00002 0.000000000002 2 true 0.000025 -0.00002 0.000000000002 3 false 0.000019 +0.000010 0.000000000001 1 true 0.0000140 +0.000020 0.000000000002 2 true 0.0000250 +0.000020 0.000000000002 3 false 0.0000190 query RRIBR rowsort select * from decimal_simple where c1 > 0.00002; ---- -0.00003 0.000000000003 4 true 0.000032 -0.00003 0.000000000003 5 false 0.000035 -0.00003 0.000000000003 5 true 0.000011 -0.00004 0.000000000004 12 false 0.00004 -0.00004 0.000000000004 14 true 0.00004 -0.00004 0.000000000004 5 true 0.000044 -0.00004 0.000000000004 8 false 0.000044 -0.00005 0.000000000005 1 false 0.0001 -0.00005 0.000000000005 100 true 0.000068 -0.00005 0.000000000005 4 true 0.000078 -0.00005 0.000000000005 8 false 0.000033 -0.00005 0.000000000005 9 true 0.000052 +0.000030 0.000000000003 4 true 0.0000320 +0.000030 0.000000000003 5 false 0.0000350 +0.000030 0.000000000003 5 true 0.0000110 +0.000040 0.000000000004 12 false 0.0000400 +0.000040 0.000000000004 14 true 0.0000400 +0.000040 0.000000000004 5 true 0.0000440 +0.000040 0.000000000004 8 false 0.0000440 +0.000050 0.000000000005 1 false 0.0001000 +0.000050 0.000000000005 100 true 0.0000680 +0.000050 0.000000000005 4 true 0.0000780 +0.000050 0.000000000005 8 false 0.0000330 +0.000050 0.000000000005 9 true 0.0000520 query RRIBR rowsort select * from decimal_simple where c1 >= 0.00002; ---- -0.00002 0.000000000002 2 true 0.000025 -0.00002 0.000000000002 3 false 0.000019 -0.00003 0.000000000003 4 true 0.000032 -0.00003 0.000000000003 5 false 0.000035 -0.00003 0.000000000003 5 true 0.000011 -0.00004 0.000000000004 12 false 0.00004 -0.00004 0.000000000004 14 true 0.00004 -0.00004 0.000000000004 5 true 0.000044 -0.00004 0.000000000004 8 false 0.000044 -0.00005 0.000000000005 1 false 0.0001 -0.00005 0.000000000005 100 true 0.000068 -0.00005 0.000000000005 4 true 0.000078 -0.00005 0.000000000005 8 false 0.000033 -0.00005 0.000000000005 9 true 0.000052 +0.000020 0.000000000002 2 true 0.0000250 +0.000020 0.000000000002 3 false 0.0000190 +0.000030 0.000000000003 4 true 0.0000320 +0.000030 0.000000000003 5 false 0.0000350 +0.000030 0.000000000003 5 true 0.0000110 +0.000040 0.000000000004 12 false 0.0000400 +0.000040 0.000000000004 14 true 0.0000400 +0.000040 0.000000000004 5 true 0.0000440 +0.000040 0.000000000004 8 false 0.0000440 +0.000050 0.000000000005 1 false 0.0001000 +0.000050 0.000000000005 100 true 0.0000680 +0.000050 0.000000000005 4 true 0.0000780 +0.000050 0.000000000005 8 false 0.0000330 +0.000050 0.000000000005 9 true 0.0000520 query T @@ -214,21 +214,21 @@ Decimal128(27, 6) query R rowsort select c1+1 from decimal_simple; ---- -1.00001 -1.00002 -1.00002 -1.00003 -1.00003 -1.00003 -1.00004 -1.00004 -1.00004 -1.00004 -1.00005 -1.00005 -1.00005 -1.00005 -1.00005 +1.000010 +1.000020 +1.000020 +1.000030 +1.000030 +1.000030 +1.000040 +1.000040 +1.000040 +1.000040 +1.000050 +1.000050 +1.000050 +1.000050 +1.000050 # array decimal(10,6) + array decimal(12,7) => decimal(13,7) @@ -241,21 +241,21 @@ Decimal128(13, 7) query R rowsort select c1+c5 from decimal_simple; ---- -0.000024 -0.000039 -0.000041 -0.000045 -0.000062 -0.000065 -0.00008 -0.00008 -0.000083 -0.000084 -0.000084 -0.000102 -0.000118 -0.000128 -0.00015 +0.0000240 +0.0000390 +0.0000410 +0.0000450 +0.0000620 +0.0000650 +0.0000800 +0.0000800 +0.0000830 +0.0000840 +0.0000840 +0.0001020 +0.0001180 +0.0001280 +0.0001500 query T @@ -267,21 +267,21 @@ Decimal128(27, 6) query R rowsort select c1-1 from decimal_simple; ---- --0.99995 --0.99995 --0.99995 --0.99995 --0.99995 --0.99996 --0.99996 --0.99996 --0.99996 --0.99997 --0.99997 --0.99997 --0.99998 --0.99998 --0.99999 +-0.999950 +-0.999950 +-0.999950 +-0.999950 +-0.999950 +-0.999960 +-0.999960 +-0.999960 +-0.999960 +-0.999970 +-0.999970 +-0.999970 +-0.999980 +-0.999980 +-0.999990 query T @@ -293,21 +293,21 @@ Decimal128(13, 7) query R rowsort select c1-c5 from decimal_simple; ---- --0.000002 --0.000002 --0.000004 --0.000004 --0.000004 --0.000005 --0.000005 --0.000018 --0.000028 --0.00005 -0 -0 -0.000001 -0.000017 -0.000019 +-0.0000020 +-0.0000020 +-0.0000040 +-0.0000040 +-0.0000040 +-0.0000050 +-0.0000050 +-0.0000180 +-0.0000280 +-0.0000500 +0.0000000 +0.0000000 +0.0000010 +0.0000170 +0.0000190 query T @@ -319,21 +319,21 @@ Decimal128(31, 6) query R rowsort select c1*20 from decimal_simple; ---- -0.0002 -0.0004 -0.0004 -0.0006 -0.0006 -0.0006 -0.0008 -0.0008 -0.0008 -0.0008 -0.001 -0.001 -0.001 -0.001 -0.001 +0.000200 +0.000400 +0.000400 +0.000600 +0.000600 +0.000600 +0.000800 +0.000800 +0.000800 +0.000800 +0.001000 +0.001000 +0.001000 +0.001000 +0.001000 query T @@ -345,21 +345,21 @@ Decimal128(23, 13) query R rowsort select c1*c5 from decimal_simple; ---- -0.00000000014 -0.00000000033 -0.00000000038 -0.0000000005 -0.00000000096 -0.00000000105 -0.0000000016 -0.0000000016 -0.00000000165 -0.00000000176 -0.00000000176 -0.0000000026 -0.0000000034 -0.0000000039 -0.000000005 +0.0000000001400 +0.0000000003300 +0.0000000003800 +0.0000000005000 +0.0000000009600 +0.0000000010500 +0.0000000016000 +0.0000000016000 +0.0000000016500 +0.0000000017600 +0.0000000017600 +0.0000000026000 +0.0000000034000 +0.0000000039000 +0.0000000050000 query T @@ -371,21 +371,21 @@ Decimal128(19, 10) query R rowsort select c1/cast(0.00001 as decimal(5,5)) from decimal_simple; ---- -1 -2 -2 -3 -3 -3 -4 -4 -4 -4 -5 -5 -5 -5 -5 +1.0000000000 +2.0000000000 +2.0000000000 +3.0000000000 +3.0000000000 +3.0000000000 +4.0000000000 +4.0000000000 +4.0000000000 +4.0000000000 +5.0000000000 +5.0000000000 +5.0000000000 +5.0000000000 +5.0000000000 query T @@ -397,18 +397,18 @@ Decimal128(21, 10) query R rowsort select c1/c5 from decimal_simple; ---- -0.5 -0.641025641 +0.5000000000 +0.6410256410 0.7142857142 0.7352941176 -0.8 +0.8000000000 0.8571428571 -0.909090909 -0.909090909 -0.9375 +0.9090909090 +0.9090909090 +0.9375000000 0.9615384615 -1 -1 +1.0000000000 +1.0000000000 1.0526315789 1.5151515151 2.7272727272 @@ -423,21 +423,21 @@ Decimal128(7, 7) query R rowsort select c5%cast(0.00001 as decimal(5,5)) from decimal_simple; ---- -0 -0 -0 -0.000001 -0.000002 -0.000002 -0.000003 -0.000004 -0.000004 -0.000004 -0.000005 -0.000005 -0.000008 -0.000008 -0.000009 +0.0000000 +0.0000000 +0.0000000 +0.0000010 +0.0000020 +0.0000020 +0.0000030 +0.0000040 +0.0000040 +0.0000040 +0.0000050 +0.0000050 +0.0000080 +0.0000080 +0.0000090 query T @@ -449,21 +449,21 @@ Decimal128(11, 7) query R rowsort select c1%c5 from decimal_simple; ---- -0 -0 -0.000001 -0.000008 -0.00001 -0.000017 -0.00002 -0.00003 -0.00003 -0.00004 -0.00004 -0.00005 -0.00005 -0.00005 -0.00005 +0.0000000 +0.0000000 +0.0000010 +0.0000080 +0.0000100 +0.0000170 +0.0000200 +0.0000300 +0.0000300 +0.0000400 +0.0000400 +0.0000500 +0.0000500 +0.0000500 +0.0000500 query T @@ -475,104 +475,104 @@ Decimal128(10, 6) query R rowsort SELECT abs(c1) from decimal_simple; ---- -0.00001 -0.00002 -0.00002 -0.00003 -0.00003 -0.00003 -0.00004 -0.00004 -0.00004 -0.00004 -0.00005 -0.00005 -0.00005 -0.00005 -0.00005 +0.000010 +0.000020 +0.000020 +0.000030 +0.000030 +0.000030 +0.000040 +0.000040 +0.000040 +0.000040 +0.000050 +0.000050 +0.000050 +0.000050 +0.000050 query RRIBR select * from decimal_simple where c1 >= 0.00004 order by c1; ---- -0.00004 0.000000000004 5 true 0.000044 -0.00004 0.000000000004 12 false 0.00004 -0.00004 0.000000000004 14 true 0.00004 -0.00004 0.000000000004 8 false 0.000044 -0.00005 0.000000000005 9 true 0.000052 -0.00005 0.000000000005 4 true 0.000078 -0.00005 0.000000000005 8 false 0.000033 -0.00005 0.000000000005 100 true 0.000068 -0.00005 0.000000000005 1 false 0.0001 +0.000040 0.000000000004 5 true 0.0000440 +0.000040 0.000000000004 12 false 0.0000400 +0.000040 0.000000000004 14 true 0.0000400 +0.000040 0.000000000004 8 false 0.0000440 +0.000050 0.000000000005 9 true 0.0000520 +0.000050 0.000000000005 4 true 0.0000780 +0.000050 0.000000000005 8 false 0.0000330 +0.000050 0.000000000005 100 true 0.0000680 +0.000050 0.000000000005 1 false 0.0001000 query RRIBR select * from decimal_simple where c1 >= 0.00004 order by c1, c3 limit 10; ---- -0.00004 0.000000000004 5 true 0.000044 -0.00004 0.000000000004 8 false 0.000044 -0.00004 0.000000000004 12 false 0.00004 -0.00004 0.000000000004 14 true 0.00004 -0.00005 0.000000000005 1 false 0.0001 -0.00005 0.000000000005 4 true 0.000078 -0.00005 0.000000000005 8 false 0.000033 -0.00005 0.000000000005 9 true 0.000052 -0.00005 0.000000000005 100 true 0.000068 +0.000040 0.000000000004 5 true 0.0000440 +0.000040 0.000000000004 8 false 0.0000440 +0.000040 0.000000000004 12 false 0.0000400 +0.000040 0.000000000004 14 true 0.0000400 +0.000050 0.000000000005 1 false 0.0001000 +0.000050 0.000000000005 4 true 0.0000780 +0.000050 0.000000000005 8 false 0.0000330 +0.000050 0.000000000005 9 true 0.0000520 +0.000050 0.000000000005 100 true 0.0000680 query RRIBR select * from decimal_simple where c1 >= 0.00004 order by c1, c3 limit 5; ---- -0.00004 0.000000000004 5 true 0.000044 -0.00004 0.000000000004 8 false 0.000044 -0.00004 0.000000000004 12 false 0.00004 -0.00004 0.000000000004 14 true 0.00004 -0.00005 0.000000000005 1 false 0.0001 +0.000040 0.000000000004 5 true 0.0000440 +0.000040 0.000000000004 8 false 0.0000440 +0.000040 0.000000000004 12 false 0.0000400 +0.000040 0.000000000004 14 true 0.0000400 +0.000050 0.000000000005 1 false 0.0001000 query RRIBR select * from decimal_simple where c1 >= 0.00004 order by c1 desc; ---- -0.00005 0.000000000005 9 true 0.000052 -0.00005 0.000000000005 4 true 0.000078 -0.00005 0.000000000005 8 false 0.000033 -0.00005 0.000000000005 100 true 0.000068 -0.00005 0.000000000005 1 false 0.0001 -0.00004 0.000000000004 5 true 0.000044 -0.00004 0.000000000004 12 false 0.00004 -0.00004 0.000000000004 14 true 0.00004 -0.00004 0.000000000004 8 false 0.000044 +0.000050 0.000000000005 9 true 0.0000520 +0.000050 0.000000000005 4 true 0.0000780 +0.000050 0.000000000005 8 false 0.0000330 +0.000050 0.000000000005 100 true 0.0000680 +0.000050 0.000000000005 1 false 0.0001000 +0.000040 0.000000000004 5 true 0.0000440 +0.000040 0.000000000004 12 false 0.0000400 +0.000040 0.000000000004 14 true 0.0000400 +0.000040 0.000000000004 8 false 0.0000440 query RRIBR select * from decimal_simple where c1 < 0.00003 order by c1 desc,c4; ---- -0.00002 0.000000000002 3 false 0.000019 -0.00002 0.000000000002 2 true 0.000025 -0.00001 0.000000000001 1 true 0.000014 +0.000020 0.000000000002 3 false 0.0000190 +0.000020 0.000000000002 2 true 0.0000250 +0.000010 0.000000000001 1 true 0.0000140 query IR select count(*),c1 from decimal_simple group by c1 order by c1; ---- -1 0.00001 -2 0.00002 -3 0.00003 -4 0.00004 -5 0.00005 +1 0.000010 +2 0.000020 +3 0.000030 +4 0.000040 +5 0.000050 query IRB select count(*),c1,c4 from decimal_simple group by c1,c4 order by c1,c4; ---- -1 0.00001 true -1 0.00002 false -1 0.00002 true -1 0.00003 false -2 0.00003 true -2 0.00004 false -2 0.00004 true -2 0.00005 false -3 0.00005 true +1 0.000010 true +1 0.000020 false +1 0.000020 true +1 0.000030 false +2 0.000030 true +2 0.000040 false +2 0.000040 true +2 0.000050 false +3 0.000050 true query TR @@ -612,12 +612,12 @@ insert into foo VALUES (1, 5); query R select a / b from foo; ---- -0.2 +0.200000000000000000000000 query R select AVG(column1) from values (arrow_cast(123, 'Decimal256(5,2)')); ---- -123 +123.000000 statement ok CREATE EXTERNAL TABLE decimal256_simple ( @@ -639,41 +639,41 @@ Decimal256(50, 6) Decimal256(52, 7) query R rowsort SELECT c1 from decimal256_simple; ---- -0.00001 -0.00002 -0.00002 -0.00003 -0.00003 -0.00003 -0.00004 -0.00004 -0.00004 -0.00004 -0.00005 -0.00005 -0.00005 -0.00005 -0.00005 +0.000010 +0.000020 +0.000020 +0.000030 +0.000030 +0.000030 +0.000040 +0.000040 +0.000040 +0.000040 +0.000050 +0.000050 +0.000050 +0.000050 +0.000050 query R rowsort select c1 from decimal256_simple where c1 > 0.000030; ---- -0.00004 -0.00004 -0.00004 -0.00004 -0.00005 -0.00005 -0.00005 -0.00005 -0.00005 +0.000040 +0.000040 +0.000040 +0.000040 +0.000050 +0.000050 +0.000050 +0.000050 +0.000050 query RRIBR rowsort select * from decimal256_simple where c1 > c5; ---- -0.00002 0.000000000002 3 false 0.000019 -0.00003 0.000000000003 5 true 0.000011 -0.00005 0.000000000005 8 false 0.000033 +0.000020 0.000000000002 3 false 0.0000190 +0.000030 0.000000000003 5 true 0.0000110 +0.000050 0.000000000005 8 false 0.0000330 query TR select arrow_typeof(avg(c1)), avg(c1) from decimal256_simple; @@ -683,31 +683,31 @@ Decimal256(54, 10) 0.0000366666 query TR select arrow_typeof(min(c1)), min(c1) from decimal256_simple where c4=false; ---- -Decimal256(50, 6) 0.00002 +Decimal256(50, 6) 0.000020 query TR select arrow_typeof(max(c1)), max(c1) from decimal256_simple where c4=false; ---- -Decimal256(50, 6) 0.00005 +Decimal256(50, 6) 0.000050 query TR select arrow_typeof(sum(c1)), sum(c1) from decimal256_simple; ---- -Decimal256(60, 6) 0.00055 +Decimal256(60, 6) 0.000550 query TR select arrow_typeof(median(c1)), median(c1) from decimal256_simple; ---- -Decimal256(50, 6) 0.00004 +Decimal256(50, 6) 0.000040 query IR select count(*),c1 from decimal256_simple group by c1 order by c1; ---- -1 0.00001 -2 0.00002 -3 0.00003 -4 0.00004 -5 0.00005 +1 0.000010 +2 0.000020 +3 0.000030 +4 0.000040 +5 0.000050 query I select count(DISTINCT cast(c1 AS DECIMAL(42, 4))) from decimal256_simple; @@ -735,7 +735,7 @@ SELECT cast(cast('0' as decimal(3,0)) as decimal(2,0)), cast(cast('5.20' as decimal(4,2)) as decimal(3,2)) ---- -0 5.2 +0 5.20 query RR SELECT @@ -763,7 +763,7 @@ SELECT arrow_cast(1.23,'Decimal128(3,2)') / arrow_cast(123, 'UInt64') as divison_uint, arrow_cast(1.23,'Decimal128(3,2)') / arrow_cast(123, 'Int64') as divison_int ---- -0.01 0.01 +0.010000 0.010000 query TR with tt as ( @@ -1198,20 +1198,20 @@ NULL Float64 query RR rowsort SELECT distinct c1*100000, power(c1*100000, 2) from decimal_simple; ---- -1 1 -2 4 -3 9 -4 16 -5 25 +1.000000 1 +2.000000 4 +3.000000 9 +4.000000 16 +5.000000 25 query RR rowsort SELECT distinct c1*100000, power(c1*100000, 2.0) from decimal_simple; ---- -1 1 -2 4 -3 9 -4 16 -5 25 +1.000000 1 +2.000000 4 +3.000000 9 +4.000000 16 +5.000000 25 # Set parse_float_as_decimal to false to test float parsing statement ok @@ -1305,7 +1305,7 @@ from ( from generate_series(1, 21476) ) t; ---- -99999 Decimal32(9, 4) +99999.0000 Decimal32(9, 4) # 92235 * 99999999999999 ~= 9.22e18 > i64::MAX query RT @@ -1315,7 +1315,7 @@ from ( from generate_series(1, 92235) ) t; ---- -99999999999999 Decimal64(18, 4) +99999999999999.0000 Decimal64(18, 4) # 21476 * (10^34 - 1) ~= 2.15e38 > i128::MAX query RT @@ -1325,7 +1325,7 @@ from ( from generate_series(1, 21476) ) t; ---- -9999999999999999999999999999999999 Decimal128(38, 4) +9999999999999999999999999999999999.0000 Decimal128(38, 4) # Regression: `avg(DISTINCT ...)` must widen its intermediate sum the same way. # The second distinct aggregate keeps `single_distinct_to_group_by` from @@ -1339,4 +1339,10 @@ from ( from generate_series(1, 65536) t(v) ) t; ---- -32768.5 Decimal32(9, 4) 32768.5 +32768.5000 Decimal32(9, 4) 32768.5 + +# Make sure to display full scale +query R +select arrow_cast('1.2300', 'Decimal32(9, 4)'); +---- +1.2300 diff --git a/datafusion/sqllogictest/test_files/errors.slt b/datafusion/sqllogictest/test_files/errors.slt index ab934279c32ec..9b69d4b83d7b1 100644 --- a/datafusion/sqllogictest/test_files/errors.slt +++ b/datafusion/sqllogictest/test_files/errors.slt @@ -157,7 +157,7 @@ query error DataFusion error: Error during planning: Substring without for/from select 1 group by substr(''); # Error in filter should be reported -query error Divide by zero +query error DataFusion error: Arrow error: Divide by zero error SELECT c2 from aggregate_test_100 where CASE WHEN true THEN 1 / 0 ELSE 0 END = 1; diff --git a/datafusion/sqllogictest/test_files/group_by.slt b/datafusion/sqllogictest/test_files/group_by.slt index afde5b9331944..6f1352c9c9ed9 100644 --- a/datafusion/sqllogictest/test_files/group_by.slt +++ b/datafusion/sqllogictest/test_files/group_by.slt @@ -5592,7 +5592,7 @@ select a, b, count(*) from t group by a, b order by a, b; ---- 1 123.45 2 1 NULL 1 -2 678.9 3 +2 678.90 3 2 1011.12 2 3 1314.15 2 NULL 123.45 2 diff --git a/datafusion/sqllogictest/test_files/insert.slt b/datafusion/sqllogictest/test_files/insert.slt index c807f73d60fe0..ddb954bcfebc6 100644 --- a/datafusion/sqllogictest/test_files/insert.slt +++ b/datafusion/sqllogictest/test_files/insert.slt @@ -463,7 +463,7 @@ drop table unsigned_bigint_test # Config reset -# The SLT runner sets `target_partitions` to 4 instead of using the default, so +# The SLT runner sets `target_partitions` to 4 instead of using the default, so # reset it explicitly. statement ok set datafusion.execution.target_partitions = 4; diff --git a/datafusion/sqllogictest/test_files/joins.slt b/datafusion/sqllogictest/test_files/joins.slt index 55efcc3874fce..38e4b08470645 100644 --- a/datafusion/sqllogictest/test_files/joins.slt +++ b/datafusion/sqllogictest/test_files/joins.slt @@ -2718,7 +2718,7 @@ query DDRTDDRT rowsort select * from hashjoin_datatype_table_t1 t1 join hashjoin_datatype_table_t2 t2 on t1.c1 = t2.c1 ---- 1970-01-02 1970-01-02T00:00:00 1.23 abc 1970-01-02 1970-01-02T00:00:00 -123.12 abc -1970-01-04 NULL -123.12 jkl 1970-01-04 NULL 789 qwe +1970-01-04 NULL -123.12 jkl 1970-01-04 NULL 789.00 qwe # explain hash_join_with_date64 @@ -2737,9 +2737,9 @@ query DDRTDDRT rowsort select * from hashjoin_datatype_table_t1 t1 left join hashjoin_datatype_table_t2 t2 on t1.c2 = t2.c2 ---- 1970-01-02 1970-01-02T00:00:00 1.23 abc 1970-01-02 1970-01-02T00:00:00 -123.12 abc -1970-01-03 1970-01-03T00:00:00 456 def NULL NULL NULL NULL +1970-01-03 1970-01-03T00:00:00 456.00 def NULL NULL NULL NULL 1970-01-04 NULL -123.12 jkl NULL NULL NULL NULL -NULL 1970-01-04T00:00:00 789 ghi NULL 1970-01-04T00:00:00 0 qwerty +NULL 1970-01-04T00:00:00 789.00 ghi NULL 1970-01-04T00:00:00 0.00 qwerty # explain hash_join_with_decimal @@ -2758,9 +2758,9 @@ query DDRTDDRT rowsort select * from hashjoin_datatype_table_t1 t1 right join hashjoin_datatype_table_t1 t2 on t1.c3 = t2.c3 ---- 1970-01-02 1970-01-02T00:00:00 1.23 abc 1970-01-02 1970-01-02T00:00:00 1.23 abc -1970-01-03 1970-01-03T00:00:00 456 def 1970-01-03 1970-01-03T00:00:00 456 def +1970-01-03 1970-01-03T00:00:00 456.00 def 1970-01-03 1970-01-03T00:00:00 456.00 def 1970-01-04 NULL -123.12 jkl 1970-01-04 NULL -123.12 jkl -NULL 1970-01-04T00:00:00 789 ghi NULL 1970-01-04T00:00:00 789 ghi +NULL 1970-01-04T00:00:00 789.00 ghi NULL 1970-01-04T00:00:00 789.00 ghi # explain hash_join_with_dictionary query TT @@ -2825,7 +2825,7 @@ query DDRTDDRT rowsort select * from hashjoin_datatype_table_t1 t1 join hashjoin_datatype_table_t2 t2 on t1.c1 = t2.c1 ---- 1970-01-02 1970-01-02T00:00:00 1.23 abc 1970-01-02 1970-01-02T00:00:00 -123.12 abc -1970-01-04 NULL -123.12 jkl 1970-01-04 NULL 789 qwe +1970-01-04 NULL -123.12 jkl 1970-01-04 NULL 789.00 qwe # explain sort_merge_join_on_decimal right join on data type (Decimal) query TT @@ -2854,9 +2854,9 @@ query DDRTDDRT rowsort select * from hashjoin_datatype_table_t1 t1 right join hashjoin_datatype_table_t2 t2 on t1.c3 = t2.c3 ---- 1970-01-04 NULL -123.12 jkl 1970-01-02 1970-01-02T00:00:00 -123.12 abc -NULL 1970-01-04T00:00:00 789 ghi 1970-01-04 NULL 789 qwe -NULL NULL NULL NULL NULL 1970-01-04T00:00:00 0 qwerty -NULL NULL NULL NULL NULL NULL 100000 abcdefg +NULL 1970-01-04T00:00:00 789.00 ghi 1970-01-04 NULL 789.00 qwe +NULL NULL NULL NULL NULL 1970-01-04T00:00:00 0.00 qwerty +NULL NULL NULL NULL NULL NULL 100000.00 abcdefg #### # Config teardown diff --git a/datafusion/sqllogictest/test_files/math.slt b/datafusion/sqllogictest/test_files/math.slt index 999709dfe77ea..970e3ff41435a 100644 --- a/datafusion/sqllogictest/test_files/math.slt +++ b/datafusion/sqllogictest/test_files/math.slt @@ -826,9 +826,9 @@ NULL query R SELECT c1*0 FROM test_nullable_decimal WHERE c1 IS NOT NULL; ---- -0 -0 -0 +0.00 +0.00 +0.00 query error DataFusion error: Arrow error: Divide by zero error SELECT c1/0 FROM test_nullable_decimal WHERE c1 IS NOT NULL; @@ -851,7 +851,7 @@ Decimal128(10, 2) Decimal128(38, 10) Decimal256(40, 2) Decimal256(76, 10) query RRRR rowsort SELECT abs(c1), abs(c2), abs(c3), abs(c4) FROM test_nullable_decimal ---- -0 0 0 0 +0.00 0.0000000000 0.00 0.0000000000 99999999.99 9999999999999999999999999999.9999999999 99999999999999999999999999999999999999.99 999999999999999999999999999999999999999999999999999999999999999999.9999999999 99999999.99 9999999999999999999999999999.9999999999 99999999999999999999999999999999999999.99 999999999999999999999999999999999999999999999999999999999999999999.9999999999 NULL NULL NULL NULL @@ -979,7 +979,7 @@ select gcd(15.3::decimal(38, 1), 2.9::decimal(38, 1)), arrow_typeof(gcd(15.3::de query RT select gcd(15::decimal(30, 2), 3::decimal(38, 5)), arrow_typeof(gcd(15::decimal(30, 2), 3::decimal(38, 5))); ---- -3 Decimal128(38, 5) +3.00000 Decimal128(38, 5) ## lcm @@ -1041,7 +1041,7 @@ select lcm(2, 3::decimal(38, 0)), arrow_typeof(lcm(2, 3::decimal(38, 0))); query RT select lcm(2::decimal(30, 2), 3::decimal(38, 5)), arrow_typeof(lcm(2::decimal(30, 2), 3::decimal(38, 5))); ---- -6 Decimal128(38, 5) +6.00000 Decimal128(38, 5) ## pow/power diff --git a/datafusion/sqllogictest/test_files/options.slt b/datafusion/sqllogictest/test_files/options.slt index 00d7664779a66..380252fcb3cac 100644 --- a/datafusion/sqllogictest/test_files/options.slt +++ b/datafusion/sqllogictest/test_files/options.slt @@ -86,7 +86,7 @@ drop table a query RR select 10000000000000000000.01, -10000000000000000000.01 ---- -10000000000000000000 -10000000000000000000 +10000000000000000000 -10000000000000000000 query TT select arrow_typeof(10000000000000000000.01), arrow_typeof(-10000000000000000000.01) @@ -139,7 +139,7 @@ Int64 Int64 Decimal128(19, 0) Int64 UInt64 UInt64 Decimal128(20, 0) query RRRR select .0 as c1, 0. as c2, 0000. as c3, 00000.00 as c4 ---- -0 0 0 0 +0.0 0 0 0.00 query TTTT select arrow_typeof(.0) as c1, arrow_typeof(0.) as c2, arrow_typeof(0000.) as c3, arrow_typeof(00000.00) as c4 @@ -209,13 +209,13 @@ query RT select 123456789.0123456789012345678901234567890, arrow_typeof(123456789.0123456789012345678901234567890) ---- -123456789.012345678901234567890123456789 Decimal256(40, 31) +123456789.0123456789012345678901234567890 Decimal256(40, 31) query RT select -123456789.0123456789012345678901234567890, arrow_typeof(-123456789.0123456789012345678901234567890) ---- --123456789.012345678901234567890123456789 Decimal256(40, 31) +-123456789.0123456789012345678901234567890 Decimal256(40, 31) # max precision and scale of Decimal256 query RTRT @@ -277,7 +277,7 @@ query RTRT select 1e40 + 1e40, arrow_typeof(1e40 + 1e40), 1e-40 + -1e-40, arrow_typeof(1e-40 + -1e-40) ---- -20000000000000000000000000000000000000000 Decimal128(2, -40) 0 Decimal256(41, 40) +20000000000000000000000000000000000000000 Decimal128(2, -40) 0.0000000000000000000000000000000000000000 Decimal256(41, 40) # Restore option to default value statement ok diff --git a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt index 7e315a448b48e..8339fb4fab24a 100644 --- a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt +++ b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt @@ -99,7 +99,7 @@ select 1.0::DOUBLE, 1.023::DOUBLE, 'NaN'::DOUBLE,'+Inf'::DOUBLE,'-Inf'::DOUBLE query RRR select 1.0::DECIMAL(5,3) as one, 2.023::DECIMAL(5,3) as two, 3.023::DECIMAL(5,2) as three ---- -1 2.023 3.02 +1.000 2.023 3.02 query D select '2018-01-01'::DATE diff --git a/datafusion/sqllogictest/test_files/predicates.slt b/datafusion/sqllogictest/test_files/predicates.slt index b4482a3af1beb..9e28d1fb08044 100644 --- a/datafusion/sqllogictest/test_files/predicates.slt +++ b/datafusion/sqllogictest/test_files/predicates.slt @@ -874,7 +874,7 @@ OR ) GROUP BY p_partkey; ---- -63700 13309.6 0.1 1 +63700 13309.60 0.100000 1 query TT diff --git a/datafusion/sqllogictest/test_files/qualify.slt b/datafusion/sqllogictest/test_files/qualify.slt index b70f078327a42..ca4775ef121f1 100644 --- a/datafusion/sqllogictest/test_files/qualify.slt +++ b/datafusion/sqllogictest/test_files/qualify.slt @@ -92,9 +92,9 @@ FROM users QUALIFY prev_salary IS NOT NULL AND salary > prev_salary ORDER BY dept, id; ---- -2 Bob 60000 50000 -8 Henry 62000 52000 -7 Grace 75000 65000 +2 Bob 60000.00 50000.00 +8 Henry 62000.00 52000.00 +7 Grace 75000.00 65000.00 # QUALIFY with LEAD function query ITRR @@ -103,9 +103,9 @@ FROM users QUALIFY next_salary IS NOT NULL AND salary < next_salary ORDER BY dept, id; ---- -1 Alice 50000 60000 -6 Frank 52000 62000 -5 Eve 65000 75000 +1 Alice 50000.00 60000.00 +6 Frank 52000.00 62000.00 +5 Eve 65000.00 75000.00 # QUALIFY with NTILE query ITI @@ -164,8 +164,8 @@ FROM users QUALIFY rn = 1 AND salary > 60000 ORDER BY dept, id; ---- -8 Henry 62000 1 -7 Grace 75000 1 +8 Henry 62000.00 1 +7 Grace 75000.00 1 # QUALIFY with string functions query ITI @@ -200,9 +200,9 @@ GROUP BY dept, salary HAVING SUM(salary) > 20000 QUALIFY r > 60000 ---- -Marketing 70000 -Marketing 70000 -Marketing 70000 +Marketing 70000.000000 +Marketing 70000.000000 +Marketing 70000.000000 # QUALIFY with aggregate function reference from projection query TR @@ -212,7 +212,7 @@ GROUP BY dept QUALIFY RANK() OVER (ORDER BY dept DESC) = 1 AND s > 1000 ORDER BY dept; ---- -Marketing 210000 +Marketing 210000.00 # QUALIFY with aggregate function query T @@ -232,7 +232,7 @@ GROUP BY dept QUALIFY RANK() OVER (ORDER BY SUM(salary) DESC) = 1 ORDER BY dept; ---- -Engineering 279000 +Engineering 279000.00 # QUALIFY with aggregate function reference from projection within window function query TR @@ -242,7 +242,7 @@ GROUP BY dept QUALIFY RANK() OVER (ORDER BY s DESC) = 1 ORDER BY dept; ---- -Engineering 279000 +Engineering 279000.00 # Error: QUALIFY without window functions query error diff --git a/datafusion/sqllogictest/test_files/repartition.slt b/datafusion/sqllogictest/test_files/repartition.slt index cf913caefc525..7cec3b5844112 100644 --- a/datafusion/sqllogictest/test_files/repartition.slt +++ b/datafusion/sqllogictest/test_files/repartition.slt @@ -140,7 +140,7 @@ FROM t1 WHERE ((false > (v1 = v1)) IS DISTINCT FROM true); # Config reset -# The SLT runner sets `target_partitions` to 4 instead of using the default, so +# The SLT runner sets `target_partitions` to 4 instead of using the default, so # reset it explicitly. statement ok set datafusion.execution.target_partitions = 4; diff --git a/datafusion/sqllogictest/test_files/run_end_encoded.slt b/datafusion/sqllogictest/test_files/run_end_encoded.slt index b5909bc7c430d..8660dd485d071 100644 --- a/datafusion/sqllogictest/test_files/run_end_encoded.slt +++ b/datafusion/sqllogictest/test_files/run_end_encoded.slt @@ -63,10 +63,10 @@ SELECT arrow_cast(arrow_cast(temperature, 'Decimal128(10, 2)'), 'RunEndEncoded("run_ends": non-null Int32, "values": Decimal128(10, 2))') + 1 AS t_dec_plus_one FROM sensor_readings; ---- -21 21 -23 23 -24 24 -25 25 +21 21.00 +23 23.00 +24 24.00 +25 25.00 # Regex / LIKE match against an REE column whose values are themselves Dictionary-encoded query BB rowsort diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.slt index 7666b680e16a8..1880b250e7b0b 100644 --- a/datafusion/sqllogictest/test_files/scalar.slt +++ b/datafusion/sqllogictest/test_files/scalar.slt @@ -344,7 +344,7 @@ select ceil(arrow_cast(123.00,'Decimal128(10,2)')), ceil(arrow_cast(-123.00,'Decimal128(10,2)')); ---- -2 -1 123 -123 +2.00 -1.00 123.00 -123.00 # ceil overflow with limited precision query error Decimal overflow while applying ceil @@ -539,7 +539,7 @@ select floor(arrow_cast(123.00,'Decimal128(10,2)')), floor(arrow_cast(-123.00,'Decimal128(10,2)')); ---- -1 -2 123 -123 +1.00 -2.00 123.00 -123.00 # floor overflow with limited precision query error Decimal overflow while applying floor @@ -1083,7 +1083,7 @@ query TR select arrow_typeof(round(val, dp)), round(val, dp) from (values (cast('999.9' as decimal(4,1)), 0)) as t(val, dp); ---- -Decimal128(5, 1) 1000 +Decimal128(5, 1) 1000.0 # round decimal at max precision now works (scale reduction handles overflow) query TR @@ -1104,7 +1104,7 @@ select arrow_typeof(round(cast(500 as decimal(10,-2)), -3)), round(cast(400 as decimal(10,-2)), -3), round(cast(-500 as decimal(10,-2)), -3); ---- -Decimal128(10, -3) 1000 0 -1000 +Decimal128(10, -3) 1000 0000 -1000 # round decimal with negative scale and carry-over query TR @@ -1337,7 +1337,7 @@ from small_floats; query RT select trunc(arrow_cast(3.1415, 'Decimal128(10,4)')), arrow_typeof(trunc(arrow_cast(3.1415, 'Decimal128(10,4)'))); ---- -3 Decimal128(10, 4) +3.0000 Decimal128(10, 4) # trunc with precision - decimals query RRRRR rowsort @@ -1348,21 +1348,21 @@ select trunc(arrow_cast(1.2837284, 'Decimal256(35,7)'), 2), trunc(arrow_cast(1.1, 'Decimal128(10,1)'), 0); ---- -4.267 1.12 -1.1231 1.28 1 +4.267 1.120000 -1.1231 1.2800000 1.0 # trunc with negative precision should truncate digits left of decimal - decimal types query RT select trunc(arrow_cast(12345.678, 'Decimal128(10,3)'), -3), arrow_typeof(trunc(arrow_cast(12345.678, 'Decimal128(10,3)'), -3)); ---- -12000 Decimal128(10, 3) +12000.000 Decimal128(10, 3) # trunc: coercion with a decimal argument and a non-int64 precision argument query RT select trunc(arrow_cast(1.2345678, 'Decimal128(20,14)'), arrow_cast(2, 'Int32')), arrow_typeof(trunc(arrow_cast(1.2345678, 'Decimal128(20,14)'), arrow_cast(2, 'Int32'))); ---- -1.23 Decimal128(20, 14) +1.23000000000000 Decimal128(20, 14) # trunc with columns and precision - decimal128 query RRR rowsort @@ -1372,10 +1372,10 @@ select trunc(arrow_cast(c, 'Decimal128(10,4)'), 0) as c0 from small_floats; ---- --1 NULL NULL -0 0 -1 -0 0 0 -0 0 1 +-1.0000 NULL NULL +0.0000 0.0000 -1.0000 +0.0000 0.0000 0.0000 +0.0000 0.0000 1.0000 # trunc issue #22512 query R diff --git a/datafusion/sqllogictest/test_files/spark/aggregate/try_sum.slt b/datafusion/sqllogictest/test_files/spark/aggregate/try_sum.slt index 0f440a97dd1cc..c9b5dabee6110 100644 --- a/datafusion/sqllogictest/test_files/spark/aggregate/try_sum.slt +++ b/datafusion/sqllogictest/test_files/spark/aggregate/try_sum.slt @@ -55,12 +55,12 @@ Infinity query R SELECT try_sum(x) AS sum_x FROM VALUES (DECIMAL(10,2) '1.23'), (DECIMAL(10,2) '4.77') AS tab(x); ---- -6 +6.00 query R SELECT try_sum(x) AS sum_x FROM VALUES (DECIMAL(10,2) '1.00'), (NULL), (DECIMAL(10,2) '2.50') AS tab(x); ---- -3.5 +3.50 query R SELECT try_sum(x) AS sum_x FROM VALUES (DECIMAL(5,0) '90000'), (DECIMAL(5,0) '20000') AS tab(x); @@ -131,10 +131,10 @@ SELECT try_sum(col) AS sum_x FROM VALUES (CAST(-0.0 AS DOUBLE)), (CAST(0.0 AS DO query R SELECT try_sum(col) AS sum_x FROM VALUES (CAST(-5.5 AS DECIMAL(10,2))), (CAST(5.5 AS DECIMAL(10,2))) AS tab(col); ---- -0 +0.00 # Compare double 0.0 vs decimal 0.00 query RR SELECT 0.0 AS double_zero, CAST(0.0 AS DECIMAL(10,2)) AS decimal_zero; ---- -0 0 +0 0.00 diff --git a/datafusion/sqllogictest/test_files/spark/math/abs.slt b/datafusion/sqllogictest/test_files/spark/math/abs.slt index 94092caab9854..5da474052520c 100644 --- a/datafusion/sqllogictest/test_files/spark/math/abs.slt +++ b/datafusion/sqllogictest/test_files/spark/math/abs.slt @@ -73,23 +73,23 @@ SELECT abs(-1.0::DOUBLE), abs(0.::DOUBLE), abs(-0.::DOUBLE), abs(-0::DOUBLE), ab query RRR SELECT abs(('-99999999.99')::DECIMAL(10, 2)), abs(0::DECIMAL(10, 2)), abs(NULL::DECIMAL(10, 2)); ---- -99999999.99 0 NULL +99999999.99 0.00 NULL query RRR SELECT abs(('-9999999999999999999999999999.9999999999')::DECIMAL(38, 10)), abs(0::DECIMAL(38, 10)), abs(NULL::DECIMAL(38, 10)); ---- -9999999999999999999999999999.9999999999 0 NULL +9999999999999999999999999999.9999999999 0.0000000000 NULL ## Scalar input: decimal256 query RRR SELECT abs(('-99999999999999999999999999999999999999.99')::DECIMAL(40, 2)), abs(0::DECIMAL(40, 2)), abs(NULL::DECIMAL(40, 2)); ---- -99999999999999999999999999999999999999.99 0 NULL +99999999999999999999999999999999999999.99 0.00 NULL query RRR SELECT abs(('-999999999999999999999999999999999999999999999999999999999999999999.9999999999')::DECIMAL(76, 10)), abs(0::DECIMAL(76, 10)), abs(NULL::DECIMAL(76, 10)); ---- -999999999999999999999999999999999999999999999999999999999999999999.9999999999 0 NULL +999999999999999999999999999999999999999999999999999999999999999999.9999999999 0.0000000000 NULL # Array input @@ -181,14 +181,14 @@ query R SELECT abs(a) FROM (VALUES (('-99999999.99')::DECIMAL(10, 2)), (0::DECIMAL(10, 2)), (NULL::DECIMAL(10, 2))) AS t(a); ---- 99999999.99 -0 +0.00 NULL query R SELECT abs(a) FROM (VALUES (('-9999999999999999999999999999.9999999999')::DECIMAL(38, 10)), (0::DECIMAL(38, 10)), (NULL::DECIMAL(38, 10))) AS t(a); ---- 9999999999999999999999999999.9999999999 -0 +0.0000000000 NULL ## Array input: decimal256 @@ -196,14 +196,14 @@ query R SELECT abs(a) FROM (VALUES (('-99999999999999999999999999999999999999.99')::DECIMAL(40, 2)), (0::DECIMAL(40, 2)), (NULL::DECIMAL(40, 2))) AS t(a); ---- 99999999999999999999999999999999999999.99 -0 +0.00 NULL query R SELECT abs(a) FROM (VALUES (('-999999999999999999999999999999999999999999999999999999999999999999.9999999999')::DECIMAL(76, 10)), (0::DECIMAL(76, 10)), (NULL::DECIMAL(76, 10))) AS t(a); ---- 999999999999999999999999999999999999999999999999999999999999999999.9999999999 -0 +0.0000000000 NULL ## Original Query: SELECT abs(INTERVAL -'1-1' YEAR TO MONTH); diff --git a/datafusion/sqllogictest/test_files/spark/math/mod.slt b/datafusion/sqllogictest/test_files/spark/math/mod.slt index 8229bb065152d..e5bea25cc1876 100644 --- a/datafusion/sqllogictest/test_files/spark/math/mod.slt +++ b/datafusion/sqllogictest/test_files/spark/math/mod.slt @@ -142,7 +142,7 @@ SELECT MOD(2.5::decimal(3,1), 1.2::decimal(2,1)) as mod_decimal_1; query R SELECT MOD(10.0::decimal(3,1), 3.0::decimal(2,1)) as mod_decimal_2; ---- -1 +1.0 # Division by zero returns NULL in legacy mode (ANSI off) query I diff --git a/datafusion/sqllogictest/test_files/spark/math/pmod.slt b/datafusion/sqllogictest/test_files/spark/math/pmod.slt index aa4a197ba470f..100f62909ac7f 100644 --- a/datafusion/sqllogictest/test_files/spark/math/pmod.slt +++ b/datafusion/sqllogictest/test_files/spark/math/pmod.slt @@ -221,7 +221,7 @@ SELECT CAST(pmod(15.8::float4, 4.2::float4) AS DECIMAL(3,1)) as pmod_float32_3; query R SELECT CAST(pmod(-15.8::float4, 4.2::float4) AS DECIMAL(3,1)) as pmod_float32_4; ---- -1 +1.0 # PMOD tests with special float values query R @@ -273,12 +273,12 @@ SELECT pmod(-2.5::decimal(3,1), 1.2::decimal(2,1)) as pmod_decimal_2; query R SELECT pmod(10.0::decimal(3,1), 3.0::decimal(2,1)) as pmod_decimal_3; ---- -1 +1.0 query R SELECT pmod(-10.0::decimal(3,1), 3.0::decimal(2,1)) as pmod_decimal_4; ---- -2 +2.0 # PMOD tests with different integer types query I diff --git a/datafusion/sqllogictest/test_files/spark/math/round.slt b/datafusion/sqllogictest/test_files/spark/math/round.slt index 7fee15079d1d0..309fbc1b52c5d 100644 --- a/datafusion/sqllogictest/test_files/spark/math/round.slt +++ b/datafusion/sqllogictest/test_files/spark/math/round.slt @@ -308,24 +308,24 @@ SELECT round(arrow_cast(42, 'UInt32'), 2::int); query R SELECT round(arrow_cast(2.5, 'Decimal32(9, 1)'), 0::int); ---- -3 +3.0 query R SELECT round(arrow_cast(-2.5, 'Decimal32(9, 1)'), 0::int); ---- --3 +-3.0 # round(decimal32, 2) query R SELECT round(arrow_cast(2.345, 'Decimal32(9, 3)'), 2::int); ---- -2.35 +2.350 # round(decimal32) default scale = 0 query R SELECT round(arrow_cast(3.5, 'Decimal32(9, 1)')); ---- -4 +4.0 # --- Decimal64 --- @@ -333,24 +333,24 @@ SELECT round(arrow_cast(3.5, 'Decimal32(9, 1)')); query R SELECT round(arrow_cast(2.5, 'Decimal64(18, 1)'), 0::int); ---- -3 +3.0 query R SELECT round(arrow_cast(-2.5, 'Decimal64(18, 1)'), 0::int); ---- --3 +-3.0 # round(decimal64, 2) query R SELECT round(arrow_cast(2.345, 'Decimal64(18, 3)'), 2::int); ---- -2.35 +2.350 # round(decimal64) default scale = 0 query R SELECT round(arrow_cast(3.5, 'Decimal64(18, 1)')); ---- -4 +4.0 # --- Decimal128 --- @@ -358,34 +358,34 @@ SELECT round(arrow_cast(3.5, 'Decimal64(18, 1)')); query R SELECT round(2.5::decimal(2,1), 0::int); ---- -3 +3.0 query R SELECT round(3.5::decimal(2,1), 0::int); ---- -4 +4.0 query R SELECT round(-2.5::decimal(2,1), 0::int); ---- --3 +-3.0 # round(decimal) default scale = 0 query R SELECT round(2.5::decimal(2,1)); ---- -3 +3.0 # round(decimal, 2) — keep 2 decimal places query R SELECT round(2.345::decimal(10,3), 2::int); ---- -2.35 +2.350 query R SELECT round(2.355::decimal(10,3), 2::int); ---- -2.36 +2.360 # round(decimal, scale larger than input scale) — no change query R @@ -397,19 +397,19 @@ SELECT round(2.5::decimal(2,1), 5::int); query R SELECT round(123.456::decimal(10,3), 1::int); ---- -123.5 +123.500 # round(decimal, negative scale) — round to tens query R SELECT round(125.0::decimal(10,1), -1::int); ---- -130 +130.0 # round(decimal, extreme negative scale) — should return 0, not error query R SELECT round(2.5::decimal(10,1), -400::int); ---- -0 +0.0 # --- Decimal256 --- @@ -417,24 +417,24 @@ SELECT round(2.5::decimal(10,1), -400::int); query R SELECT round(arrow_cast(2.5, 'Decimal256(38, 1)'), 0::int); ---- -3 +3.0 query R SELECT round(arrow_cast(-2.5, 'Decimal256(38, 1)'), 0::int); ---- --3 +-3.0 # round(decimal256, 2) query R SELECT round(arrow_cast(2.345, 'Decimal256(38, 3)'), 2::int); ---- -2.35 +2.350 # round(decimal256) default scale = 0 query R SELECT round(arrow_cast(3.5, 'Decimal256(38, 1)')); ---- -4 +4.0 # ------------------------------------------------------------------- # NULL handling @@ -481,10 +481,10 @@ CREATE TABLE test_round (id int, int_val int, float_val double, dec_val decimal( query IIRR rowsort SELECT id, round(int_val, -1::int), round(float_val), round(dec_val, 2::int) FROM test_round; ---- -1 30 3 2.35 -2 40 4 3.56 -3 -30 -3 -2.35 -4 120 1 1.01 +1 30 3 2.350 +2 40 4 3.560 +3 -30 -3 -2.350 +4 120 1 1.010 5 NULL NULL NULL statement ok @@ -566,7 +566,7 @@ SELECT round(2.5::double); query R SELECT round(2.5::decimal(2,1), 0::int); ---- -3 +3.0 # ANSI mode: integer overflow should error query error DataFusion error: Execution error: Int64 overflow on round diff --git a/datafusion/sqllogictest/test_files/struct.slt b/datafusion/sqllogictest/test_files/struct.slt index a0e47a8691f34..941bab7c2d866 100644 --- a/datafusion/sqllogictest/test_files/struct.slt +++ b/datafusion/sqllogictest/test_files/struct.slt @@ -1732,4 +1732,3 @@ drop view leaf_view; statement ok drop table leaf_base; - diff --git a/datafusion/sqllogictest/test_files/subquery.slt b/datafusion/sqllogictest/test_files/subquery.slt index dcca13c4164c5..5a8241efa9223 100644 --- a/datafusion/sqllogictest/test_files/subquery.slt +++ b/datafusion/sqllogictest/test_files/subquery.slt @@ -2572,8 +2572,8 @@ from ( group by cntrycode order by cntrycode; ---- -18 1 30 -29 1 40 +18 1 30.00 +29 1 40.00 # `count(*)` over the same query must agree with the row count above. query I diff --git a/datafusion/sqllogictest/test_files/window.slt b/datafusion/sqllogictest/test_files/window.slt index 59cc4a7c46f6f..483008346e911 100644 --- a/datafusion/sqllogictest/test_files/window.slt +++ b/datafusion/sqllogictest/test_files/window.slt @@ -6600,9 +6600,9 @@ FROM ( ) ORDER BY a; ---- -1.5 1.5 2.5 -2.5 1.5 3.5 -3.5 2.5 3.5 +1.50 1.50 2.50 +2.50 1.50 3.50 +3.50 2.50 3.50 ############################################################################ # ROWS frame regression guard: huge offsets already saturate via @@ -6808,8 +6808,8 @@ FROM (VALUES(1,CAST(1.5 AS DECIMAL(10,2))), (4,CAST(NULL AS DECIMAL(10,2)))) t(i,v) ORDER BY i; ---- -1 2 -2 2.5 +1 2.000000 +2 2.500000 3 NULL 4 NULL From be4ccaef3eab3637fef4f2b74dde3ad0e9af03e2 Mon Sep 17 00:00:00 2001 From: Adam Gutglick Date: Mon, 3 Aug 2026 17:14:08 +0100 Subject: [PATCH 2/3] pg compat and math Signed-off-by: Adam Gutglick --- datafusion/sqllogictest/test_files/math.slt | 6 +- .../test_files/pg_compat/pg_compat_simple.slt | 8 +- .../test_files/pg_compat/pg_compat_types.slt | 2 +- .../test_files/pg_compat/pg_compat_window.slt | 324 +++++++++--------- 4 files changed, 170 insertions(+), 170 deletions(-) diff --git a/datafusion/sqllogictest/test_files/math.slt b/datafusion/sqllogictest/test_files/math.slt index 970e3ff41435a..fbad19150d95e 100644 --- a/datafusion/sqllogictest/test_files/math.slt +++ b/datafusion/sqllogictest/test_files/math.slt @@ -148,9 +148,9 @@ SELECT round(arrow_cast(column1, 'Decimal256(40,2)'), column2) FROM (VALUES ('125.55', 1), ('-125.55', 0), ('125.55', -1), (NULL, 1)) AS t(column1, column2); ---- -125.6 125.6 125.6 125.6 --126 -126 -126 -126 -130 130 130 130 +125.60 125.60 125.60 125.60 +-126.00 -126.00 -126.00 -126.00 +130.00 130.00 130.00 130.00 NULL NULL NULL NULL # Float arrays with scalar and per-row decimal places diff --git a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_simple.slt b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_simple.slt index 4453aa1489a1b..fc98079cdd311 100644 --- a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_simple.slt +++ b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_simple.slt @@ -81,7 +81,7 @@ SELECT cos(4.0) as cos, tan(5.0) as tan; ---- -1.1 7.389056098931 0.14112000806 -0.653643620864 -3.380515006247 +1.100000000000 7.389056098931 0.14112000806 -0.653643620864 -3.380515006247 query I @@ -321,8 +321,8 @@ SELECT * FROM (VALUES (1,2.0,-3,1+1),(10,20.0,-30,2+2)) AS tbl(int_col, float_col, negative_col, summation); ---- -1 2 -3 2 -10 20 -30 4 +1 2.000000000000 -3 2 +10 20.000000000000 -30 4 query IIRIIIIII @@ -338,7 +338,7 @@ SELECT bit_xor(c3) as bit_xor FROM aggregate_test_100_by_sql; ---- -100 100 7.81 781 125 -117 0 -1 -61 +100 100 7.810000000000 781 125 -117 0 -1 -61 query IIRIIIIII diff --git a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt index 8339fb4fab24a..58518b528185b 100644 --- a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt +++ b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_types.slt @@ -99,7 +99,7 @@ select 1.0::DOUBLE, 1.023::DOUBLE, 'NaN'::DOUBLE,'+Inf'::DOUBLE,'-Inf'::DOUBLE query RRR select 1.0::DECIMAL(5,3) as one, 2.023::DECIMAL(5,3) as two, 3.023::DECIMAL(5,2) as three ---- -1.000 2.023 3.02 +1.000000000000 2.023000000000 3.020000000000 query D select '2018-01-01'::DATE diff --git a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_window.slt b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_window.slt index f967d79a6d952..d17485373faa0 100644 --- a/datafusion/sqllogictest/test_files/pg_compat/pg_compat_window.slt +++ b/datafusion/sqllogictest/test_files/pg_compat/pg_compat_window.slt @@ -315,106 +315,106 @@ SELECT FROM aggregate_test_100_by_sql ORDER BY row_number; ---- -1 100 7.81 781 125 -117 0 -1 -61 -2 100 7.81 781 125 -117 0 -1 -61 -3 100 7.81 781 125 -117 0 -1 -61 -4 100 7.81 781 125 -117 0 -1 -61 -5 100 7.81 781 125 -117 0 -1 -61 -6 100 7.81 781 125 -117 0 -1 -61 -7 100 7.81 781 125 -117 0 -1 -61 -8 100 7.81 781 125 -117 0 -1 -61 -9 100 7.81 781 125 -117 0 -1 -61 -10 100 7.81 781 125 -117 0 -1 -61 -11 100 7.81 781 125 -117 0 -1 -61 -12 100 7.81 781 125 -117 0 -1 -61 -13 100 7.81 781 125 -117 0 -1 -61 -14 100 7.81 781 125 -117 0 -1 -61 -15 100 7.81 781 125 -117 0 -1 -61 -16 100 7.81 781 125 -117 0 -1 -61 -17 100 7.81 781 125 -117 0 -1 -61 -18 100 7.81 781 125 -117 0 -1 -61 -19 100 7.81 781 125 -117 0 -1 -61 -20 100 7.81 781 125 -117 0 -1 -61 -21 100 7.81 781 125 -117 0 -1 -61 -22 100 7.81 781 125 -117 0 -1 -61 -23 100 7.81 781 125 -117 0 -1 -61 -24 100 7.81 781 125 -117 0 -1 -61 -25 100 7.81 781 125 -117 0 -1 -61 -26 100 7.81 781 125 -117 0 -1 -61 -27 100 7.81 781 125 -117 0 -1 -61 -28 100 7.81 781 125 -117 0 -1 -61 -29 100 7.81 781 125 -117 0 -1 -61 -30 100 7.81 781 125 -117 0 -1 -61 -31 100 7.81 781 125 -117 0 -1 -61 -32 100 7.81 781 125 -117 0 -1 -61 -33 100 7.81 781 125 -117 0 -1 -61 -34 100 7.81 781 125 -117 0 -1 -61 -35 100 7.81 781 125 -117 0 -1 -61 -36 100 7.81 781 125 -117 0 -1 -61 -37 100 7.81 781 125 -117 0 -1 -61 -38 100 7.81 781 125 -117 0 -1 -61 -39 100 7.81 781 125 -117 0 -1 -61 -40 100 7.81 781 125 -117 0 -1 -61 -41 100 7.81 781 125 -117 0 -1 -61 -42 100 7.81 781 125 -117 0 -1 -61 -43 100 7.81 781 125 -117 0 -1 -61 -44 100 7.81 781 125 -117 0 -1 -61 -45 100 7.81 781 125 -117 0 -1 -61 -46 100 7.81 781 125 -117 0 -1 -61 -47 100 7.81 781 125 -117 0 -1 -61 -48 100 7.81 781 125 -117 0 -1 -61 -49 100 7.81 781 125 -117 0 -1 -61 -50 100 7.81 781 125 -117 0 -1 -61 -51 100 7.81 781 125 -117 0 -1 -61 -52 100 7.81 781 125 -117 0 -1 -61 -53 100 7.81 781 125 -117 0 -1 -61 -54 100 7.81 781 125 -117 0 -1 -61 -55 100 7.81 781 125 -117 0 -1 -61 -56 100 7.81 781 125 -117 0 -1 -61 -57 100 7.81 781 125 -117 0 -1 -61 -58 100 7.81 781 125 -117 0 -1 -61 -59 100 7.81 781 125 -117 0 -1 -61 -60 100 7.81 781 125 -117 0 -1 -61 -61 100 7.81 781 125 -117 0 -1 -61 -62 100 7.81 781 125 -117 0 -1 -61 -63 100 7.81 781 125 -117 0 -1 -61 -64 100 7.81 781 125 -117 0 -1 -61 -65 100 7.81 781 125 -117 0 -1 -61 -66 100 7.81 781 125 -117 0 -1 -61 -67 100 7.81 781 125 -117 0 -1 -61 -68 100 7.81 781 125 -117 0 -1 -61 -69 100 7.81 781 125 -117 0 -1 -61 -70 100 7.81 781 125 -117 0 -1 -61 -71 100 7.81 781 125 -117 0 -1 -61 -72 100 7.81 781 125 -117 0 -1 -61 -73 100 7.81 781 125 -117 0 -1 -61 -74 100 7.81 781 125 -117 0 -1 -61 -75 100 7.81 781 125 -117 0 -1 -61 -76 100 7.81 781 125 -117 0 -1 -61 -77 100 7.81 781 125 -117 0 -1 -61 -78 100 7.81 781 125 -117 0 -1 -61 -79 100 7.81 781 125 -117 0 -1 -61 -80 100 7.81 781 125 -117 0 -1 -61 -81 100 7.81 781 125 -117 0 -1 -61 -82 100 7.81 781 125 -117 0 -1 -61 -83 100 7.81 781 125 -117 0 -1 -61 -84 100 7.81 781 125 -117 0 -1 -61 -85 100 7.81 781 125 -117 0 -1 -61 -86 100 7.81 781 125 -117 0 -1 -61 -87 100 7.81 781 125 -117 0 -1 -61 -88 100 7.81 781 125 -117 0 -1 -61 -89 100 7.81 781 125 -117 0 -1 -61 -90 100 7.81 781 125 -117 0 -1 -61 -91 100 7.81 781 125 -117 0 -1 -61 -92 100 7.81 781 125 -117 0 -1 -61 -93 100 7.81 781 125 -117 0 -1 -61 -94 100 7.81 781 125 -117 0 -1 -61 -95 100 7.81 781 125 -117 0 -1 -61 -96 100 7.81 781 125 -117 0 -1 -61 -97 100 7.81 781 125 -117 0 -1 -61 -98 100 7.81 781 125 -117 0 -1 -61 -99 100 7.81 781 125 -117 0 -1 -61 -100 100 7.81 781 125 -117 0 -1 -61 +1 100 7.810000000000 781 125 -117 0 -1 -61 +2 100 7.810000000000 781 125 -117 0 -1 -61 +3 100 7.810000000000 781 125 -117 0 -1 -61 +4 100 7.810000000000 781 125 -117 0 -1 -61 +5 100 7.810000000000 781 125 -117 0 -1 -61 +6 100 7.810000000000 781 125 -117 0 -1 -61 +7 100 7.810000000000 781 125 -117 0 -1 -61 +8 100 7.810000000000 781 125 -117 0 -1 -61 +9 100 7.810000000000 781 125 -117 0 -1 -61 +10 100 7.810000000000 781 125 -117 0 -1 -61 +11 100 7.810000000000 781 125 -117 0 -1 -61 +12 100 7.810000000000 781 125 -117 0 -1 -61 +13 100 7.810000000000 781 125 -117 0 -1 -61 +14 100 7.810000000000 781 125 -117 0 -1 -61 +15 100 7.810000000000 781 125 -117 0 -1 -61 +16 100 7.810000000000 781 125 -117 0 -1 -61 +17 100 7.810000000000 781 125 -117 0 -1 -61 +18 100 7.810000000000 781 125 -117 0 -1 -61 +19 100 7.810000000000 781 125 -117 0 -1 -61 +20 100 7.810000000000 781 125 -117 0 -1 -61 +21 100 7.810000000000 781 125 -117 0 -1 -61 +22 100 7.810000000000 781 125 -117 0 -1 -61 +23 100 7.810000000000 781 125 -117 0 -1 -61 +24 100 7.810000000000 781 125 -117 0 -1 -61 +25 100 7.810000000000 781 125 -117 0 -1 -61 +26 100 7.810000000000 781 125 -117 0 -1 -61 +27 100 7.810000000000 781 125 -117 0 -1 -61 +28 100 7.810000000000 781 125 -117 0 -1 -61 +29 100 7.810000000000 781 125 -117 0 -1 -61 +30 100 7.810000000000 781 125 -117 0 -1 -61 +31 100 7.810000000000 781 125 -117 0 -1 -61 +32 100 7.810000000000 781 125 -117 0 -1 -61 +33 100 7.810000000000 781 125 -117 0 -1 -61 +34 100 7.810000000000 781 125 -117 0 -1 -61 +35 100 7.810000000000 781 125 -117 0 -1 -61 +36 100 7.810000000000 781 125 -117 0 -1 -61 +37 100 7.810000000000 781 125 -117 0 -1 -61 +38 100 7.810000000000 781 125 -117 0 -1 -61 +39 100 7.810000000000 781 125 -117 0 -1 -61 +40 100 7.810000000000 781 125 -117 0 -1 -61 +41 100 7.810000000000 781 125 -117 0 -1 -61 +42 100 7.810000000000 781 125 -117 0 -1 -61 +43 100 7.810000000000 781 125 -117 0 -1 -61 +44 100 7.810000000000 781 125 -117 0 -1 -61 +45 100 7.810000000000 781 125 -117 0 -1 -61 +46 100 7.810000000000 781 125 -117 0 -1 -61 +47 100 7.810000000000 781 125 -117 0 -1 -61 +48 100 7.810000000000 781 125 -117 0 -1 -61 +49 100 7.810000000000 781 125 -117 0 -1 -61 +50 100 7.810000000000 781 125 -117 0 -1 -61 +51 100 7.810000000000 781 125 -117 0 -1 -61 +52 100 7.810000000000 781 125 -117 0 -1 -61 +53 100 7.810000000000 781 125 -117 0 -1 -61 +54 100 7.810000000000 781 125 -117 0 -1 -61 +55 100 7.810000000000 781 125 -117 0 -1 -61 +56 100 7.810000000000 781 125 -117 0 -1 -61 +57 100 7.810000000000 781 125 -117 0 -1 -61 +58 100 7.810000000000 781 125 -117 0 -1 -61 +59 100 7.810000000000 781 125 -117 0 -1 -61 +60 100 7.810000000000 781 125 -117 0 -1 -61 +61 100 7.810000000000 781 125 -117 0 -1 -61 +62 100 7.810000000000 781 125 -117 0 -1 -61 +63 100 7.810000000000 781 125 -117 0 -1 -61 +64 100 7.810000000000 781 125 -117 0 -1 -61 +65 100 7.810000000000 781 125 -117 0 -1 -61 +66 100 7.810000000000 781 125 -117 0 -1 -61 +67 100 7.810000000000 781 125 -117 0 -1 -61 +68 100 7.810000000000 781 125 -117 0 -1 -61 +69 100 7.810000000000 781 125 -117 0 -1 -61 +70 100 7.810000000000 781 125 -117 0 -1 -61 +71 100 7.810000000000 781 125 -117 0 -1 -61 +72 100 7.810000000000 781 125 -117 0 -1 -61 +73 100 7.810000000000 781 125 -117 0 -1 -61 +74 100 7.810000000000 781 125 -117 0 -1 -61 +75 100 7.810000000000 781 125 -117 0 -1 -61 +76 100 7.810000000000 781 125 -117 0 -1 -61 +77 100 7.810000000000 781 125 -117 0 -1 -61 +78 100 7.810000000000 781 125 -117 0 -1 -61 +79 100 7.810000000000 781 125 -117 0 -1 -61 +80 100 7.810000000000 781 125 -117 0 -1 -61 +81 100 7.810000000000 781 125 -117 0 -1 -61 +82 100 7.810000000000 781 125 -117 0 -1 -61 +83 100 7.810000000000 781 125 -117 0 -1 -61 +84 100 7.810000000000 781 125 -117 0 -1 -61 +85 100 7.810000000000 781 125 -117 0 -1 -61 +86 100 7.810000000000 781 125 -117 0 -1 -61 +87 100 7.810000000000 781 125 -117 0 -1 -61 +88 100 7.810000000000 781 125 -117 0 -1 -61 +89 100 7.810000000000 781 125 -117 0 -1 -61 +90 100 7.810000000000 781 125 -117 0 -1 -61 +91 100 7.810000000000 781 125 -117 0 -1 -61 +92 100 7.810000000000 781 125 -117 0 -1 -61 +93 100 7.810000000000 781 125 -117 0 -1 -61 +94 100 7.810000000000 781 125 -117 0 -1 -61 +95 100 7.810000000000 781 125 -117 0 -1 -61 +96 100 7.810000000000 781 125 -117 0 -1 -61 +97 100 7.810000000000 781 125 -117 0 -1 -61 +98 100 7.810000000000 781 125 -117 0 -1 -61 +99 100 7.810000000000 781 125 -117 0 -1 -61 +100 100 7.810000000000 781 125 -117 0 -1 -61 query IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII SELECT @@ -790,20 +790,20 @@ ORDER BY row_number; 3566741189 84 83 11.337209302326 975 125 -117 0 -1 69 3570297463 85 84 11.337209302326 975 125 -117 0 -1 69 3593959807 86 86 11.337209302326 975 125 -117 0 -1 69 -141047417 87 3 7.81 781 125 -117 0 -1 -61 -662099130 88 17 7.81 781 125 -117 0 -1 -61 -974297360 89 23 7.81 781 125 -117 0 -1 -61 -1013876852 90 25 7.81 781 125 -117 0 -1 -61 -1229567292 91 29 7.81 781 125 -117 0 -1 -61 -1365198901 92 33 7.81 781 125 -117 0 -1 -61 -2307004493 93 50 7.81 781 125 -117 0 -1 -61 -2424630722 94 51 7.81 781 125 -117 0 -1 -61 -2496054700 95 52 7.81 781 125 -117 0 -1 -61 -2861911482 96 65 7.81 781 125 -117 0 -1 -61 -3342719438 97 75 7.81 781 125 -117 0 -1 -61 -3373581039 98 76 7.81 781 125 -117 0 -1 -61 -3457053821 99 79 7.81 781 125 -117 0 -1 -61 -4268716378 100 100 7.81 781 125 -117 0 -1 -61 +141047417 87 3 7.810000000000 781 125 -117 0 -1 -61 +662099130 88 17 7.810000000000 781 125 -117 0 -1 -61 +974297360 89 23 7.810000000000 781 125 -117 0 -1 -61 +1013876852 90 25 7.810000000000 781 125 -117 0 -1 -61 +1229567292 91 29 7.810000000000 781 125 -117 0 -1 -61 +1365198901 92 33 7.810000000000 781 125 -117 0 -1 -61 +2307004493 93 50 7.810000000000 781 125 -117 0 -1 -61 +2424630722 94 51 7.810000000000 781 125 -117 0 -1 -61 +2496054700 95 52 7.810000000000 781 125 -117 0 -1 -61 +2861911482 96 65 7.810000000000 781 125 -117 0 -1 -61 +3342719438 97 75 7.810000000000 781 125 -117 0 -1 -61 +3373581039 98 76 7.810000000000 781 125 -117 0 -1 -61 +3457053821 99 79 7.810000000000 781 125 -117 0 -1 -61 +4268716378 100 100 7.810000000000 781 125 -117 0 -1 -61 query IIIRIIIIII @@ -938,102 +938,102 @@ SELECT FROM aggregate_test_100_by_sql ORDER BY c9; ---- -28774375 1 1 30 30 30 30 30 30 30 -63044568 1 1 113 113 113 113 113 113 113 -141047417 1 1 36 36 36 36 36 36 36 -141680161 2 2 3.5 7 113 -106 16 -9 -25 +28774375 1 1 30.000000000000 30 30 30 30 30 30 +63044568 1 1 113.000000000000 113 113 113 113 113 113 +141047417 1 1 36.000000000000 36 36 36 36 36 36 +141680161 2 2 3.500000000000 7 113 -106 16 -9 -25 145294611 3 3 17.333333333333 52 113 -106 0 -1 -54 -225513085 1 1 -98 -98 -98 -98 -98 -98 -98 -243203849 1 1 -101 -101 -101 -101 -101 -101 -101 -326151275 2 2 38.5 77 47 30 14 63 49 -431948861 2 2 -43.5 -87 14 -101 10 -97 -107 -466439833 3 3 -8 -24 47 -101 10 -65 -86 -473294098 2 2 -14 -28 70 -98 6 -34 -40 +225513085 1 1 -98.000000000000 -98 -98 -98 -98 -98 -98 +243203849 1 1 -101.000000000000 -101 -101 -101 -101 -101 -101 +326151275 2 2 38.500000000000 77 47 30 14 63 49 +431948861 2 2 -43.500000000000 -87 14 -101 10 -97 -107 +466439833 3 3 -8.000000000000 -24 47 -101 10 -65 -86 +473294098 2 2 -14.000000000000 -28 70 -98 6 -34 -40 520189543 3 3 -17.333333333333 -52 70 -98 0 -2 48 -538589788 4 4 12.25 49 73 -101 8 -1 -29 -557517119 5 5 -1.4 -7 73 -101 8 -1 43 +538589788 4 4 12.250000000000 49 73 -101 8 -1 -29 +557517119 5 5 -1.400000000000 -7 73 -101 8 -1 43 559847112 3 3 -60.666666666667 -182 14 -101 0 -65 52 -598822671 4 4 5.75 23 113 -106 0 -1 41 -662099130 2 2 50 100 64 36 0 100 100 -754775609 4 4 -41.25 -165 17 -101 0 -65 37 -774637006 4 4 -34.25 -137 70 -98 0 -1 -101 -811650497 6 6 8 48 73 -101 0 -1 28 -879082834 5 5 -16 -80 70 -98 0 -1 -94 +598822671 4 4 5.750000000000 23 113 -106 0 -1 41 +662099130 2 2 50.000000000000 100 64 36 0 100 100 +754775609 4 4 -41.250000000000 -165 17 -101 0 -65 37 +774637006 4 4 -34.250000000000 -137 70 -98 0 -1 -101 +811650497 6 6 8.000000000000 48 73 -101 0 -1 28 +879082834 5 5 -16.000000000000 -80 70 -98 0 -1 -94 933879086 7 7 9.285714285714 65 73 -101 0 -1 13 -974297360 3 3 56 168 68 36 0 100 32 -1000948272 5 5 23.2 116 113 -106 0 -1 116 -1013876852 4 4 34.25 137 68 -31 0 -27 -63 -1088543984 5 5 -18.4 -92 73 -101 0 -1 108 -1098639440 6 6 24.5 147 113 -106 0 -1 107 +974297360 3 3 56.000000000000 168 68 36 0 100 32 +1000948272 5 5 23.200000000000 116 113 -106 0 -1 116 +1013876852 4 4 34.250000000000 137 68 -31 0 -27 -63 +1088543984 5 5 -18.400000000000 -92 73 -101 0 -1 108 +1098639440 6 6 24.500000000000 147 113 -106 0 -1 107 1157161427 7 7 5.714285714286 40 113 -107 0 -1 -2 -1229567292 5 5 51 255 118 -31 0 -9 -73 -1243785310 8 8 -5.75 -46 73 -111 0 -1 -100 -1289293657 8 8 11.125 89 113 -107 0 -1 -49 +1229567292 5 5 51.000000000000 255 118 -31 0 -9 -73 +1243785310 8 8 -5.750000000000 -46 73 -111 0 -1 -100 +1289293657 8 8 11.125000000000 89 113 -107 0 -1 -49 1362369177 6 6 -11.666666666667 -70 73 -101 0 -1 122 1365198901 6 6 32.666666666667 196 118 -59 0 -9 114 1454057357 6 6 -22.666666666667 -136 70 -98 0 -1 106 -1491205016 9 9 10 90 113 -107 0 -1 -50 +1491205016 9 9 10.000000000000 90 113 -107 0 -1 -50 1534194097 9 9 6.222222222222 56 102 -111 0 -1 -6 1538863055 7 7 -7.571428571429 -53 73 -101 0 -1 107 -1787652631 10 10 1.8 18 102 -111 0 -1 32 -1824517658 8 8 -16.125 -129 73 -101 0 -1 -33 +1787652631 10 10 1.800000000000 18 102 -111 0 -1 32 +1824517658 8 8 -16.125000000000 -129 73 -101 0 -1 -33 1842680163 7 7 -11.714285714286 -82 70 -98 0 -1 92 1865307672 11 11 7.545454545455 83 102 -111 0 -1 97 1995343206 9 9 -22.333333333333 -201 73 -101 0 -1 103 -2013662838 10 10 14.2 142 113 -107 0 -1 -6 -2042457019 12 12 15 180 102 -111 0 -1 0 -2093538928 10 10 -12.4 -124 77 -101 0 -1 42 -2125812933 8 8 -5.125 -41 70 -98 0 -1 117 +2013662838 10 10 14.200000000000 142 113 -107 0 -1 -6 +2042457019 12 12 15.000000000000 180 102 -111 0 -1 0 +2093538928 10 10 -12.400000000000 -124 77 -101 0 -1 42 +2125812933 8 8 -5.125000000000 -41 70 -98 0 -1 117 2214035726 11 11 -10.090909090909 -111 77 -101 0 -1 39 2293105904 11 11 2.272727272727 25 113 -117 0 -1 113 2306130875 13 13 14.076923076923 183 102 -111 0 -1 3 2307004493 7 7 36.857142857143 258 118 -59 0 -1 76 -2424630722 8 8 31.625 253 118 -59 0 -1 -73 +2424630722 8 8 31.625000000000 253 118 -59 0 -1 -73 2496054700 9 9 16.888888888889 152 118 -101 0 -1 44 2502326480 14 14 9.214285714286 129 102 -111 0 -1 -55 2525744318 12 12 -2.916666666667 -35 113 -117 0 -1 -75 -2592330556 12 12 1 12 123 -101 0 -1 92 +2592330556 12 12 1.000000000000 12 123 -101 0 -1 92 2610290479 9 9 -0.555555555556 -5 70 -98 0 -1 81 -2669374863 10 10 -1 -10 70 -98 0 -1 -86 +2669374863 10 10 -1.000000000000 -10 70 -98 0 -1 -86 2705709344 13 13 2.153846153846 28 113 -117 0 -1 -118 2712615025 11 11 2.545454545455 28 70 -98 0 -1 -116 2778168728 15 15 5.066666666667 76 102 -111 0 -1 2 -2818832252 16 16 -0.1875 -3 102 -111 0 -1 -77 +2818832252 16 16 -0.187500000000 -3 102 -111 0 -1 -77 2830981072 12 12 12.333333333333 148 120 -98 0 -1 -12 2844041986 14 14 -2.285714285714 -32 113 -117 0 -1 78 2861376515 13 13 10.769230769231 140 120 -98 0 -1 12 -2861911482 10 10 6.6 66 118 -101 0 -1 -122 -2939920218 15 15 -5 -75 113 -117 0 -1 -101 +2861911482 10 10 6.600000000000 66 118 -101 0 -1 -122 +2939920218 15 15 -5.000000000000 -75 113 -117 0 -1 -101 3023531799 17 17 -7.058823529412 -120 102 -117 0 -1 56 3105312559 13 13 6.384615384615 83 123 -101 0 -1 27 3126475872 18 18 -6.388888888889 -115 102 -117 0 -1 61 -3188005828 16 16 1.375 22 113 -117 0 -1 -6 +3188005828 16 16 1.375000000000 22 113 -117 0 -1 -6 3198969145 19 19 -2.157894736842 -41 102 -117 0 -1 119 3275293996 14 14 12.071428571429 169 120 -98 0 -1 17 -3276123488 15 15 9.6 144 120 -98 0 -1 -10 +3276123488 15 15 9.600000000000 144 120 -98 0 -1 -10 3314983189 17 17 4.352941176471 74 113 -117 0 -1 -50 3342719438 11 11 -1.454545454545 -16 118 -101 0 -1 40 3373581039 12 12 -4.666666666667 -56 118 -101 0 -1 -16 3398507249 18 18 5.722222222222 103 113 -117 0 -1 -45 -3455216719 19 19 9 171 113 -117 0 -1 -105 +3455216719 19 19 9.000000000000 171 113 -117 0 -1 -105 3457053821 13 13 -7.692307692308 -100 118 -101 0 -1 36 3473924576 14 14 12.857142857143 180 123 -101 0 -1 122 -3521368277 20 20 2.75 55 102 -117 0 -1 23 -3542840110 16 16 4.5 72 120 -98 0 -1 78 -3566741189 21 21 8.47619047619 178 123 -117 0 -1 108 +3521368277 20 20 2.750000000000 55 102 -117 0 -1 23 +3542840110 16 16 4.500000000000 72 120 -98 0 -1 78 +3566741189 21 21 8.476190476190 178 123 -117 0 -1 108 3570297463 22 22 5.409090909091 119 123 -117 0 -1 -87 3577318119 15 15 18.933333333333 284 123 -101 0 -1 18 3593959807 23 23 1.260869565217 29 123 -117 0 -1 15 3625286410 17 17 11.588235294118 197 125 -98 0 -1 51 -3717551163 20 20 6.15 123 113 -117 0 -1 71 -3759340273 16 16 24.75 396 123 -101 0 -1 98 +3717551163 20 20 6.150000000000 123 113 -117 0 -1 71 +3759340273 16 16 24.750000000000 396 123 -101 0 -1 98 3766999078 18 18 16.666666666667 300 125 -98 0 -1 84 3862393166 17 17 23.176470588235 394 123 -101 0 -1 -100 3959216334 18 18 21.222222222222 382 123 -101 0 -1 104 3998790955 19 19 20.789473684211 395 123 -101 0 -1 101 4015442341 19 19 20.157894736842 383 125 -98 0 -1 7 4061635107 21 21 11.666666666667 245 122 -117 0 -1 61 -4076864659 20 20 19.75 395 125 -98 0 -1 11 +4076864659 20 20 19.750000000000 395 125 -98 0 -1 11 4144173353 22 22 8.363636363636 184 122 -117 0 -1 -2 4216440507 21 21 14.095238095238 296 125 -99 0 -1 -106 4229654142 22 22 16.681818181818 367 125 -99 0 -1 -47 From 3ac08d997507a013471de9920a9893eb2c29f5f2 Mon Sep 17 00:00:00 2001 From: Adam Gutglick Date: Mon, 3 Aug 2026 17:14:28 +0100 Subject: [PATCH 3/3] TPC-H fix Signed-off-by: Adam Gutglick --- .../sqllogictest/test_files/tpch/answers/q1.slt.part | 8 ++++---- .../sqllogictest/test_files/tpch/answers/q10.slt.part | 2 +- .../sqllogictest/test_files/tpch/answers/q11.slt.part | 2 +- .../sqllogictest/test_files/tpch/answers/q18.slt.part | 10 +++++----- .../sqllogictest/test_files/tpch/answers/q19.slt.part | 2 +- .../sqllogictest/test_files/tpch/answers/q2.slt.part | 6 +++--- .../sqllogictest/test_files/tpch/answers/q22.slt.part | 2 +- .../sqllogictest/test_files/tpch/answers/q3.slt.part | 6 +++--- .../sqllogictest/test_files/tpch/answers/q5.slt.part | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q1.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q1.slt.part index bd8761bbb7fb4..fa6f2680e2bde 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q1.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q1.slt.part @@ -39,7 +39,7 @@ order by l_returnflag, l_linestatus; ---- -A F 3774200 5320753880.69 5054096266.6828 5256751331.449234 25.537587 36002.123829 0.050144 147790 -N F 95257 133737795.84 127132372.6512 132286291.229445 25.300664 35521.326916 0.049394 3765 -N O 7459297 10512270008.9 9986238338.3847 10385578376.585467 25.545537 36000.924688 0.050095 292000 -R F 3785523 5337950526.47 5071818532.942 5274405503.049367 25.525943 35994.029214 0.049989 148301 +A F 3774200.00 5320753880.69 5054096266.6828 5256751331.449234 25.537587 36002.123829 0.050144 147790 +N F 95257.00 133737795.84 127132372.6512 132286291.229445 25.300664 35521.326916 0.049394 3765 +N O 7459297.00 10512270008.90 9986238338.3847 10385578376.585467 25.545537 36000.924688 0.050095 292000 +R F 3785523.00 5337950526.47 5071818532.9420 5274405503.049367 25.525943 35994.029214 0.049989 148301 diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q10.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q10.slt.part index 8a8d1a00d9fd7..384e28d804c94 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q10.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q10.slt.part @@ -59,4 +59,4 @@ limit 10; 13984 Customer#000013984 446316.5104 3482.28 IRAN qZXwuapCHvxbX 20-981-264-2952 y unusual courts could wake furiously 1966 Customer#000001966 444059.0382 1937.72 ALGERIA jPv1 UHra5JLALR5Isci5u0636RoAu7t vH 10-973-269-8886 the blithely even accounts. final deposits cajole around the blithely final packages. 11026 Customer#000011026 417913.4142 7738.76 ALGERIA XorIktoJOAEJkpNNMx 10-184-163-4632 ly even dolphins eat along the blithely even instructions. express attainments cajole slyly. busy dolphins in -8501 Customer#000008501 412797.51 6906.7 ARGENTINA 776af4rOa mZ66hczs 11-317-552-5840 y final deposits after the fluffily even accounts are slyly final, regular +8501 Customer#000008501 412797.5100 6906.70 ARGENTINA 776af4rOa mZ66hczs 11-317-552-5840 y final deposits after the fluffily even accounts are slyly final, regular diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q11.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q11.slt.part index 53fb6bca2968c..a6ceb742be622 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q11.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q11.slt.part @@ -49,7 +49,7 @@ limit 10; 12098 16227681.21 5134 15709338.52 13334 15023662.41 -17052 14351644.2 +17052 14351644.20 3452 14070870.14 12552 13332469.18 1084 13170428.29 diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q18.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q18.slt.part index 93da210f51db6..5481f26f03460 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q18.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q18.slt.part @@ -50,8 +50,8 @@ order by o_totalprice desc, o_orderdate; ---- -Customer#000001639 1639 502886 1994-04-12 456423.88 312 -Customer#000006655 6655 29158 1995-10-21 452805.02 305 -Customer#000014110 14110 565574 1995-09-24 425099.85 301 -Customer#000001775 1775 6882 1997-04-09 408368.1 303 -Customer#000011459 11459 551136 1993-05-19 386812.74 308 +Customer#000001639 1639 502886 1994-04-12 456423.88 312.00 +Customer#000006655 6655 29158 1995-10-21 452805.02 305.00 +Customer#000014110 14110 565574 1995-09-24 425099.85 301.00 +Customer#000001775 1775 6882 1997-04-09 408368.10 303.00 +Customer#000011459 11459 551136 1993-05-19 386812.74 308.00 diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q19.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q19.slt.part index a8c6a5032db81..bee10aadbfca7 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q19.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q19.slt.part @@ -53,4 +53,4 @@ where and l_shipinstruct = 'DELIVER IN PERSON' ); ---- -168597.286 +168597.2860 diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q2.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q2.slt.part index db4966c47be01..56945d904dea6 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q2.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q2.slt.part @@ -67,8 +67,8 @@ limit 10; 9508.37 Supplier#000000070 FRANCE 17268 Manufacturer#4 INWNH2w,OOWgNDq0BRCcBwOMQc6PdFDc4 16-821-608-1166 ests sleep quickly express ideas. ironic ideas haggle about the final T 9453.01 Supplier#000000802 ROMANIA 10021 Manufacturer#5 ,6HYXb4uaHITmtMBj4Ak57Pd 29-342-882-6463 gular frets. permanently special multipliers believe blithely alongs 9453.01 Supplier#000000802 ROMANIA 13275 Manufacturer#4 ,6HYXb4uaHITmtMBj4Ak57Pd 29-342-882-6463 gular frets. permanently special multipliers believe blithely alongs -9192.1 Supplier#000000115 UNITED KINGDOM 13325 Manufacturer#1 nJ 2t0f7Ve,wL1,6WzGBJLNBUCKlsV 33-597-248-1220 es across the carefully express accounts boost caref +9192.10 Supplier#000000115 UNITED KINGDOM 13325 Manufacturer#1 nJ 2t0f7Ve,wL1,6WzGBJLNBUCKlsV 33-597-248-1220 es across the carefully express accounts boost caref 9032.15 Supplier#000000959 GERMANY 4958 Manufacturer#4 8grA EHBnwOZhO 17-108-642-3106 nding dependencies nag furiou 8702.02 Supplier#000000333 RUSSIA 11810 Manufacturer#3 MaVf XgwPdkiX4nfJGOis8Uu2zKiIZH 32-508-202-6136 oss the deposits cajole carefully even pinto beans. regular foxes detect alo -8615.5 Supplier#000000812 FRANCE 10551 Manufacturer#2 8qh4tezyScl5bidLAysvutB,,ZI2dn6xP 16-585-724-6633 y quickly regular deposits? quickly pending packages after the caref -8615.5 Supplier#000000812 FRANCE 13811 Manufacturer#4 8qh4tezyScl5bidLAysvutB,,ZI2dn6xP 16-585-724-6633 y quickly regular deposits? quickly pending packages after the caref +8615.50 Supplier#000000812 FRANCE 10551 Manufacturer#2 8qh4tezyScl5bidLAysvutB,,ZI2dn6xP 16-585-724-6633 y quickly regular deposits? quickly pending packages after the caref +8615.50 Supplier#000000812 FRANCE 13811 Manufacturer#4 8qh4tezyScl5bidLAysvutB,,ZI2dn6xP 16-585-724-6633 y quickly regular deposits? quickly pending packages after the caref diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q22.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q22.slt.part index 22338269120f8..b32e0e9653316 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q22.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q22.slt.part @@ -61,4 +61,4 @@ order by 23 93 708285.25 29 85 632693.46 30 87 646748.02 -31 87 647372.5 +31 87 647372.50 diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q3.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q3.slt.part index 1e7fc0a9619ab..dbfdd12524071 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q3.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q3.slt.part @@ -44,10 +44,10 @@ order by 223140 355369.0698 1995-03-14 0 584291 354494.7318 1995-02-21 0 405063 353125.4577 1995-03-03 0 -573861 351238.277 1995-03-09 0 +573861 351238.2770 1995-03-09 0 554757 349181.7426 1995-03-14 0 -506021 321075.581 1995-03-10 0 +506021 321075.5810 1995-03-10 0 121604 318576.4154 1995-03-07 0 108514 314967.0754 1995-02-20 0 -462502 312604.542 1995-03-08 0 +462502 312604.5420 1995-03-08 0 178727 309728.9306 1995-02-25 0 diff --git a/datafusion/sqllogictest/test_files/tpch/answers/q5.slt.part b/datafusion/sqllogictest/test_files/tpch/answers/q5.slt.part index 75e2fa316fdc3..5123df1254cd8 100644 --- a/datafusion/sqllogictest/test_files/tpch/answers/q5.slt.part +++ b/datafusion/sqllogictest/test_files/tpch/answers/q5.slt.part @@ -42,7 +42,7 @@ group by order by revenue desc; ---- -CHINA 7822103 +CHINA 7822103.0000 INDIA 6376121.5085 JAPAN 6000077.2184 INDONESIA 5580475.4027