-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(spark): add MakeDecimal support #298
Conversation
0346df2
to
9938575
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems pretty reasonable overall. There's likely always going to be functions that require some form of special handling. Once we accumulate more we can think about patterns to make it easier to work with them.
I did leave one comment about the matching logic for it though.
case "make_decimal" => expr.outputType match { | ||
// Need special case handing of this internal function (not nice, I know). | ||
// Because the precision and scale arguments are extracted from the output type, | ||
// we can't use the generic scalar function conversion mechanism here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not nice, I know)
This seems perfectly reasonable tbh.
throw new IllegalArgumentException(msg) | ||
}) | ||
expr.declaration.name match { | ||
case "make_decimal" => expr.outputType match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being pedantic, this should also check the uri
of the declaration if it's feasible to avoid applying special handling to an externally defined make_decimal
function.
The Spark query optimiser injects an internal function (MakeDecimal) when numeric literals appear in a query. This commit adds support for this, which drastically improves the pass rate for the TPC-DS test suite. Signed-off-by: Andrew Coleman <[email protected]>
9938575
to
3407186
Compare
The Spark query optimiser injects an internal function (MakeDecimal) when numeric literals appear in a query. This commit adds support for this, which drastically improves the pass rate for the TPC-DS test suite.