Skip to content

Commit

Permalink
Remove nested structure checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroecheler authored and henneberger committed Oct 13, 2023
1 parent 174ae23 commit d4ce31c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public AnnotatedLP postProcess(@NonNull RelBuilder relBuilder, List<String> fiel
Preconditions.checkArgument(fieldNames.size() == select.getSourceLength());
List<RelDataTypeField> fields = relNode.getRowType().getFieldList();
AnnotatedLP input = this;
if (!topN.isEmpty() && //If any selected field is nested we have to inline topN
if (!topN.isEmpty() && //TODO: remove this condition once we support denormalized data in database
select.targetsAsList().stream().map(fields::get).map(RelDataTypeField::getType)
.anyMatch(CalciteUtil::isNestedTable)) {
input = input.inlineTopN(relBuilder, exec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public RelNode convert(PhysicalTable table, Config config,
private RelNode convert(ProxyImportRelationalTable table, ExecutionAnalysis exec,
boolean addWatermark) {
RelBuilder builder = relBuilder.scan(table.getBaseTable().getNameId());
addColumns(builder, table.getAddedColumns(), SQRLLogicalPlanRewriter.constructIndexMap(table.getBaseTable()
.getRowType()), exec);
addColumns(builder, table.getAddedColumns(), SelectIndexMap.identity(table.getNumColumns(), table.getNumColumns()), exec);
RelNode relNode = builder.build();
if (addWatermark) {
int timestampIdx = table.getTimestamp().getTimestampCandidate().getIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,6 @@ private void addAdditionalColumns(LogicalNestedTable childTable, RelBuilder buil
}
}

public static SelectIndexMap constructIndexMap(RelDataType tableRowType) {
int sourceLength = (int)tableRowType.getFieldList().stream().map(RelDataTypeField::getType)
.filter(Predicate.not(CalciteUtil::isNestedTable)).count();
SelectIndexMap.Builder selectBuilder = SelectIndexMap.builder(sourceLength);
tableRowType.getFieldList().stream().filter(field -> !CalciteUtil.isNestedTable(field.getType()))
.map(RelDataTypeField::getIndex).forEach(selectBuilder::add);
return selectBuilder.build(tableRowType.getFieldCount());
}

private static final SqrlRexUtil.RexFinder FIND_NOW = SqrlRexUtil.findFunction(SqrlRexUtil::isNOW);

@Override
Expand Down

0 comments on commit d4ce31c

Please sign in to comment.