ZhangHuiGui commented on issue #40308:
URL: https://github.com/apache/arrow/issues/40308#issuecomment-1986810697

   I think it's a problem and we should fix it.
   Below code could prove this problem:
   ```c
   // Normal expression
   TEST(DecimalTest, Divide) {
     auto expr = arrow::compute::call("divide", 
{arrow::compute::field_ref("f1"),
                                                 
arrow::compute::field_ref("f2")});
     auto s = arrow::schema({arrow::field("f1", arrow::decimal128(11, 3)),
                             arrow::field("f2", arrow::decimal128(20, 9))});
     ASSERT_OK_AND_ASSIGN(expr, expr.Bind(*s));
     arrow::AssertTypeEqual(*expr.type(), *arrow::decimal128(32, 15));
   
     auto b = arrow::RecordBatchFromJSON(s, R"([
       ["1.982", "1.000000001"]
      ])");
     ASSERT_OK_AND_ASSIGN(auto input, arrow::compute::MakeExecBatch(*s, b));
     ASSERT_OK_AND_ASSIGN(auto res,
                          arrow::compute::ExecuteScalarExpression(expr, input));
     arrow::AssertArraysEqual(
         *res.make_array(),
         *arrow::ArrayFromJSON(arrow::decimal128(32, 15), 
R"(["1.981999998018000"])"));
   }
   
   // gandiva test
   TEST_F(TestDecimalOps, TestDivide) {
     DivideAndVerify(decimal_literal("1982", 11, 3),
                     decimal_literal("1000000001", 20, 9),
                     decimal_literal("1981999998018000001982", 38, 21));
   }
   ```
   For normal expression results:


-- 
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