[Bug]: BigQueryVectorSearchParameters.format_query generates invalid SQL for options and duplicate embedding_column

Đang mở
#41,689 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@arijeetmukherjee3108-droid đang làm issue này rồi.

Từ ngày 25/11/2026.

  • #41690 của @arijeetmukherjee3108-droid — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
18/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python, sql

Hướng nghiên cứu

Start with format_query in sdks/python/apache_beam/ml/rag/enrichment/bigquery_vector_search.py, checking how options is interpolated and how the base subquery selects embedding_column alongside columns. Run the reproduction from the issue to see the generated SQL. Done means options is emitted as a single-quoted JSON string and embedding_column is not duplicated. Pull request #41690 already targets this, so review or coordinate with it rather than starting a parallel fix.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug P2 python
What happened?

BigQueryVectorSearchParameters.format_query() in sdks/python/apache_beam/ml/rag/enrichment/bigquery_vector_search.py generates invalid BigQuery SQL in two cases:

  1. Invalid options clause: BigQuery's VECTOR_SEARCH expects options to be a single-quoted JSON string literal (e.g. options => '{"use_brute_force": true}'). Currently, format_query() interpolates the Python dict directly (f", options => {self.options}"), producing invalid SQL such as:
    , options => {'use_brute_force': True, 'fraction_lists_to_search': 0.01}
    
  2. Duplicate embedding_column in subquery: The base table subquery unconditionally selects (SELECT {columns_str}, {self.embedding_column} ...). If embedding_column is also included in columns, BigQuery receives a duplicate column name (e.g. SELECT content, embedding, embedding).
Reproduction
from apache_beam.ml.rag.enrichment.bigquery_vector_search import BigQueryVectorSearchParameters
from apache_beam.ml.rag.types import Content, EmbeddableItem, Embedding

params = BigQueryVectorSearchParameters(
    project='my-proj',
    table_name='my-proj.ds.tbl',
    embedding_column='embedding',
    columns=['content', 'embedding'],
    neighbor_count=5,
    options={'use_brute_force': True, 'fraction_lists_to_search': 0.01},
)
item = EmbeddableItem(
    id='1',
    content=Content(text='hi'),
    embedding=Embedding(dense_embedding=[0.1, 0.2]),
)
print(params.format_query([item]))
Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components
  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Prism Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
Ngôn ngữ chính
Java
Star
8.7k
Fork
4.8k
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
445

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/beam

Tất cả issue của apache/beam

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.