Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Find a search text past 32 KB with CONTAINS on Oracle, where it raises ORA-22828

Đang mở
#280 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 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, sql
Lĩnh vực
backend, database

Hướng nghiên cứu

Start at drivine/cypher/sql/oracle_cypher_compiler.py:890 in contains_text, then inspect the ported drivine4j fix and the Oracle-specific tests. Implement the CLOB handling described in the issue, including its long-search path and Oracle 23 workaround. Port the listed cross-engine cases and SQL pins; done means long search texts return the expected results across parameters, stored properties, writes, grouping and WHERE/reduce use.

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

Mô tả

bug

Port of liberation-data/drivine4j#312 (fix: liberation-data/drivine4j#441).

What happens now. On Oracle, once either side of CONTAINS is longer than 4,000 bytes, both sides are read as CLOBs and checked with INSTR(t, x) > 0. INSTR refuses a search text longer than 32,767 UTF-16 units and raises ORA-22828. The limit counts units, not bytes. So t CONTAINS x with x past 32 KB fails instead of answering.

The code is at drivine/cypher/sql/oracle_cypher_compiler.py:890 (contains_text) on origin/main.

What the drivine4j fix does. The VARCHAR2 arm is unchanged. The CLOB arm binds both CLOBs with bound(), inside a NO_MERGE view (the rule from #370), and then:

  • if either side is null, the answer is null;
  • if the search text is at most 32,767 units, it uses SIGN(INSTR(t, x));
  • if the search text is at least as long as the text, it uses DBMS_LOB.COMPARE for equality;
  • otherwise it runs a MODEL … RULES ITERATE loop. The loop finds each place where the search's first 1,000 units occur, and confirms the whole search there with DBMS_LOB.COMPARE(t, x, LENGTH(x), at, 1).

The CASE gives a number, and that number is compared with 1 outside the subquery. This works around an Oracle 23 defect: compared inside, the MODEL subquery gives FALSE where alone it gives 1. The drivine4j constants are SEARCHED_TEXT (32,767), SEARCHED_PREFIX (1,000) and SEARCHED_PLACES.

Tests to port (CypherQueryCrossEngineTest in drivine4j):

  • "CONTAINS finds a text past 32 KB in a text of any length…". Its cases:

    • 32,767 and 32,768 units, found and not found;
    • long in longer;
    • equal texts;
    • a search longer than the text;
    • a search whose first 1,000 units occur nowhere;
    • '' and null on either side;
    • three-byte characters;
    • surrogate pairs across the 1,000th and 32,767th unit.

    Each case runs as parameters, as stored properties and in a write, three times on one session.

  • The aggregate/grouping-key test and the WHERE/reduce() test.

  • The SQL pins in OracleContainsTextTest.

Ngôn ngữ chính
Python
Star
1
Fork
0
Merge trung bình
1 giờ 21 phút
Pull request đã merge (30 ngày)
128

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 liberation-data/drivine-python

Tất cả issue của liberation-data/drivine-python

Issue tương tự

Thêm issue về Python

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.