diff --git a/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java b/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java index c1d90636f2..f1e7899c64 100644 --- a/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java @@ -53,7 +53,7 @@ public void nested_function_in_select_test() { verifySchema(result, schema("nested(message.info)", null, "keyword"), schema("nested(comment.data)", null, "keyword"), - schema("nested(comment.data)", null, "long")); + schema("nested(message.dayOfWeek)", null, "long")); verifyDataRows(result, rows("a", "ab", 1), rows("b", "aa", 2), diff --git a/sql/src/main/antlr/OpenSearchSQLParser.g4 b/sql/src/main/antlr/OpenSearchSQLParser.g4 index 35a318d1a0..52877ca7c4 100644 --- a/sql/src/main/antlr/OpenSearchSQLParser.g4 +++ b/sql/src/main/antlr/OpenSearchSQLParser.g4 @@ -317,7 +317,7 @@ nestedFunction ; nestedField - : ident DOT ident (DOT ident)* + : nestedIdent DOT nestedIdent (DOT nestedIdent)* ; highlightFunction @@ -624,6 +624,14 @@ ident | scalarFunctionName ; + +nestedIdent + : ID + | BACKTICK_QUOTE_ID + | keywordsCanBeId + | scalarFunctionName + ; + keywordsCanBeId : FULL | FIELD | D | T | TS // OD SQL and ODBC special