Skip to content
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

fix issue with SQL boolean constants not respecting nulls when strict booleans and sql compatible null handling are enabled #15135

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

clintropolis
Copy link
Member

@clintropolis clintropolis commented Oct 11, 2023

Description

Fixes an issue semi related to #15058, but this dealing specifically with boolean constant expressions, where boolean constants in the SQL layer were effectively not allowed to be null.

The result was incorrect behavior from a query like:

Screenshot 2023-10-10 at 11 40 15 PM

even if druid.expressions.useStrictBooleans was set to true and druid.generic.useDefaultValueForNull set to false. I've modified DruidLogicalValuesRule to check for null values on BOOLEAN types, but only if druid.expressions.useStrictBooleans=true and druid.generic.useDefaultValueForNull=false, resulting in the previous query now producing correct results:

Screenshot 2023-10-10 at 11 38 12 PM

This PR has:

  • been self-reviewed.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • been tested in a test Druid cluster.

@clintropolis clintropolis changed the title fix issue with SQL boolean constants not respecting nulls when strict booleans are enabled fix issue with SQL boolean constants not respecting nulls when strict booleans and sql compatible null handling are enabled Oct 12, 2023
@clintropolis
Copy link
Member Author

ci failure related to coverage in default value mode (since the new code only applies in sql compatible mode)

@clintropolis clintropolis merged commit a0fd9ec into apache:master Oct 12, 2023
66 of 67 checks passed
@clintropolis clintropolis deleted the fix-sql-bool-constants branch October 12, 2023 08:23
clintropolis added a commit to clintropolis/druid that referenced this pull request Oct 13, 2023
… booleans and sql compatible null handling are enabled (apache#15135)
LakshSingla pushed a commit that referenced this pull request Oct 15, 2023
… booleans and sql compatible null handling are enabled (#15135) (#15152)
ektravel pushed a commit to ektravel/druid that referenced this pull request Oct 16, 2023
… booleans and sql compatible null handling are enabled (apache#15135)
CaseyPan pushed a commit to CaseyPan/druid that referenced this pull request Nov 17, 2023
… booleans and sql compatible null handling are enabled (apache#15135)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants