clintropolis opened a new pull request #10219:
URL: https://github.com/apache/druid/pull/10219


   ### Description
   This PR adds a computed `isNullable` property to `ColumnCapabilities` in 
service of allowing segment metadata queries to accurately report which columns 
have null values via the updated `ColumnAnalysis`.
   
   In a follow-up PR, with this information in place, `RowSignature` can be 
expanded to also track the nullable columns, allowing the SQL planner to more 
correctly plan a query based on whether or not a column has nulls instead of 
tying it to `druid.generic.useDefaultValueForNull`. 
`INFORMATION_SCHEMA.COLUMNS` will also correctly set `IS_NULLABLE`. This change 
is moderately disruptive to tests however, so I decided to split it out to keep 
things easy to review.
   
   Other follow-up work to do after this PR is modifying the query engines to 
take advantage of this new information by examining the column capabilities 
instead of using the global value of `druid.generic.useDefaultValueForNull`, 
for example to decide if `NullableNumericAggregator` needs to be employed for 
numeric primitive aggregations to handle null or not.
   
   Longer term, I would like to remove/repurpose 
`druid.generic.useDefaultValueForNull` and make Druid always be in SQL 
compatible mode, and at ingestion time just specify on the dimension specs 
which columns can and cannot have null values and what the default value should 
be (like other databases). I expect a setting will remain once the dust is 
settled on how to handle `null` and `''` for legacy string columns created in 
default mode, but I think it should be possible to transition everywhere else 
to just always operate in SQL compatible null handling mode with little 
disruption.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
      - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to