You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/28 10:13:49 UTC

[GitHub] [arrow-datafusion] tustvold opened a new pull request, #4400: Update to arrow 28

tustvold opened a new pull request, #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035496657


##########
datafusion/sql/src/utils.rs:
##########
@@ -522,9 +522,12 @@ pub(crate) fn make_decimal_type(
     };
 
     // Arrow decimal is i128 meaning 38 maximum decimal digits
-    if precision == 0 || precision > DECIMAL128_MAX_PRECISION || scale > precision {
+    if precision == 0
+        || precision > DECIMAL128_MAX_PRECISION
+        || scale.unsigned_abs() > precision
+    {
         Err(DataFusionError::Internal(format!(
-            "Decimal(precision = {}, scale = {}) should satisty `0 < precision <= 38`, and `scale <= precision`.",
+            "Decimal(precision = {}, scale = {}) should satisfy `-38 < precision <= 38`, and `scale <= precision`.",

Review Comment:
   ```suggestion
               "Decimal(precision = {}, scale = {}) should satisfy `0 < precision <= 38`, and `scale <= precision`.",
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1033356845


##########
datafusion/proto/proto/datafusion.proto:
##########
@@ -705,8 +705,9 @@ enum IntervalUnit{
 }
 
 message Decimal{
-    uint64 whole = 1;
-    uint64 fractional = 2;
+  reserved 1, 2;

Review Comment:
   This is a breaking change to the protobuf serialization of schemas



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035493298


##########
datafusion/sql/src/planner.rs:
##########
@@ -3213,7 +3213,7 @@ mod tests {
             let sql = "SELECT CAST(10 AS DECIMAL(0))";
             let err = logical_plan(sql).expect_err("query should have failed");
             assert_eq!(
-                r##"Internal("Decimal(precision = 0, scale = 0) should satisty `0 < precision <= 38`, and `scale <= precision`.")"##,
+                r##"Internal("Decimal(precision = 0, scale = 0) should satisfy `-38 < precision <= 38`, and `scale <= precision`.")"##,

Review Comment:
   @HaoYang670 I remember we have seen this issue about `SELECT CAST(10 AS DECIMAL(0))` and use the error precision in the SQL



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035734414


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   Spark definitely supports negative scales, it might not expose them in its SQL frontend though



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] HaoYang670 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
HaoYang670 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035494671


##########
datafusion/sql/src/planner.rs:
##########
@@ -3213,7 +3213,7 @@ mod tests {
             let sql = "SELECT CAST(10 AS DECIMAL(0))";
             let err = logical_plan(sql).expect_err("query should have failed");
             assert_eq!(
-                r##"Internal("Decimal(precision = 0, scale = 0) should satisty `0 < precision <= 38`, and `scale <= precision`.")"##,
+                r##"Internal("Decimal(precision = 0, scale = 0) should satisfy `-38 < precision <= 38`, and `scale <= precision`.")"##,

Review Comment:
   The type of `precision` is `usize`, so it should be always `>=0`.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035493777


##########
datafusion/sql/src/utils.rs:
##########
@@ -522,9 +522,12 @@ pub(crate) fn make_decimal_type(
     };
 
     // Arrow decimal is i128 meaning 38 maximum decimal digits
-    if precision == 0 || precision > DECIMAL128_MAX_PRECISION || scale > precision {
+    if precision == 0
+        || precision > DECIMAL128_MAX_PRECISION
+        || scale.unsigned_abs() > precision
+    {
         Err(DataFusionError::Internal(format!(
-            "Decimal(precision = {}, scale = {}) should satisty `0 < precision <= 38`, and `scale <= precision`.",
+            "Decimal(precision = {}, scale = {}) should satisfy `-38 < precision <= 38`, and `scale <= precision`.",

Review Comment:
   the same issue.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1033355115


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   Perhaps @liukun4515 you might be able to cast your eyes over this? My knowledge of decimals is fairly limited



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035493777


##########
datafusion/sql/src/utils.rs:
##########
@@ -522,9 +522,12 @@ pub(crate) fn make_decimal_type(
     };
 
     // Arrow decimal is i128 meaning 38 maximum decimal digits
-    if precision == 0 || precision > DECIMAL128_MAX_PRECISION || scale > precision {
+    if precision == 0
+        || precision > DECIMAL128_MAX_PRECISION
+        || scale.unsigned_abs() > precision
+    {
         Err(DataFusionError::Internal(format!(
-            "Decimal(precision = {}, scale = {}) should satisty `0 < precision <= 38`, and `scale <= precision`.",
+            "Decimal(precision = {}, scale = {}) should satisfy `-38 < precision <= 38`, and `scale <= precision`.",

Review Comment:
   the same issue.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035496939


##########
datafusion/sql/src/planner.rs:
##########
@@ -3213,7 +3213,7 @@ mod tests {
             let sql = "SELECT CAST(10 AS DECIMAL(0))";
             let err = logical_plan(sql).expect_err("query should have failed");
             assert_eq!(
-                r##"Internal("Decimal(precision = 0, scale = 0) should satisty `0 < precision <= 38`, and `scale <= precision`.")"##,
+                r##"Internal("Decimal(precision = 0, scale = 0) should satisfy `-38 < precision <= 38`, and `scale <= precision`.")"##,

Review Comment:
   this is caused by https://github.com/apache/arrow-datafusion/pull/4400/files#r1035496657



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035734414


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   Spark definitely supports negative scales, it might not expose them in its SQL frontend though. I think this PR is consistent with that, the SQL frontend still doesn't support negative scales, but DataFusion the execution engine does



##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   Spark definitely supports negative scales, it might not expose them in its SQL frontend though. I think this PR is consistent with that, the SQL frontend still doesn't support negative scales, but DataFusion the query engine does



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1034941310


##########
datafusion/common/src/dfschema.rs:
##########
@@ -947,12 +946,12 @@ mod tests {
     fn test_dfschema_to_schema_convertion() {
         let mut a: DFField = DFField::new(Some("table1"), "a", DataType::Int64, false);
         let mut b: DFField = DFField::new(Some("table1"), "b", DataType::Int64, false);
-        let mut a_metadata = BTreeMap::new();

Review Comment:
   โค๏ธ  -- thank you



##########
datafusion/core/src/avro_to_arrow/schema.rs:
##########
@@ -280,16 +280,6 @@ fn external_props(schema: &AvroSchema) -> BTreeMap<String, String> {
     props
 }
 
-#[allow(dead_code)]

Review Comment:
   ๐Ÿงน  ๐Ÿ‘ 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035620730


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   > but in the datafusion we can support scale>=0
   
   From an outsiders perspective, at least w.r.t decimals, I think breaking compatibility with the arrow specification in this way would likely be surprising to people. Is there a particular reason to not support negative scale?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 merged pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 merged PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035488883


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   thanks for the mention for me.
   I think arrow ecosystem support negative scale, but in the datafusion we can support `scale>=0`.
   We can add checker in the SQL level to ensure `scale >=0` in the datafusion.
   cc @alamb 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035492782


##########
datafusion/sql/src/planner.rs:
##########
@@ -3213,7 +3213,7 @@ mod tests {
             let sql = "SELECT CAST(10 AS DECIMAL(0))";
             let err = logical_plan(sql).expect_err("query should have failed");
             assert_eq!(
-                r##"Internal("Decimal(precision = 0, scale = 0) should satisty `0 < precision <= 38`, and `scale <= precision`.")"##,
+                r##"Internal("Decimal(precision = 0, scale = 0) should satisfy `-38 < precision <= 38`, and `scale <= precision`.")"##,

Review Comment:
   I'am confused about the error message. 
   The origin message is more reasonable for me, and the precision should be `precision>0 and precision<=38` in the datafusion.
   cc @alamb @tustvold 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ursabot commented on pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#issuecomment-1331906061

   Benchmark runs are scheduled for baseline = 49166ea55f317722ab7a37fbfc253bcd497c1672 and contender = fdc83e8524df30ac5d0ae097572b7c48dc686ba9. fdc83e8524df30ac5d0ae097572b7c48dc686ba9 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/d3bace60f35f46d58c35669211e77724...14d6d0978d0d49059a99568a8e2de4d6/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/f98ff03378c049a2987db6f01cc6543f...3d4efcfc95c44cda8b398997fcd9a7e0/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/b3bd926d5e584d2bb74b6301375c2156...1353381eb2bd42058db5692685edbf29/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/db133002577344858a98b027747e7d95...ea7d7b7ffa9848d1a6fd2908afe2a8bc/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035733041


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   Using the negative scale in the arrow ecosystem is ok for me.
   But in the datafusion(SQL level system), it's better to make consistent with other SQL system, like Spark,PG,MySQL.
   In other SQL level system, I have not seen the usage of negative scale.
   
   In the PG
   ```
   postgres=# create table test(c1 decimal(10,-1));
   ERROR:  NUMERIC scale -1 must be between 0 and precision 10
   LINE 1: create table test(c1 decimal(10,-1));
   ```
   
   In the Spark:
   
   ```
   spark-sql> create table test_d(c1 decimal(10,-1));
   Error in query:
   extraneous input '-' expecting INTEGER_VALUE(line 1, pos 34)
   
   == SQL ==
   create table test_d(c1 decimal(10,-1))
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035489865


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -287,8 +287,8 @@ fn get_wider_decimal_type(
         (DataType::Decimal128(p1, s1), DataType::Decimal128(p2, s2)) => {
             // max(s1, s2) + max(p1-s1, p2-s2), max(s1, s2)
             let s = *s1.max(s2);
-            let range = (p1 - s1).max(p2 - s2);
-            Some(create_decimal_type(range + s, s))
+            let range = (*p1 as i8 - s1).max(*p2 as i8 - s2);

Review Comment:
   In the datafusion, we just support the decimal128, and should make sure the `precision>=1 and precision<=38` and `scale>=0 and scale<=precision`.
   
   Do you have any thoughts for that? @tustvold 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #4400: Update to arrow 28

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4400:
URL: https://github.com/apache/arrow-datafusion/pull/4400#discussion_r1035491442


##########
datafusion/optimizer/src/simplify_expressions/utils.rs:
##########
@@ -108,8 +106,12 @@ pub fn is_one(s: &Expr) -> bool {
         | Expr::Literal(ScalarValue::UInt64(Some(1))) => true,
         Expr::Literal(ScalarValue::Float32(Some(v))) if *v == 1. => true,
         Expr::Literal(ScalarValue::Float64(Some(v))) if *v == 1. => true,
-        Expr::Literal(ScalarValue::Decimal128(Some(v), _p, _s)) => {
-            *_s < DECIMAL128_MAX_PRECISION && POWS_OF_TEN[*_s as usize] == *v
+        Expr::Literal(ScalarValue::Decimal128(Some(v), _p, s)) => {
+            *s >= 0

Review Comment:
   ๐Ÿ‘



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org