Skip to content

Commit

Permalink
fix: removeNullColumn and HashJoin (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
aqni authored Feb 25, 2025
1 parent b3e2f46 commit a22ce17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ protected void consumeUnchecked(Batch batch) {

@Override
protected void consumeEndUnchecked() {
if (data.stream().allMatch(group -> group.getRowCount() == 0)) {
outputSchema = inputSchema;
return;
}
boolean[] isNullColumn = new boolean[inputSchema.getFields().size()];
Arrays.fill(isNullColumn, true);
for (VectorSchemaRoot vectorSchemaRoot : data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,14 @@ private static Filter parseJoinFilter(
if (leftAMatchedIndices.size() == 1 && rightBMatchedIndices.size() == 1) {
pathPairOps.put(
Pair.of(leftAMatchedIndices.get(0), rightBMatchedIndices.get(0)),
Pair.of(filter.getOp(), true));
Pair.of(filter.getOp(), false));
return new AndFilter(Collections.emptyList());
}

if (rightAMatchedIndices.size() == 1 && leftBMatchedIndices.size() == 1) {
pathPairOps.put(
Pair.of(rightAMatchedIndices.get(0), leftBMatchedIndices.get(0)),
Pair.of(filter.getOp(), false));
Pair.of(leftBMatchedIndices.get(0), rightAMatchedIndices.get(0)),
Pair.of(filter.getOp(), true));
return new AndFilter(Collections.emptyList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ private static HashJoinExecutor constructHashJoin(
Pair<Integer, Integer> pathPair = entry.getKey();
Pair<Op, Boolean> opEntry = entry.getValue();
Op op = opEntry.getKey();
boolean keyIsLeft = opEntry.getValue();
if (keyIsLeft) {
boolean operandIsReversed = opEntry.getValue();
if (operandIsReversed) {
matchers.add(
PhysicalFilterUtils.construct(
pathPair.getKey(), pathPair.getValue() + leftSchema.getFieldCount(), op));
pathPair.getValue() + leftSchema.getFieldCount(), pathPair.getKey(), op));
} else {
matchers.add(
PhysicalFilterUtils.construct(
pathPair.getKey() + leftSchema.getFieldCount(), pathPair.getValue(), op));
pathPair.getKey(), pathPair.getValue() + leftSchema.getFieldCount(), op));
}
}
PredicateExpression otherMatcher =
Expand All @@ -151,11 +151,7 @@ private static HashJoinExecutor constructHashJoin(
List<Pair<Integer, Integer>> pathPairEqualOps =
pathPairOps.entrySet().stream()
.filter(entry -> entry.getValue().getKey() == Op.E)
.map(
e ->
e.getValue().getValue()
? e.getKey()
: Pair.of(e.getKey().getRight(), e.getKey().getLeft()))
.map(Map.Entry::getKey)
.collect(Collectors.toList());
ScalarExpression<IntVector> leftHasher =
new CallNode<>(
Expand Down

0 comments on commit a22ce17

Please sign in to comment.