melgenek commented on code in PR #5086:
URL: https://github.com/apache/arrow-datafusion/pull/5086#discussion_r1089553803


##########
datafusion/core/tests/sqllogictests/test_files/decimal.slt:
##########
@@ -0,0 +1,594 @@
+# 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.
+
+query ?R
+select arrow_typeof(cast(1.23 as decimal(10,4))),
+       cast(1.23 as decimal(10,4));
+----
+Decimal128(10, 4) 1.23
+
+
+query ?R
+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
+select arrow_typeof(cast(1.2345 as decimal(24,2))), cast(1.2345 as 
decimal(24,2));
+----
+Decimal128(24, 2) 1.23
+
+
+query ok
+CREATE EXTERNAL TABLE decimal_simple (
+c1 DECIMAL(10,6) NOT NULL,
+c2 DOUBLE NOT NULL,
+c3 BIGINT NOT NULL,
+c4 BOOLEAN NOT NULL,
+c5 DECIMAL(12,7) NOT NULL
+)
+STORED AS CSV
+WITH HEADER ROW
+LOCATION 'tests/data/decimal_data.csv';
+
+
+query ??
+select arrow_typeof(c1), arrow_typeof(c5) from decimal_simple where c1 > c5 
limit 1;
+----
+Decimal128(10, 6) Decimal128(12, 7)
+
+
+query R
+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
+
+
+query R
+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
+
+
+query RRI?R
+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
+
+
+query ?R
+select arrow_typeof(min(c1)), min(c1) from decimal_simple where c4=false;
+----
+Decimal128(10, 6) 0.00002
+
+
+query ?R
+select arrow_typeof(max(c1)), max(c1) from decimal_simple where c4=false;
+----
+Decimal128(10, 6) 0.00005
+
+
+# inferred precision is 10+10
+# inferred scale is the original scale
+query R
+select arrow_typeof(sum(c1)), sum(c1) from decimal_simple;
+----
+Decimal128(20, 6) 0.00055
+
+
+# inferred precision is original precision + 4
+# inferred scale is the original scale + 4
+query ?R
+select arrow_typeof(avg(c1)), avg(c1) from decimal_simple;
+----
+Decimal128(14, 10) 0.0000366666
+
+
+query RRI?R
+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
+
+
+query RI
+select c2,c3 from decimal_simple where c1!=0.00002;
+----
+0.000000000001 1
+0.000000000003 4
+0.000000000003 5
+0.000000000003 5
+0.000000000004 5
+0.000000000004 12
+0.000000000004 14
+0.000000000004 8
+0.000000000005 9
+0.000000000005 4
+0.000000000005 8
+0.000000000005 100
+0.000000000005 1
+
+
+query RRI?R
+select * from decimal_simple where 0.00002 > c1;
+----
+0.00001 0.000000000001 1 true 0.000014
+
+
+query RRI?R
+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
+
+
+query RRI?R
+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 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
+
+
+query RRI?R
+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 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
+
+
+query ?
+select arrow_typeof(c1+1) from decimal_simple limit 1;
+----
+Decimal128(27, 6)
+
+
+query R
+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
+
+
+# array decimal(10,6) + array decimal(12,7) => decimal(13,7)
+query ?
+select arrow_typeof(c1+c5) from decimal_simple limit 1;
+----
+Decimal128(13, 7)
+
+
+query R
+select c1+c5 from decimal_simple;
+----
+0.000024
+0.000045
+0.000039
+0.000062
+0.000065
+0.000041
+0.000084
+0.00008
+0.00008
+0.000084
+0.000102
+0.000128
+0.000083
+0.000118
+0.00015
+
+
+query ?
+select arrow_typeof(c1-1) from decimal_simple limit 1;
+----
+Decimal128(27, 6)
+
+
+query R
+select c1-1 from decimal_simple;
+----
+-0.99999
+-0.99998
+-0.99998
+-0.99997
+-0.99997
+-0.99997
+-0.99996
+-0.99996
+-0.99996
+-0.99996
+-0.99995
+-0.99995
+-0.99995
+-0.99995
+-0.99995
+
+
+query ?
+select arrow_typeof(c1-c5) from decimal_simple limit 1;
+----
+Decimal128(13, 7)
+
+
+query R
+select c1-c5 from decimal_simple;
+----
+-0.000004
+-0.000005
+0.000001
+-0.000002
+-0.000005
+0.000019
+-0.000004
+0
+0
+-0.000004
+-0.000002
+-0.000028
+0.000017
+-0.000018
+-0.00005
+
+
+query ?
+select arrow_typeof(c1*20) from decimal_simple limit 1;
+----
+Decimal128(31, 6)
+
+
+query R
+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
+
+
+query ?
+select arrow_typeof(c1*c5) from decimal_simple limit 1;
+----
+Decimal128(23, 13)
+
+
+query R
+select c1*c5 from decimal_simple;
+----
+0.00000000014
+0.0000000005
+0.00000000038
+0.00000000096
+0.00000000105
+0.00000000033
+0.00000000176
+0.0000000016
+0.0000000016
+0.00000000176
+0.0000000026
+0.0000000039
+0.00000000165
+0.0000000034
+0.000000005
+
+
+query ?
+select arrow_typeof(c1/cast(0.00001 as decimal(5,5))) from decimal_simple 
limit 1;
+----
+Decimal128(21, 12)
+
+
+query R
+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
+
+
+query ?
+select arrow_typeof(c1/c5) from decimal_simple limit 1;
+----
+Decimal128(30, 19)
+
+
+query R
+select c1/c5 from decimal_simple;
+----
+0.714285714286
+0.8
+1.052631578947
+0.9375
+0.857142857143
+2.727272727273
+0.909090909091
+1
+1
+0.909090909091
+0.961538461538
+0.641025641026
+1.515151515152
+0.735294117647
+0.5
+
+
+query ?
+select arrow_typeof(c5%cast(0.00001 as decimal(5,5))) from decimal_simple 
limit 1;
+----
+Decimal128(7, 7)
+
+
+query R
+select c5%cast(0.00001 as decimal(5,5)) from decimal_simple;
+----
+0.000004
+0.000005
+0.000009
+0.000002
+0.000005
+0.000001
+0.000004
+0
+0
+0.000004
+0.000002
+0.000008
+0.000003
+0.000008
+0
+
+
+query ?
+select arrow_typeof(c1%c5) from decimal_simple limit 1;
+----
+Decimal128(11, 7)
+
+
+query R
+select c1%c5 from decimal_simple;
+----
+0.00001
+0.00002
+0.000001
+0.00003
+0.00003
+0.000008
+0.00004
+0
+0
+0.00004
+0.00005
+0.00005
+0.000017
+0.00005
+0.00005
+
+
+query ?
+select arrow_typeof(abs(c1)) from decimal_simple limit 1;
+----
+Float64

Review Comment:
   The original test didn't check the type of `abs`, but I added a test entry 
for it. It seems like a bug to me. `Decimal(10,6)` was converted to a `Float64` 
as a result of `abs` call. It is probably related to 
https://github.com/apache/arrow-datafusion/issues/1335.



##########
datafusion/core/tests/sql/decimal.rs:
##########
@@ -1,915 +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 super::*;
-
-#[tokio::test]
-async fn decimal_cast() -> Result<()> {
-    let ctx = SessionContext::new();
-    let sql = "select cast(1.23 as decimal(10,4))";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 4),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+---------------+",
-        "| Float64(1.23) |",
-        "+---------------+",
-        "| 1.2300        |",
-        "+---------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    let sql = "select cast(cast(1.23 as decimal(10,3)) as decimal(10,4))";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 4),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+---------------+",
-        "| Float64(1.23) |",
-        "+---------------+",
-        "| 1.2300        |",
-        "+---------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    let sql = "select cast(1.2345 as decimal(24,2))";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(24, 2),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+-----------------+",
-        "| Float64(1.2345) |",
-        "+-----------------+",
-        "| 1.23            |",
-        "+-----------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    Ok(())
-}
-
-#[tokio::test]
-async fn decimal_by_sql() -> Result<()> {
-    let ctx = SessionContext::new();
-    register_decimal_csv_table_by_sql(&ctx).await;
-    let sql = "SELECT c1 from decimal_simple";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+",
-        "| c1       |",
-        "+----------+",
-        "| 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 |",
-        "+----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-    Ok(())
-}
-
-#[tokio::test]
-async fn decimal_by_filter() -> Result<()> {
-    let ctx = SessionContext::new();
-    register_decimal_csv_table_by_sql(&ctx).await;
-    let sql = "select c1 from decimal_simple where c1 > 0.000030";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+",
-        "| c1       |",
-        "+----------+",
-        "| 0.000040 |",
-        "| 0.000040 |",
-        "| 0.000040 |",
-        "| 0.000040 |",
-        "| 0.000050 |",
-        "| 0.000050 |",
-        "| 0.000050 |",
-        "| 0.000050 |",
-        "| 0.000050 |",
-        "+----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    let sql = "select * from decimal_simple where c1 > c5";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    assert_eq!(
-        &DataType::Decimal128(12, 7),
-        actual[0].schema().field(4).data_type()
-    );
-    let expected = vec![
-        "+----------+----------------+----+-------+-----------+",
-        "| c1       | c2             | c3 | c4    | c5        |",
-        "+----------+----------------+----+-------+-----------+",
-        "| 0.000020 | 0.000000000002 | 3  | false | 0.0000190 |",
-        "| 0.000030 | 0.000000000003 | 5  | true  | 0.0000110 |",
-        "| 0.000050 | 0.000000000005 | 8  | false | 0.0000330 |",
-        "+----------+----------------+----+-------+-----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-    Ok(())
-}
-
-#[tokio::test]
-async fn decimal_agg_function() -> Result<()> {
-    let ctx = SessionContext::new();
-    register_decimal_csv_table_by_sql(&ctx).await;
-    // min
-    let sql = "select min(c1) from decimal_simple where c4=false";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+------------------------+",
-        "| MIN(decimal_simple.c1) |",
-        "+------------------------+",
-        "| 0.000020               |",
-        "+------------------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-    // max
-    let sql = "select max(c1) from decimal_simple where c4=false";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+------------------------+",
-        "| MAX(decimal_simple.c1) |",
-        "+------------------------+",
-        "| 0.000050               |",
-        "+------------------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    // sum
-    let sql = "select sum(c1) from decimal_simple";
-    let actual = execute_to_batches(&ctx, sql).await;
-    // inferred precision is 10+10
-    assert_eq!(
-        &DataType::Decimal128(20, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+------------------------+",
-        "| SUM(decimal_simple.c1) |",
-        "+------------------------+",
-        "| 0.000550               |",
-        "+------------------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    // avg
-    // inferred precision is original precision + 4
-    // inferred scale is original scale + 4
-    let sql = "select avg(c1) from decimal_simple";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(14, 10),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+------------------------+",
-        "| AVG(decimal_simple.c1) |",
-        "+------------------------+",
-        "| 0.0000366666           |",
-        "+------------------------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    Ok(())
-}
-
-#[tokio::test]
-async fn decimal_logic_op() -> Result<()> {
-    let ctx = SessionContext::new();
-    register_decimal_csv_table_by_sql(&ctx).await;
-    // logic operation: eq
-    let sql = "select * from decimal_simple where c1=CAST(0.00002 as 
Decimal(10,8))";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+----------------+----+-------+-----------+",
-        "| c1       | c2             | c3 | c4    | c5        |",
-        "+----------+----------------+----+-------+-----------+",
-        "| 0.000020 | 0.000000000002 | 2  | true  | 0.0000250 |",
-        "| 0.000020 | 0.000000000002 | 3  | false | 0.0000190 |",
-        "+----------+----------------+----+-------+-----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    // logic operation: not eq
-    let sql = "select c2,c3 from decimal_simple where c1!=0.00002";
-    let actual = execute_to_batches(&ctx, sql).await;
-    let expected = vec![
-        "+----------------+-----+",
-        "| c2             | c3  |",
-        "+----------------+-----+",
-        "| 0.000000000001 | 1   |",
-        "| 0.000000000003 | 4   |",
-        "| 0.000000000003 | 5   |",
-        "| 0.000000000003 | 5   |",
-        "| 0.000000000004 | 5   |",
-        "| 0.000000000004 | 12  |",
-        "| 0.000000000004 | 14  |",
-        "| 0.000000000004 | 8   |",
-        "| 0.000000000005 | 9   |",
-        "| 0.000000000005 | 4   |",
-        "| 0.000000000005 | 8   |",
-        "| 0.000000000005 | 100 |",
-        "| 0.000000000005 | 1   |",
-        "+----------------+-----+",
-    ];
-    assert_batches_eq!(expected, &actual);
-    // logic operation: lt
-    let sql = "select * from decimal_simple where 0.00002 > c1";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+----------------+----+------+-----------+",
-        "| c1       | c2             | c3 | c4   | c5        |",
-        "+----------+----------------+----+------+-----------+",
-        "| 0.000010 | 0.000000000001 | 1  | true | 0.0000140 |",
-        "+----------+----------------+----+------+-----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    // logic operation: lteq
-    let sql = "select * from decimal_simple where c1 <= 0.00002";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+----------------+----+-------+-----------+",
-        "| c1       | c2             | c3 | c4    | c5        |",
-        "+----------+----------------+----+-------+-----------+",
-        "| 0.000010 | 0.000000000001 | 1  | true  | 0.0000140 |",
-        "| 0.000020 | 0.000000000002 | 2  | true  | 0.0000250 |",
-        "| 0.000020 | 0.000000000002 | 3  | false | 0.0000190 |",
-        "+----------+----------------+----+-------+-----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    // logic operation: gt
-    let sql = "select * from decimal_simple where c1 > 0.00002";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+----------------+-----+-------+-----------+",
-        "| c1       | c2             | c3  | c4    | c5        |",
-        "+----------+----------------+-----+-------+-----------+",
-        "| 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 | 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 |",
-        "+----------+----------------+-----+-------+-----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    // logic operation: gteq
-    let sql = "select * from decimal_simple where c1 >= 0.00002";
-    let actual = execute_to_batches(&ctx, sql).await;
-    assert_eq!(
-        &DataType::Decimal128(10, 6),
-        actual[0].schema().field(0).data_type()
-    );
-    let expected = vec![
-        "+----------+----------------+-----+-------+-----------+",
-        "| c1       | c2             | c3  | c4    | c5        |",
-        "+----------+----------------+-----+-------+-----------+",
-        "| 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 | 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 |",
-        "+----------+----------------+-----+-------+-----------+",
-    ];
-    assert_batches_eq!(expected, &actual);
-
-    Ok(())
-}
-
-#[tokio::test]
-async fn decimal_arithmetic_op() -> Result<()> {
-    let ctx = SessionContext::new();
-    register_decimal_csv_table_by_sql(&ctx).await;
-    // add
-    let sql = "select c1+1 from decimal_simple"; // add scalar
-    let actual = execute_to_batches(&ctx, sql).await;
-    // array decimal(10,6) +  scalar decimal(20,0) => decimal(21,6)
-    assert_eq!(
-        &DataType::Decimal128(27, 6),

Review Comment:
   I noticed that the comment expects a precision `21`, but the assertion is 
`27`. I am not sure if it's a typo in the comment, or if something is wrong 
with the type. I moved this test to `decimal.slt` as is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to