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

fix: removeNullColumn and HashJoin #580

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading