Skip to content

Commit

Permalink
Replacing udf_metadata_key from string_literal to ID_LITERAL
Browse files Browse the repository at this point in the history
	modified:   evadb/parser/evadb.lark
Removed .value from key_value_pair[0] post the change in type
	modified:   evadb/parser/lark_visitor/_functions.py
Replaced string key to ID_LITERAL in test query
	modified:   test/unit_tests/parser/test_parser.py
  • Loading branch information
hershd23 committed Sep 1, 2023
1 parent 66685f0 commit adbd3f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions evadb/parser/evadb.lark
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ udf_impl: string_literal

udf_metadata: udf_metadata_key udf_metadata_value

udf_metadata_key: string_literal
udf_metadata_key: uid

udf_metadata_value: string_literal | decimal_literal

Expand Down Expand Up @@ -207,7 +207,7 @@ simple_id: ID

dotted_id: DOT_ID | "." uid

// Literals
// Literalss

string_literal: STRING_LITERAL

Expand Down
3 changes: 2 additions & 1 deletion evadb/parser/lark_visitor/_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def create_udf(self, tree):
value = key_value_pair[1]
if isinstance(value, ConstantValueExpression):
value = value.value
metadata.append((key_value_pair[0].value, value)),
# Removing .value from key_value_pair[0] since key is now an ID_LITERAL
metadata.append((key_value_pair[0], value)),

return CreateUDFStatement(
udf_name,
Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def test_create_udf_statement(self):
OUTPUT (Labels NDARRAY STR(10), Bbox NDARRAY UINT8(10, 4))
TYPE Classification
IMPL 'data/fastrcnn.py'
"KEY" "VALUE";
PREDICT "VALUE";
"""

expected_cci = ColConstraintInfo()
Expand Down Expand Up @@ -690,7 +690,7 @@ def test_create_udf_statement(self):
],
"Classification",
None,
[("KEY", "VALUE")],
[("PREDICT", "VALUE")],
)
evadb_statement_list = parser.parse(create_udf_query)
self.assertIsInstance(evadb_statement_list, list)
Expand Down

0 comments on commit adbd3f5

Please sign in to comment.