Skip to content

Handling nil selector column in vector math processors#16128

Merged
clintropolis merged 8 commits intoapache:masterfrom
sreemanamala:math-processors
Apr 2, 2024
Merged

Handling nil selector column in vector math processors#16128
clintropolis merged 8 commits intoapache:masterfrom
sreemanamala:math-processors

Conversation

@sreemanamala
Copy link
Copy Markdown
Contributor

@sreemanamala sreemanamala commented Mar 15, 2024

Description

Currently If a segment does not have a column, then an math expression processor triggered on that segment involving that column is resulting in a Unable to vectorize expression exception.
This PR aims to fix these by defaulting the input type to double type.


Key changed/added classes in this PR
  • VectorMathProcessors
  • Function
  • VectorExprSanityTest

This PR has:

  • been self-reviewed.
  • 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
  • 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 is met.
  • added integration tests.
  • been tested in a test Druid cluster.

} else if (inputType.is(ExprType.DOUBLE)) {
processor = doubleOutDoubleInSupplier.get();
}
if (inputType == null || inputType.is(ExprType.DOUBLE)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use Types.isNullOr(inputType, ExprType.DOUBLE), same for other lines

return inspector.areNumeric(args) && inspector.canVectorize(args);
final ExpressionType outputType = args.get(0).getOutputType(inspector);
if (outputType == null && NullHandling.replaceWithDefault()) {
return false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth leaving a comment about why this is the case. something about how non-vectorized treats null values as STRING types, which makes it kind of complicated to achieve consistent behavior for vector and non-vector engines

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@clintropolis clintropolis merged commit 26f9b17 into apache:master Apr 2, 2024
@sreemanamala sreemanamala deleted the math-processors branch April 3, 2024 16:31
@adarshsanjeev adarshsanjeev added this to the 30.0.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants