Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#280 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python, sql
领域
backend, database

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
1
派生
0
平均合并
1 小时 21 分钟
30 天内合并 PR
128

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

liberation-data/drivine-python 的其他 Issue

查看 liberation-data/drivine-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。