Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling nil selector column in vector math processors #16128

Merged
merged 8 commits into from
Apr 2, 2024

Conversation

sreemanamala
Copy link
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
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
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
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
85 checks passed
@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