Skip to content

Commit

Permalink
Fix failing union-types tests
Browse files Browse the repository at this point in the history
Don't use original field name, but attribute name, so we don't inadvertently check synthetic attributes for indexed status using their source attribute names.
  • Loading branch information
craigtaverner committed Oct 28, 2024
1 parent 53f7b52 commit 6b8a2c0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private PhysicalPlan rewriteBySplittingFilter(FilterExec filterExec, EvalExec ev

private Map<NameId, StDistance> getPushableDistances(List<Alias> aliases, SearchStats stats) {
Map<NameId, StDistance> distances = new LinkedHashMap<>();
Predicate<FieldAttribute> isIndexed = (fa) -> stats.isIndexed(fa.fieldName());
Predicate<FieldAttribute> isIndexed = (fa) -> stats.isIndexed(fa.name());
aliases.forEach(alias -> {
if (alias.child() instanceof StDistance distance && canPushSpatialFunctionToSource(distance, isIndexed)) {
distances.put(alias.id(), distance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static PhysicalPlan planFilterExec(FilterExec filterExec, EsQueryExec qu
List<Expression> nonPushable = new ArrayList<>();
for (Expression exp : splitAnd(filterExec.condition())) {
Predicate<FieldAttribute> hasIdenticalDelegate = (fa) -> LucenePushDownUtils.hasIdenticalDelegate(fa, ctx.searchStats());
Predicate<FieldAttribute> isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.fieldName());
Predicate<FieldAttribute> isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.name());
(canPushToSource(exp, hasIdenticalDelegate, isIndexed) ? pushable : nonPushable).add(exp);
}
return rewrite(filterExec, queryExec, pushable, nonPushable, List.of());
Expand All @@ -96,7 +96,7 @@ private static PhysicalPlan planFilterExec(
List<Expression> nonPushable = new ArrayList<>();
for (Expression exp : splitAnd(filterExec.condition())) {
Predicate<FieldAttribute> hasIdenticalDelegate = (fa) -> LucenePushDownUtils.hasIdenticalDelegate(fa, ctx.searchStats());
Predicate<FieldAttribute> isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.fieldName());
Predicate<FieldAttribute> isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.name());
Expression resExp = exp.transformUp(ReferenceAttribute.class, r -> aliasReplacedBy.resolve(r, r));
(canPushToSource(resExp, hasIdenticalDelegate, isIndexed) ? pushable : nonPushable).add(exp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class PushTopNToSource extends PhysicalOptimizerRules.ParameterizedOptimi
@Override
protected PhysicalPlan rule(TopNExec topNExec, LocalPhysicalOptimizerContext ctx) {
Predicate<FieldAttribute> hasIdenticalDelegate = (fa) -> LucenePushDownUtils.hasIdenticalDelegate(fa, ctx.searchStats());
Predicate<FieldAttribute> isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.fieldName());
Predicate<FieldAttribute> isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.name());
Pushable pushable = evaluatePushable(topNExec, hasIdenticalDelegate, isIndexed);
return pushable.rewrite(topNExec);
}
Expand Down

0 comments on commit 6b8a2c0

Please sign in to comment.