BOKJUNSOO opened a new pull request, #4505:
URL: https://github.com/apache/arrow-adbc/pull/4505

   ### Summary
   
   PostgreSQL binary COPY represents a `jsonb` field as a version byte followed 
by
   the JSON text. The PostgreSQL driver currently sends the physical string 
storage
   of `extension<arrow.json>` unchanged, so PostgreSQL interprets the first 
JSON byte
   as the version (for example, `{` becomes version 123) and rejects the row.
   
   This adds a target-aware JSONB COPY field writer. When the Arrow source is
   `extension<arrow.json>` and the existing PostgreSQL target column is 
`jsonb`, the
   writer prefixes the JSON bytes with version `0x01` and includes that byte in 
the
   field length. Other string inputs and PostgreSQL `json` targets continue to 
use
   the existing writer.
   
   The existing JSONB ingest regression test now verifies a successful 
round-trip,
   including a SQL NULL value.
   
   ### Testing
   
   - `pre-commit run --files c/driver/postgresql/copy/writer.h 
c/driver/postgresql/postgresql_test.cc` (all applicable C/C++ checks passed)
   - `adbc-driver-postgresql-test` (242 passed, 6 skipped)
   - `adbc-driver-postgresql-copy-test` (73 passed)
   - Loaded 100 `extension<arrow.json>` values from the reported sample Parquet 
file through the locally built driver into a PostgreSQL `jsonb` column without 
a compatibility shim (100 inserted and validated)
   
   Depends on #4499 for resolving existing PostgreSQL target column types during
   COPY writer selection.
   
   Closes #3293
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to