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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]