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 2021/12/12 21:55:02 UTC

[GitHub] [arrow-datafusion] alamb opened a new pull request #1438: Consolidate decimal error checking and improve error messages

alamb opened a new pull request #1438:
URL: https://github.com/apache/arrow-datafusion/pull/1438


   
   # Rationale:
   As suggested by @Dandandan and @liukun4515, there is a bit of duplication and an error message mismatch: https://github.com/apache/arrow-datafusion/pull/1431/files#r766728006
   
   # Changes
   Pull decimal precision error checking into a siingle function
   


-- 
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 change in pull request #1438: Consolidate decimal error checking and improve error messages

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1438:
URL: https://github.com/apache/arrow-datafusion/pull/1438#discussion_r767357853



##########
File path: datafusion/src/sql/utils.rs
##########
@@ -503,6 +505,33 @@ pub(crate) fn group_window_expr_by_sort_keys(
     Ok(result)
 }
 
+/// Returns a validated `DataType` for the specified precision and
+/// scale
+pub(crate) fn make_decimal_type(
+    precision: Option<u64>,
+    scale: Option<u64>,
+) -> Result<DataType> {
+    match (precision, scale) {
+        (None, _) | (_, None) => {
+            return Err(DataFusionError::Internal(format!(
+                "Decimal(precision, scale) must both be specified, got ({:?}, {:?})",
+                precision, scale
+            )));
+        }
+        (Some(p), Some(s)) => {
+            // Arrow decimal is i128 meaning 38 maximum decimal digits

Review comment:
       good




-- 
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 merged pull request #1438: Consolidate decimal error checking and improve error messages

Posted by GitBox <gi...@apache.org>.
alamb merged pull request #1438:
URL: https://github.com/apache/arrow-datafusion/pull/1438


   


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