Skip to content

fix expression plan type inference to correctly handle complex types#12857

Merged
clintropolis merged 1 commit intoapache:masterfrom
clintropolis:fix-complex-expression-type-inference
Aug 4, 2022
Merged

fix expression plan type inference to correctly handle complex types#12857
clintropolis merged 1 commit intoapache:masterfrom
clintropolis:fix-complex-expression-type-inference

Conversation

@clintropolis
Copy link
Copy Markdown
Member

@clintropolis clintropolis commented Aug 4, 2022

Description

Fixes ExpressionPlan.inferColumnCapabilities, which is used by native ExpressionVirtualColumn to infer the output type from the input row signature, and can play a role in determining the output row signature of a query to correctly handle COMPLEX typed expressions (added in #11853). This bug could cause incorrect behavior due to this method making default STRING typed capabilities, causing incorrect selectors to be chosen, which for json columns whose in process values are things like java Map to effectively be calling toString on everything, which for something like JSON_OBJECT(KEY 'a' VALUE 'A', KEY 'b' VALUE 1) would end up with the values as strings appearing like '{a=A, b=1}' instead of actual JSON {"a":"A", "b":1}.

The fix is just to add a short circuit for COMPLEX types so that the default string capabilities are not used.

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 merged commit 73cfc4e into apache:master Aug 4, 2022
@clintropolis clintropolis deleted the fix-complex-expression-type-inference branch August 4, 2022 09:56
@abhishekagarwal87 abhishekagarwal87 added this to the 24.0.0 milestone Aug 26, 2022
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.

4 participants