-
Notifications
You must be signed in to change notification settings - Fork 2.4k
SAFE_CAST (enabled for BigQuery) #3093
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
Conversation
core/src/main/java/org/apache/calcite/sql/fun/SqlCastFunction.java
Outdated
Show resolved
Hide resolved
linq4j/src/main/java/org/apache/calcite/linq4j/tree/Expressions.java
Outdated
Show resolved
Hide resolved
Hey @julianhyde if you could take a look at what I've done here: https://github.com/apache/calcite/pull/3093/files#diff-9e0f6e9c4d4f86444e48290b1e613ba700c0854cd614bee4a1912ccb75aed272R1203 @tjbanghart helped me take a look at your suggestion too with using some
but the typing isn't so compatible with |
In future, please use the jira case number in the first commit message and in the title of the PR. (Yes, that requires that you log a jira case before starting work on the bug. That is a good thing.) (Too late to change the first commit message now. That would destroy history.) |
I think
|
linq4j/src/main/java/org/apache/calcite/linq4j/tree/Expressions.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/sql/fun/SqlCastFunction.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/sql/fun/SqlCastFunction.java
Outdated
Show resolved
Hide resolved
I'm still in the middle of cleaning up the PR, thanks for reviewing @zoudan Do you have any thoughts on SqlSyntax.SPECIAL? |
Kudos, SonarCloud Quality Gate passed! |
@olivrlee Can you review my additional commits? I was able to solve the SPECIAL issue |
I did take a look but communicated to Julian offline* |
SAFE_CAST is similar to CAST, except that it returns NULL rather than throwing an error if conversion fails. The Java code generation generates the same code as for CAST, wraps it as a lambda, and converts the exception to Java null. Add a wrapper around SqlOperatorFixture so that existing tests for CAST can also test SAFE_CAST (Julian Hyde). Close #3093 Co-authored-by: Oliver Lee <[email protected]> Co-authored-by: Julian Hyde <[email protected]>
SAFE_CAST is similar to CAST, except that it returns NULL rather than throwing an error if conversion fails. The Java code generation generates the same code as for CAST, wraps it as a lambda, and converts the exception to Java null. Add a wrapper around SqlOperatorFixture so that existing tests for CAST can also test SAFE_CAST (Julian Hyde). Close apache#3093 Co-authored-by: Oliver Lee <[email protected]> Co-authored-by: Julian Hyde <[email protected]>
SAFE_CAST is similar to CAST, except that it returns NULL rather than throwing an error if conversion fails. The Java code generation generates the same code as for CAST, wraps it as a lambda, and converts the exception to Java null. Add a wrapper around SqlOperatorFixture so that existing tests for CAST can also test SAFE_CAST (Julian Hyde). Close apache#3093 Co-authored-by: Oliver Lee <[email protected]> Co-authored-by: Julian Hyde <[email protected]>
https://issues.apache.org/jira/browse/CALCITE-5557