[ 
https://issues.apache.org/jira/browse/DRILL-7887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17309980#comment-17309980
 ] 

ASF GitHub Bot commented on DRILL-7887:
---------------------------------------

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:
[email protected]


> JDBC plugin returns incorrect precision for SUM(DECIMAL) queries
> ----------------------------------------------------------------
>
>                 Key: DRILL-7887
>                 URL: https://issues.apache.org/jira/browse/DRILL-7887
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.19.0
>            Reporter: Vova Vysotskyi
>            Assignee: Vova Vysotskyi
>            Priority: Major
>             Fix For: 1.19.0
>
>
> The following query:
> {code:sql}
> SELECT sum(decimal_field * smallint_field) AS `order_total`
> FROM mysql.`drill_mysql_test`.person e
> {code}
> returns {{order_total}} field with {{DECIMAL(42, 2)}} type, but Drill 
> supports max presision of 38.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to