diff --git a/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java b/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java index 3719d95c30..6e008e6fd3 100644 --- a/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java +++ b/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java @@ -132,8 +132,6 @@ public class Analyzer extends AbstractNodeVisitor private final BuiltinFunctionRepository repository; - private static final String PATH_SEPARATOR = "."; - /** Constructor. */ public Analyzer( ExpressionAnalyzer expressionAnalyzer, @@ -459,7 +457,6 @@ public LogicalPlan visitEval(Eval node, AnalysisContext context) { * Builds and returns a {@link org.opensearch.sql.planner.logical.LogicalFlatten} corresponding to * the given flatten node. */ - @SuppressWarnings("NonConstantStringShouldBeStringBuffer") @Override public LogicalPlan visitFlatten(Flatten node, AnalysisContext context) { LogicalPlan child = node.getChild().getFirst().accept(this, context); @@ -522,10 +519,11 @@ public LogicalPlan visitFlatten(Flatten node, AnalysisContext context) { TypeEnvironment env = context.peek(); Map fieldsMap = env.lookupAllTupleFields(Namespace.FIELD_NAME); - final String fieldDescendantPath = fieldName + PATH_SEPARATOR; + final String pathSeparator = "."; + final String fieldDescendantPath = fieldName + pathSeparator; final Optional fieldParentPath = - fieldName.contains(PATH_SEPARATOR) - ? Optional.of(fieldName.substring(0, fieldName.lastIndexOf(PATH_SEPARATOR))) + fieldName.contains(pathSeparator) + ? Optional.of(fieldName.substring(0, fieldName.lastIndexOf(pathSeparator))) : Optional.empty(); for (String path : fieldsMap.keySet()) { @@ -538,7 +536,7 @@ public LogicalPlan visitFlatten(Flatten node, AnalysisContext context) { // Build the new path. String newPath = path.substring(fieldDescendantPath.length()); if (fieldParentPath.isPresent()) { - newPath = fieldParentPath.get() + PATH_SEPARATOR + newPath; + newPath = fieldParentPath.get() + pathSeparator + newPath; } ExprType type = fieldsMap.get(path); diff --git a/core/src/test/java/org/opensearch/sql/planner/DefaultImplementorTest.java b/core/src/test/java/org/opensearch/sql/planner/DefaultImplementorTest.java index a56a014d55..7fe3a473d9 100644 --- a/core/src/test/java/org/opensearch/sql/planner/DefaultImplementorTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/DefaultImplementorTest.java @@ -330,7 +330,7 @@ public void visitTrendline_should_build_TrendlineOperator() { } @Test - void visitFlatten_should_build_FlattenOperator() { + public void visitFlatten_should_build_FlattenOperator() { // Mock physical and logical plan children. var logicalChild = mock(LogicalPlan.class);