[
https://issues.apache.org/jira/browse/DRILL-7960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17566788#comment-17566788
]
ASF GitHub Bot commented on DRILL-7960:
---------------------------------------
jnturton opened a new pull request, #2597:
URL: https://github.com/apache/drill/pull/2597
# [DRILL-7960](https://issues.apache.org/jira/browse/DRILL-7960): Column
metadata DECIMAL precision can exceed max supported value.
## Description
The calculation of the decimal precision needed to encompass two input
decimal precisions and scales can produce precisions greater than the maximums
supported by Drill. While this does not affect the output vector itself, it
does cause an error if column metadata is built to be included with the result
data, as is done for queries sent over the REST interface. Limit the calculated
precision to the maximum supported value when this happens and log a precision
loss warning.
## Documentation
N/A
## Testing
Manually run the repro query provided in the Jira.
> Column metadata DECIMAL precision can exceed max supported value
> ----------------------------------------------------------------
>
> Key: DRILL-7960
> URL: https://issues.apache.org/jira/browse/DRILL-7960
> Project: Apache Drill
> Issue Type: Bug
> Components: Client - HTTP
> Affects Versions: 1.20.0
> Environment: Drill in Docker
> Parquet Files with VARDECIMAL(29,6)
>
> Reporter: Nick Stenroos-Dam
> Assignee: James Turton
> Priority: Major
> Fix For: 1.20.2
>
>
> We are using a lot of decimals in our data and keep running into issues.
> The latest issue is this error message:
> {code:java}
> SYSTEM ERROR: Drill Remote Exception
> Please, refer to logs for more information.
> (java.lang.IllegalArgumentException) VARDECIMAL(40, 6) exceeds maximum
> suppored precision of 38
> org.apache.drill.exec.record.metadata.MetadataUtils.newDecimal():228
> org.apache.drill.exec.record.metadata.MetadataUtils.fromField():66
>
> org.apache.drill.exec.physical.resultSet.model.single.SingleSchemaInference.inferVector():86
>
> org.apache.drill.exec.physical.resultSet.model.single.SingleSchemaInference.infer():64
> org.apache.drill.exec.physical.rowSet.DirectRowSet.fromContainer():80
>
> org.apache.drill.exec.physical.resultSet.impl.PushResultSetReaderImpl.createRowSet():100
>
> org.apache.drill.exec.physical.resultSet.impl.PushResultSetReaderImpl.start():85
>
> org.apache.drill.exec.server.rest.stream.StreamingHttpConnection.sendData():116
> org.apache.drill.exec.ops.AccountingUserConnection.sendData():43
> org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():106
> org.apache.drill.exec.physical.impl.BaseRootExec.next():93
> org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():323
> org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():310
> .......():0
> org.apache.hadoop.security.UserGroupInformation.doAs():1762
> org.apache.drill.exec.work.fragment.FragmentExecutor.run():310
> org.apache.drill.common.SelfCleaningRunnable.run():38
> .......():0
> {code}
> I have now been able to reproduce the issue.
> Apparently the issue only occurs when using the Web API (query.json) and not
> the Web interface.
> To reproduce the issue run
> {code:java}
> curl -X POST http://localhost:8047/query.json -d '{ "queryType": "SQL",
> "query": "SELECT CAST(10 AS DECIMAL(38, 4)) AS `Col1`\nUNION ALL \nSELECT
> CAST(22 AS DECIMAL(29, 6)) AS `Col1`", "autoLimit": null, "defaultSchema":
> "data" }' -H 'Content-Type: application/json'{code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)