-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Corrected Strict NON NULL return type checks #16279
Conversation
...in/java/org/apache/druid/sql/calcite/planner/convertlet/TimeInIntervalConvertletFactory.java
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/expression/ExpressionsTest.java
Fixed
Show fixed
Hide fixed
sql/src/test/java/org/apache/druid/sql/calcite/expression/ExpressionsTest.java
Fixed
Show fixed
Hide fixed
sql/src/test/java/org/apache/druid/sql/calcite/expression/ExpressionsTest.java
Fixed
Show fixed
Hide fixed
sql/src/test/java/org/apache/druid/sql/calcite/expression/ExpressionsTest.java
Fixed
Show fixed
Hide fixed
@@ -45,7 +46,7 @@ public class SubstringOperatorConversion implements SqlOperatorConversion | |||
.operatorBuilder("SUBSTRING") | |||
.operandTypes(SqlTypeFamily.CHARACTER, SqlTypeFamily.INTEGER, SqlTypeFamily.INTEGER) | |||
.functionCategory(SqlFunctionCategory.STRING) | |||
.returnTypeInference(ReturnTypes.ARG0) | |||
.returnTypeInference(ReturnTypes.ARG0.andThen(SqlTypeTransforms.FORCE_NULLABLE)) |
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.
afaik these are appied during calcite planning ; I see some tests in ExpressionTest
; aren't those only excercise the native layer?
@@ -270,6 +270,16 @@ public void testSubstring() | |||
makeExpression("substring(\"spacey\", (\"p\" - 1), \"p\")"), | |||
"hey" | |||
); | |||
testHelper.testExpressionString( |
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.
I've unpatched all non-test changes - and these cases still pass...did I miss something?
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.
I guess these tests here are only running on the native layer. And the issue which we face is more of coming in the calcite layer. Let me change the tests. Thanks for pointing these.
Moreover
select CONTAINS_STRING(null, 'a') -- gives INVALID use of null
select CONTAINS_STRING(dim3, 'a') from numFoo where dim3 is null -- fails the strict check
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
Outdated
Show resolved
Hide resolved
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.
some minor test related notes
Description
aims to fix strict type compare issue (Boolean vs Boolean not null) in TIME_IN_INTERVAL
Key changed/added classes in this PR
TimeInIntervalConvertletFactory.java
ContainsOperatorConversion.java
RegexpLikeOperatorConversion.java
SubstringOperatorConversion.java
This PR has: