Skip to content

Commit

Permalink
only include tv_expr when necessary during create index
Browse files Browse the repository at this point in the history
  • Loading branch information
jiashenC committed Oct 2, 2023
1 parent 9cca828 commit 8a80a14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion evadb/parser/lark_visitor/_create_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ def create_index(self, tree):
while not isinstance(index_elem, TupleValueExpression):
index_elem = index_elem.children[0]
index_elem = [index_elem]
else:
project_expr_list += index_elem

# Add tv_expr for projected columns.
col_list = []
for tv_expr in index_elem:
project_expr_list += [tv_expr]
col_list += [ColumnDefinition(tv_expr.name, None, None, None)]

return CreateIndexStatement(
Expand Down
6 changes: 3 additions & 3 deletions test/unit_tests/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_create_index_statement(self):
ColumnDefinition("featCol", None, None, None),
],
VectorStoreType.FAISS,
[TupleValueExpression(name="*")],
[TupleValueExpression(name="featCol")],
)
actual_stmt = evadb_stmt_list[0]
self.assertEqual(actual_stmt, expected_stmt)
Expand All @@ -128,7 +128,7 @@ def test_create_index_statement(self):
ColumnDefinition("featCol", None, None, None),
],
VectorStoreType.FAISS,
[TupleValueExpression(name="*")],
[TupleValueExpression(name="featCol")],
)
create_index_query = (
"CREATE INDEX IF NOT EXISTS testindex ON MyVideo (featCol) USING FAISS;"
Expand Down Expand Up @@ -160,7 +160,7 @@ def test_create_index_statement(self):
ColumnDefinition("featCol", None, None, None),
],
VectorStoreType.FAISS,
[TupleValueExpression(name="*"), func_expr],
[func_expr],
)
actual_stmt = evadb_stmt_list[0]
self.assertEqual(actual_stmt, expected_stmt)
Expand Down

0 comments on commit 8a80a14

Please sign in to comment.