Skip to content

Commit 72f411f

Browse files
committed
address comments
1 parent 4012928 commit 72f411f

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

bigframes/core/sql.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def ordering_clause(
173173

174174
def create_vector_search_sql(
175175
sql_string: str,
176-
options: Mapping[str, Union[str, int, float, Iterable[str]]] = {},
176+
options: Mapping[str, Union[str | int | bool | float]] = {},
177177
) -> str:
178178
"""Encode the VECTOR SEARCH statement for BigQuery Vector Search."""
179179

@@ -191,11 +191,11 @@ def create_vector_search_sql(
191191
distance,
192192
FROM VECTOR_SEARCH(
193193
TABLE `{base_table}`,
194-
"{column_to_search}",
194+
{simple_literal(column_to_search)},
195195
({sql_string}),
196-
"{query_column_to_search}",
197-
distance_type => "{distance_type}",
198-
top_k => {top_k}
196+
{simple_literal(query_column_to_search)},
197+
distance_type => {simple_literal(distance_type)},
198+
top_k => {simple_literal(top_k)}
199199
)
200200
"""
201201
else:
@@ -206,10 +206,10 @@ def create_vector_search_sql(
206206
distance,
207207
FROM VECTOR_SEARCH(
208208
TABLE `{base_table}`,
209-
"{column_to_search}",
209+
{simple_literal(column_to_search)},
210210
({sql_string}),
211-
distance_type => "{distance_type}",
212-
top_k => {top_k}
211+
distance_type => {simple_literal(distance_type)},
212+
top_k => {simple_literal(top_k)}
213213
)
214214
"""
215215
return query_str

tests/unit/core/test_sql.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def test_create_vector_search_sql_simple():
3333
distance,
3434
FROM VECTOR_SEARCH(
3535
TABLE `my_base_table`,
36-
"my_embedding_column",
36+
'my_embedding_column',
3737
({sql_string}),
38-
distance_type => "COSINE",
38+
distance_type => 'COSINE',
3939
top_k => 10
4040
)
4141
"""
@@ -63,11 +63,11 @@ def test_create_vector_search_sql_query_column_to_search():
6363
base.*,
6464
distance,
6565
FROM VECTOR_SEARCH(
66-
TABLE `my_base_table`,
67-
"my_embedding_column",
66+
TABLE my_base_table,
67+
'my_embedding_column',
6868
({sql_string}),
69-
"new_embedding_column",
70-
distance_type => "COSINE",
69+
'new_embedding_column',
70+
distance_type => 'COSINE',
7171
top_k => 10
7272
)
7373
"""

0 commit comments

Comments
 (0)