Skip to content

Test that an Oracle JSON text parameter past 32,767 bytes binds and is read whole, as a CLOB - #621

Open
jasperblues wants to merge 2 commits into
mainfrom
oracle-big-bind
Open

jasperblues wants to merge 2 commits into
mainfrom
oracle-big-bind

Conversation

@jasperblues

Copy link
Copy Markdown
Member

A guard test, ahead of liberation-data/drivine4j#955's root fix. That fix will have the shared compiler bind a large constant list or map literal as a statement parameter, read as JSON(:p) or JSON(:p EXTENDED) on Oracle, so that batches of one shape share one cursor. An APOC replay's batch literal is hundreds of KB.

drivine-python's Oracle host already binds a str longer than 32,767 UTF-8 bytes as a CLOB (OracleConnection._bindable, _MAX_TEXT, through createlob). A list or dict parameter is written as JSON text first, so it takes the same path. A plain str bind in thin python-oracledb (26.0.1) fails past 32,767 bytes with ORA-01460, as checked in a probe, so the CLOB is what makes a large parameter work. This test pins it.

test_oracle_long_json_parameter.py and its unasync sync copy run at 4,000, 4,001, 32,767, 32,768, 100 KB and 1 MB:

  • a JSON list of numbers read with JSON_TABLE(JSON(:p), …);
  • an extended-JSON map of doubles read with JSON(:p EXTENDED), each item still a double;
  • a multibyte text read back whole, sized in bytes;
  • the same list given as a Python list;
  • the same list in Cypher (UNWIND $xs).

Each list text is exactly its size as the host writes it (compact JSON), so the list cases cross 32,767 bytes where the text cases do. All 60 pass on Oracle through the test lock. The test is skipped unless ORACLE_TESTS=true.

No source change. drivine4j and Drivine for TypeScript bind the same way, and have the same test (drivine#925).

Review: 1 pass. It found the list cases' compact JSON fell 2 bytes short of the CLOB line at 32,768, and fixed it, rerun green through the lock. It also checked the multibyte boundary in bytes, the sync copy (unasync --check), and ruff and pyright.

… text, so a list given as a list crosses 32,767 bytes where its text does

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant