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/13 01:00:26 UTC
[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1438: Consolidate decimal error checking and improve error messages
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