clintropolis opened a new pull request, #14734:
URL: https://github.com/apache/druid/pull/14734
### Description
Part of #14154, this PR sets 'strict booleans' to be on by default, which
homogenizes Druid boolean handling to consistently use `LONG` types internally
and behave in a more SQL compliant manner, particularly with how nulls are
handled in correct tri-state logic. This config was introduced in #11184.
#### Release note
`druid.expressions.useStrictBooleans` is now enabled by default in the code
in Druid 28. If this setting is not explicitly configured in
runtime.properties, upon upgrade clusters will take on new behavior with how
Druid handles boolean types during ingestion and query processing, consistently
using `LONG` types internally for any boolean values which are ingested and as
the output of boolean functions for ingestion transformations and query time
operations.
Previous behavior:
* `100 && 11` -> `11`
* `0.7 || 0.3` -> `0.7`
* `100 && 0` -> `0`
* `'troo' && 'true'` -> `'troo'`
* `'troo' || 'true'` -> `'true'`
New behavior:
* `100 && 11` -> `1`
* `0.7 || 0.3` -> `1`
* `100 && 0` -> `0`
* `'troo' && 'true'` -> `0`
* `'troo' || 'true'` -> `1`
Logical operators will also behave in an SQL compliant manner, treating
nulls as 'unknown' instead of false.
For the "or" operator:
* `true || null`, `null || true` -> `1`
* `false || null`, `null || false`, `null || null`-> `null`
For the "and" operator:
* `true && null`, `null && true`, `null && null` -> `null`
* `false && null`, `null && false` -> `0`
To revert to the default behavior present in Druid 27 and older,
`druid.expressions.useStrictBooleans` may be set to `false` in the
runtime.properties of cluster configuration.
<hr>
This PR has:
- [ ] 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.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code
wherever would not be obvious for an unfamiliar reader.
- [ ] 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]