From e5221ba09029ca55d79dbb9309de43ee737e0241 Mon Sep 17 00:00:00 2001 From: forestmvey Date: Wed, 22 Mar 2023 08:40:47 -0700 Subject: [PATCH] Fixing qualified name tests with nested. Fixing type with NestedFunction. Signed-off-by: forestmvey --- .../org/opensearch/sql/expression/nested/NestedFunction.java | 2 +- .../test/java/org/opensearch/sql/analysis/AnalyzerTest.java | 4 ---- .../java/org/opensearch/sql/sql/parser/AstBuilderTest.java | 2 +- .../opensearch/sql/sql/parser/AstExpressionBuilderTest.java | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/opensearch/sql/expression/nested/NestedFunction.java b/core/src/main/java/org/opensearch/sql/expression/nested/NestedFunction.java index 26be064712..480f86c5f4 100644 --- a/core/src/main/java/org/opensearch/sql/expression/nested/NestedFunction.java +++ b/core/src/main/java/org/opensearch/sql/expression/nested/NestedFunction.java @@ -33,6 +33,6 @@ public ExprValue valueOf(Environment valueEnv) { @Override public ExprType type() { - return this.arguments.get(0).type(); + return this.arguments.get(0).type(); } } diff --git a/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java b/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java index 118f1cd6b0..69e9719afb 100644 --- a/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java +++ b/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java @@ -406,10 +406,6 @@ public void project_nested_field_arg() { function("nested", qualifiedName("message", "info")), null) ) ); - - Map fieldPathMap = Map.of( - "field", new ReferenceExpression("message.info", STRING), - "path", new ReferenceExpression("message", STRING)); } @Test diff --git a/sql/src/test/java/org/opensearch/sql/sql/parser/AstBuilderTest.java b/sql/src/test/java/org/opensearch/sql/sql/parser/AstBuilderTest.java index adfa1ccb29..3217153f09 100644 --- a/sql/src/test/java/org/opensearch/sql/sql/parser/AstBuilderTest.java +++ b/sql/src/test/java/org/opensearch/sql/sql/parser/AstBuilderTest.java @@ -697,7 +697,7 @@ public void can_build_nested_select_field() { relation("test"), alias( "message.info", - function("nested", qualifiedName("message.info")), + function("nested", qualifiedName("message", "info")), null ) ), diff --git a/sql/src/test/java/org/opensearch/sql/sql/parser/AstExpressionBuilderTest.java b/sql/src/test/java/org/opensearch/sql/sql/parser/AstExpressionBuilderTest.java index 012e341d3b..07d7d8250e 100644 --- a/sql/src/test/java/org/opensearch/sql/sql/parser/AstExpressionBuilderTest.java +++ b/sql/src/test/java/org/opensearch/sql/sql/parser/AstExpressionBuilderTest.java @@ -216,7 +216,7 @@ public void canBuildGetFormatFunctionCall() { public void canBuildNestedFunctionWithFieldParam() { assertEquals( new Alias("message.info", - function("nested", qualifiedName("message.info"))), + function("nested", qualifiedName("message","info"))), buildExprAst("nested(message.info)") ); } @@ -226,7 +226,7 @@ public void canBuildNestedFunctionWithFieldAndPathParams() { assertEquals( new Alias("message.info", function("nested", - qualifiedName("message.info"), + qualifiedName("message", "info"), qualifiedName("message"))), buildExprAst("nested(message.info, message)") );