Skip to content

Commit

Permalink
changes to the new rules
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshSingla committed Oct 3, 2023
1 parent a6ee632 commit 9620c4e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ public DruidQuery toDruidQuery(final boolean finalizeAggregations)
signature = query.getOutputRowSignature();
}

if (signature.getColumnNames().equals(query.getOutputRowSignature().getColumnNames())) {
dataSources.add(dataSource);
} else {
getPlannerContext().setPlanningError(
"There is a mismatch between the output row signature of input tables and the row signature of union output.");
throw new CannotBuildQueryException(druidRel);
}
dataSources.add(dataSource);

// if (signature.getColumnNames().equals(query.getOutputRowSignature().getColumnNames())) {
// dataSources.add(dataSource);
// } else {
// getPlannerContext().setPlanningError(
// "There is a mismatch between the output row signature of input tables and the row signature of union output.");
// throw new CannotBuildQueryException(druidRel);
// }
}

if (signature == null) {
Expand All @@ -153,9 +155,9 @@ public DruidQuery toDruidQuery(final boolean finalizeAggregations)

// Sanity check: the columns we think we're building off must equal the "unionColumnNames" registered at
// creation time.
if (!signature.getColumnNames().equals(unionColumnNames)) {
throw new CannotBuildQueryException(unionRel);
}
// if (!signature.getColumnNames().equals(unionColumnNames)) {
// throw new CannotBuildQueryException(unionRel);
// }

return partialQuery.build(
new UnionDataSource(dataSources),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ public void onMatch(final RelOptRuleCall call)
call.transformTo(
DruidFreeUnionDataSourceRel.create(
(Union) newUnionRel,
getColumnNames(firstDruidRel, plannerContext).get(),
// getColumnNames(firstDruidRel, plannerContext).get(),
unionRel.getRowType().getFieldNames(),
firstDruidRel.getPlannerContext()
)
);
} else {
call.transformTo(
DruidFreeUnionDataSourceRel.create(
unionRel,
getColumnNames(firstDruidRel, plannerContext).get(),
// getColumnNames(firstDruidRel, plannerContext).get(),
unionRel.getRowType().getFieldNames(),
firstDruidRel.getPlannerContext()
)
);
Expand All @@ -111,7 +113,8 @@ public static boolean isCompatible(
if (!unionRel.all && null != plannerContext) {
plannerContext.setPlanningError("SQL requires 'UNION' but only 'UNION ALL' is supported.");
}
return unionRel.all && isUnionCompatible(first, second, plannerContext);
// return unionRel.all && isUnionCompatible(first, second, plannerContext);
return unionRel.all;
}

/**
Expand Down

0 comments on commit 9620c4e

Please sign in to comment.