Skip to content

Commit

Permalink
#1506: spotless apply
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <andrewc@bitquilltech.com>
  • Loading branch information
acarbonetto committed Aug 14, 2023
1 parent 4d573e6 commit b410e8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
21 changes: 12 additions & 9 deletions core/src/main/java/org/opensearch/sql/analysis/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ public LogicalPlan visitRelation(Relation node, AnalysisContext context) {
dataSourceSchemaIdentifierNameResolver.getIdentifierName());
}
table.getFieldTypes().forEach((k, v) -> curEnv.define(new Symbol(Namespace.FIELD_NAME, k), v));
table.getReservedFieldTypes().forEach(
(k, v) -> curEnv.define(new Symbol(Namespace.HIDDEN_FIELD_NAME, k), v)
);
table
.getReservedFieldTypes()
.forEach((k, v) -> curEnv.define(new Symbol(Namespace.HIDDEN_FIELD_NAME, k), v));

// Put index name or its alias in index namespace on type environment so qualifier
// can be removed when analyzing qualified name. The value (expr type) here doesn't matter.
Expand Down Expand Up @@ -213,12 +213,15 @@ public LogicalPlan visitTableFunction(TableFunction node, AnalysisContext contex
TypeEnvironment curEnv = context.peek();
Table table = tableFunctionImplementation.applyArguments();
table.getFieldTypes().forEach((k, v) -> curEnv.define(new Symbol(Namespace.FIELD_NAME, k), v));
table.getReservedFieldTypes().forEach(
(k, v) -> curEnv.define(new Symbol(Namespace.HIDDEN_FIELD_NAME, k), v)
);
curEnv.define(new Symbol(Namespace.INDEX_NAME,
dataSourceSchemaIdentifierNameResolver.getIdentifierName()), STRUCT);
return new LogicalRelation(dataSourceSchemaIdentifierNameResolver.getIdentifierName(),
table
.getReservedFieldTypes()
.forEach((k, v) -> curEnv.define(new Symbol(Namespace.HIDDEN_FIELD_NAME, k), v));
curEnv.define(
new Symbol(
Namespace.INDEX_NAME, dataSourceSchemaIdentifierNameResolver.getIdentifierName()),
STRUCT);
return new LogicalRelation(
dataSourceSchemaIdentifierNameResolver.getIdentifierName(),
tableFunctionImplementation.applyArguments());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ public Expression visitQualifiedName(QualifiedName node, AnalysisContext context
// check for reserved words in the identifier
for (String part : node.getParts()) {
for (TypeEnvironment typeEnv = context.peek();
typeEnv != null;
typeEnv = typeEnv.getParent()) {
Optional<ExprType> exprType = Optional.ofNullable(
typeEnv.lookupAllFields(Namespace.HIDDEN_FIELD_NAME).get(part));
typeEnv != null;
typeEnv = typeEnv.getParent()) {
Optional<ExprType> exprType =
Optional.ofNullable(typeEnv.lookupAllFields(Namespace.HIDDEN_FIELD_NAME).get(part));
if (exprType.isPresent()) {
return visitMetadata(
qualifierAnalyzer.unqualified(node), (ExprCoreType) exprType.get(), context);
Expand Down

0 comments on commit b410e8d

Please sign in to comment.