Skip to content

Commit

Permalink
fix the error usage of HierarchyFieldIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyyes authored Sep 4, 2024
1 parent b9cc8f9 commit eb6a5d3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

import static java.util.Objects.requireNonNull;

Expand Down Expand Up @@ -139,20 +138,12 @@ protected RelationPlan visitTable(Table table, Void context) {
qualifiedName.getPrefix().map(QualifiedName::toString).orElse(null),
qualifiedName.getSuffix());

Set<String> usedColumns = analysis.getUsedColumns(qualifiedObjectName);

// on the basis of that the order of fields is same with the column category order of segments
// in DeviceEntry
Map<Symbol, Integer> idAndAttributeIndexMap = new HashMap<>();
int idIndex = 0;
for (Field field : fields) {
TsTableColumnCategory category = field.getColumnCategory();
// only keep used columns and all ID columns
if (category != TsTableColumnCategory.ID
&& field.getOriginColumnName().isPresent()
&& !usedColumns.contains(field.getOriginColumnName().get())) {
continue;
}
Symbol symbol = symbolAllocator.newSymbol(field);
outputSymbolsBuilder.add(symbol);
symbolToColumnSchema.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,7 @@ public Optional<Symbol> getSymbolForColumn(Expression expression) {
ResolvedField field = analysis.getColumnReferenceFields().get(NodeRef.of(expression));

if (scope.isLocalScope(field.getScope())) {
if (field.getField().getOriginColumnName().isPresent()) {
return Optional.of(Symbol.of(field.getField().getOriginColumnName().get()));
} else {
return Optional.of(fieldSymbols[field.getHierarchyFieldIndex()]);
}
return Optional.of(fieldSymbols[field.getHierarchyFieldIndex()]);
}

if (outerContext.isPresent()) {
Expand Down

0 comments on commit eb6a5d3

Please sign in to comment.