You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2021/03/27 16:00:13 UTC

[GitHub] [drill] vvysotskyi commented on a change in pull request #2193: DRILL-7887: JDBC plugin returns incorrect precision for SUM(DECIMAL) queries

vvysotskyi commented on a change in pull request #2193:
URL: https://github.com/apache/drill/pull/2193#discussion_r602735891



##########
File path: contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcRecordReader.java
##########
@@ -210,8 +212,8 @@ public void setup(OperatorContext operatorContext, OutputMutator output) {
         String name = columns.get(i - 1).getRootSegmentPath();
         // column index in ResultSetMetaData starts from 1
         int jdbcType = meta.getColumnType(i);
-        int width = meta.getPrecision(i);
-        int scale = meta.getScale(i);
+        int width = Math.min(meta.getPrecision(i), DRILL_REL_DATATYPE_SYSTEM.getMaxNumericPrecision());

Review comment:
       Very often the precision from the type is much less than the precision of the actual values, so with these changes, Drill will be able to process such values. But if the actual value also has large precision, the exception added below will be thrown, and as pointed in the error message, the user may use `round()` UDF to fix such a case.




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

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