Skip to content

Commit

Permalink
Add ExprToSubfieldFilterParser and allow custom parser registration (f…
Browse files Browse the repository at this point in the history
…acebookincubator#11452)

Summary:
'leafCallToSubfieldFilter' is Presto specific, to adapt to engine like Spark,
this PR adds 'ExprToSubfieldFilterParser' and provides a parser factory which
allows the registration of custom parser.
facebookincubator#11093

Pull Request resolved: facebookincubator#11452

Reviewed By: Yuhta

Differential Revision: D65612043

Pulled By: kevinwilfong

fbshipit-source-id: 91f2cf571f0f2eb6701c01591781f00552fa8b12
  • Loading branch information
rui-mo authored and facebook-github-bot committed Nov 7, 2024
1 parent 396b2bb commit f2e137a
Show file tree
Hide file tree
Showing 5 changed files with 421 additions and 201 deletions.
5 changes: 3 additions & 2 deletions velox/connectors/hive/HiveConnectorUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,9 @@ core::TypedExprPtr extractFiltersFromRemainingFilter(
common::Filter* oldFilter = nullptr;
try {
common::Subfield subfield;
if (auto filter = exec::leafCallToSubfieldFilter(
*call, subfield, evaluator, negated)) {
if (auto filter = exec::ExprToSubfieldFilterParser::getInstance()
->leafCallToSubfieldFilter(
*call, subfield, evaluator, negated)) {
if (auto it = filters.find(subfield); it != filters.end()) {
oldFilter = it->second.get();
filter = filter->mergeWith(oldFilter);
Expand Down
3 changes: 2 additions & 1 deletion velox/dwio/common/MetadataFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ std::unique_ptr<MetadataFilter::Node> MetadataFilter::Node::fromExpression(
try {
Subfield subfield;
auto filter =
exec::leafCallToSubfieldFilter(*call, subfield, evaluator, negated);
exec::ExprToSubfieldFilterParser::getInstance()
->leafCallToSubfieldFilter(*call, subfield, evaluator, negated);
if (!filter) {
return nullptr;
}
Expand Down
Loading

0 comments on commit f2e137a

Please sign in to comment.