clintropolis opened a new pull request, #13214:
URL: https://github.com/apache/druid/pull/13214
### Description
This PR fixes two bugs, the first around the SQL planner for `JSON_VALUE`
queries using the "returning" syntax with SQL `DECIMAL` types incorrectly being
inferred to have a `STRING` output, which prevents them from working correctly
with vectorized math expressions, such as
```JSON_VALUE(x, '$.y' RETURNING DECIMAL) + 100```
They should now correctly be determined to be Druid native `DOUBLE` type
which will allow vectorized math expressions (which require numeric inputs) to
not violate a check.
While writing the test for this issue, I stumbled into another bug, this one
around the fact that vector math processors were not zeroing out 'null' values
in the value vector, which would cause anything downstream that was not
checking the null vector to produce incorrect results from stale values in the
'null' positions. Most typically, this would be when
`druid.generic.useDefaultValueForNull=true` which is also the default mode, but
luckily is fairly unlikely to happen unless expressions were explicitly
producing null values before being used in part of sum or some other thing that
does not check the null vector in default value mode. Numeric nested literal
columns also are impacted by this issue, since they always write out a null
value bitmap even in "default" value mode, because they write out bitmap for
all values, and rely on downstream selectors to just ignore the null vector in
default mode.
<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]