-
Notifications
You must be signed in to change notification settings - Fork 3.7k
allow Expr to provide optimized BitmapColumnIndex implementations to optimize ExpressionFilter #18094
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
base: master
Are you sure you want to change the base?
Conversation
…optimize ExpressionFilter changes: * added `asBitmapColumnIndex` method to `Expr`, pushing down the default implementation of `ExpressionFilter.getBitmapColumnIndex` into this new method * added `asColumnIndexSupplier` and `asBitmapColumnIndex` to `Function` interface, to allow `Expr` that use `Function` to further specialize participation in filtering * `ExpressionFilter` now completely delegates to `Expr` for its `getBitmapColumnIndex` method * Moved predicate factory out of `ExpressionFilter` to standalone `ExpressionDruidPredicateFactory` since it is now used by the default implementation of `Expr.asBitmapColumnIndex` * added implementation of `asBitmapColumnIndex` to `BinEqExpression` so that the equals expression can use `ValueIndex` (except for string columns matching numeric values since that requires predicate indexes) * added implementation of `asBitmapColumnIndex` to `MvOverlapConstantArray` function to allow it use to `ValueSetIndex` with a string match value type
*/ | ||
@Nullable | ||
default ColumnIndexSupplier asColumnIndexSupplier( | ||
ColumnIndexSelector selector, |
Check notice
Code scanning / CodeQL
Useless parameter Note
@Nullable | ||
default ColumnIndexSupplier asColumnIndexSupplier( | ||
ColumnIndexSelector selector, | ||
@Nullable ColumnType outputType, |
Check notice
Code scanning / CodeQL
Useless parameter Note
default ColumnIndexSupplier asColumnIndexSupplier( | ||
ColumnIndexSelector selector, | ||
@Nullable ColumnType outputType, | ||
List<Expr> args |
Check notice
Code scanning / CodeQL
Useless parameter Note
} | ||
} | ||
return null; | ||
return expr.get().asBitmapColumnIndex(selector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
|
||
@Nullable | ||
@Override | ||
public BitmapColumnIndex asBitmapColumnIndex(ColumnIndexSelector selector, List<Expr> args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What testing strategy do you have in mind for stuff like this? I suppose we could add items to ExpressionFilterTest
. But ideally it would be possible to test them in FunctionTest
. What do you think about extending that to have an assertBooleanExpr
that calls asBitmapColumnIndex
with an index selector that has indexes for the bindings?
With that, I'd also suggest updating assertExpr
to check if the expr has a boolean return type, and throw if it does (so they all get moved to assertBooleanExpr
).
Description
changes:
asBitmapColumnIndex
method toExpr
, pushing down the default implementation ofExpressionFilter.getBitmapColumnIndex
into this new methodasColumnIndexSupplier
andasBitmapColumnIndex
toFunction
interface, to allowExpr
that useFunction
to further specialize participation in filteringExpressionFilter
now completely delegates toExpr
for itsgetBitmapColumnIndex
methodExpressionFilter
to standaloneExpressionDruidPredicateFactory
since it is now used by the default implementation ofExpr.asBitmapColumnIndex
asBitmapColumnIndex
toBinEqExpression
so that the equals expression can useValueIndex
(except for string columns matching numeric values since that requires predicate indexes)asBitmapColumnIndex
toMvOverlapConstantArray
function to allow it use toValueSetIndex
with a string match value typeThis PR has: