Github user paul-rogers commented on the issue:
https://github.com/apache/drill/pull/517
As a follow-up, the case we're focusing on is an implicit cast: one created
by the system to convert an integer to a decimal type in order to do an
equality check. To avoid the scale issue, the code that does the explcit cast
should check the type of integer and select a target decimal type that will
hold all values of that int type with a scale of 0. Does the code do that now?
It may be that the decimal type must also be cast so that the equality has the
same types. That is, if we compare Dec9 with Integer, we need a scale of 10 for
the Int, so we must cast the Int to Dec18. As a result, we must cast the Dec9
to Dec18.
The reason for all of this is that the casts are done statically. A more
efficient solution would be for the the run-time code to make a decision based
on actual values, but Drill is not set up that way. Another solution would be
to have an in-memory form of a decimal that caries the precision and scale so
we can set the scale per value. But, Drill is not set up that way either.
So, the change we've been discussing (setting scale based on int and
decimal types, ignoring overflow for now) seems the only short-term solution
for 1.8.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---