ArpeOracle — Data types
How Oracle types map to Apache Arrow on the fetch (read) path, and how Arrow types map back to Oracle on the ingest/bind (write) path.
The non-obvious cases — unconstrained NUMBER has no exact Arrow type, DATE
carries a time component (so it is a timestamp, not date32), TIMESTAMP WITH TIME ZONE collapses to a UTC instant, and INTERVAL types default to
Parquet-writable Arrow types rather than interval (month_day_nano) — are called
out below.
Read path: Oracle → Arrow
Numeric
| Oracle type | Arrow type | Notes |
|---|---|---|
NUMBER(p,0), p ≤ 18 | int64 | Max 999,999,999,999,999,999 < 263; better for every consumer than a zero-scale decimal |
NUMBER(p,0), p 19–38 | decimal128(p,0) | Can exceed int64 |
NUMBER(p,s), s > 0 | decimal128(p,s) | Exact; Oracle's max precision is 38, so decimal256 is never needed |
NUMBER(p,-s), p + s ≤ 38 | decimal128(p+s,0) | A negative scale rounds to 10s: NUMBER(5,-2) holds up to 9,999,900, so decimal128(7,0). Since v0.4.1 (decimal128(p,0) before) |
NUMBER(p,-s), p + s > 38 | as unconstrained NUMBER | No decimal128 holds it; governed by number_mapping. Since v0.4.1 |
NUMBER (unconstrained) | utf8 (default) / float64 / decimal128(P,S) | Governed by number_mapping |
BINARY_INTEGER | as NUMBER above | Same policy path |
BINARY_FLOAT | float32 | |
BINARY_DOUBLE | float64 |
Character & binary
| Oracle type | Arrow type | Notes |
|---|---|---|
VARCHAR2 / CHAR / LONG | utf8 | AL32UTF8 passes through unchanged |
NVARCHAR2 / NCHAR | utf8 | National charset (AL16UTF16) transcoded UTF-16 → UTF-8 |
RAW / LONG RAW | binary | |
ROWID / UROWID | utf8 | Oracle's printable rowid string (the 18-character form ROWIDTOCHAR returns); a logical (index-organized table) UROWID renders as * followed by base-64 |
CLOB | utf8 | up to 4000 characters (UTF-16 code units) arrive in the row; a longer value costs one LOB read round trip after the fetch (since v0.4.1; every value cost two before) |
NCLOB | utf8 | national CLOB, UTF-16 → UTF-8; read like CLOB |
BLOB | binary | up to 4000 bytes in the row; a longer value costs one LOB read round trip |
XMLTYPE | utf8 | The document as text. Binary-XML storage (the default) arrives in the row; CLOB storage (STORE AS CLOB) is read through its LOB locator after the fetch. Since v0.3.12 |
utf8 and binary arrays have 32-bit offsets, so one column holds at most
2 GiB per batch. A batch whose CLOB, NCLOB, BLOB or LOB-stored XMLTYPE
values would pass that ends early, before the row that does not fit, and that
row opens the next batch: batches can then be shorter than batch_size, and the
schema stays utf8/binary. A single LOB value larger than the limit fails the
query with an error naming the column. LONG and LONG RAW values arrive
inside the fetch reply, so their batch cannot be cut: a batch of more than
2 GiB of them fails with an error asking for a smaller
adbc.arpeoracle.batch_size. Since v0.4.1; before that such a query failed.
Temporal
| Oracle type | Arrow type | Notes |
|---|---|---|
DATE | timestamp[s] | Not date32 — Oracle DATE always carries a time component |
TIMESTAMP(n) | timestamp[s|ms|us|ns] | unit follows the column's fractional-seconds precision |
TIMESTAMP(n) WITH TIME ZONE | timestamp[…, tz=UTC] | UTC instant; the original offset or named region is not kept |
TIMESTAMP(n) WITH LOCAL TIME ZONE | timestamp[…, tz=UTC] | wire value is UTC (DBTIMEZONE assumed UTC) |
INTERVAL YEAR TO MONTH | int64 (default) / interval (month_day_nano) | Default is the total number of months; governed by interval_mapping |
INTERVAL DAY TO SECOND | utf8 (default) / interval (month_day_nano) | Default is an ISO-8601 duration string; governed by interval_mapping |
Fractional-seconds precision → unit (for TIMESTAMP and its TZ variants):
| Column precision | Arrow unit |
|---|---|
| 0 | seconds |
| 1–3 | milliseconds |
| 4–6 | microseconds |
| 7–9 | nanoseconds |
Oracle allows up to 9 fractional digits, so the precision is rounded up to the next representable Arrow unit and no precision is lost.
timestamp[ns] is an int64 count of nanoseconds, which only spans
1677-09-21 to 2262-04-11; the coarser units cover every year Oracle stores
(-4712 to 9999). A TIMESTAMP(7..9) value outside that span (a 9999-12-31
"end of time" sentinel, say) fails the query with INVALID_DATA / SQLSTATE
22008 (TIMESTAMP value ... is out of range for timestamp[ns]); it is never
wrapped or turned into NULL. CAST the column to TIMESTAMP(6)
(timestamp[us]) in the query to read such values.
Calendar
Since ArpeOracle v0.4.1. Earlier versions read dates before 1582-10-15 as Gregorian labels, up to 10 days off and more further back.
Arrow timestamps count time on the proleptic Gregorian calendar; Oracle's
DATE and TIMESTAMP use the Julian calendar before 1582-10-15. The driver
converts between the two on read and on write, so a value is the same day on
both sides, not the same label: the Arrow value of an Oracle date is the day
count Oracle itself gives, d - DATE '1970-01-01'. From 1582-10-15 on the two
calendars agree and nothing changes. Before it, Oracle's 1582-10-04 is the
day before 1582-10-15, and Julian leap days such as 1500-02-29 exist (it
reads as the Gregorian 1500-03-10). A BC year -n reads as the astronomical
year -n (n + 1 BC). A fetched date that is not a day of Oracle's calendar
(a 31 February, a day of the 1582 gap, year 0) fails the fetch with
INVALID_DATA / SQLSTATE 22007.
Oracle 23ai native types
Since ArpeOracle v0.2.10, decoded natively on Oracle 23ai / 26ai.
| Oracle type | Arrow type | Notes |
|---|---|---|
BOOLEAN | bool | 23ai native boolean |
JSON | utf8 | Native JSON as JSON text, for a JSON column and for a JSON-typed expression alike (JSON('...'), JSON_OBJECT(... RETURNING JSON), dot notation such as t.doc.a), written as JSON_SERIALIZE writes it. On Oracle 21c too: a JSON column there is utf8 since v0.3.12 and a JSON-typed expression since v0.4.1 (both read as binary before) |
VECTOR | list<float32 | float64 | int8> | 23ai vectors; the element type follows the column's VECTOR format (BINARY reads as list<uint8>, one byte per 8 dimensions). A flexible element format (VECTOR(n, *)) has no fixed Arrow type: see Unsupported columns. Written from Arrow lists since v0.4.4: see Vectors |
VECTOR(n, fmt, SPARSE) | struct<num_dimensions: int64, indices: list<uint32>, values: list<float32 | float64 | int8>> | Sparse vectors (since v0.4.4; the fetch failed before): the dimension count, the 0-based positions of the non-zero elements and their values, in the column's element format, the shape python-oracledb gives its Arrow sparse vectors. A NULL vector is a NULL struct row; an all-zero vector has empty indices and values. ARPEORACLE:type reads VECTOR(1000, FLOAT32, SPARSE) |
Spatial
Since ArpeOracle v0.3.1, on Oracle with the Spatial option.
| Oracle type | Arrow type | Notes |
|---|---|---|
MDSYS.SDO_GEOMETRY | binary + geoarrow.wkb extension | Decoded to little-endian ISO WKB, tagged ARROW:extension:name = geoarrow.wkb so consumers such as GeoPandas or DuckDB spatial treat it as geometry. The stored SDO_SRID (taken from the first non-null geometry in the result) is surfaced as the geoarrow CRS metadata ({"crs_type":"srid","crs":N}), or forced with the arpeoracle.sdo.srid statement option. On read, POINT, LINESTRING, POLYGON (holes included), MULTIPOINT, MULTILINESTRING and MULTIPOLYGON are decoded (any size). The write path below covers the same kinds, in 2D. |
Since v0.4.1, 3D geometries read as ISO WKB Z types, measured (LRS) ones as M
types and 4D ones as ZM types; a 2D optimized rectangle reads as its 5-point
polygon and a point stored in SDO_ORDINATES as a point, as
SDO_UTIL.TO_WKBGEOMETRY returns them; a NULL SDO_POINT with no ordinates
reads as POINT EMPTY. Geometries built by SDO_UTIL.FROM_WKTGEOMETRY /
FROM_WKBGEOMETRY read too.
Since v0.4.4, polygons with interior rings (holes) and the MULTIPOINT /
MULTILINESTRING / MULTIPOLYGON kinds read too (they failed the fetch
before), so everything the ingest path writes reads back. Every ring, part and
point is returned in the order Oracle stores it, so rings keep Oracle's
orientation (counter-clockwise exterior, clockwise interior).
Still out of scope on read, and failing the fetch with an error naming the
geometry type and the reason (SQLSTATE 22018): geometry collections, solids,
circular arcs, circles, compound line strings and polygon rings, oriented
points, 3D optimized rectangles and optimized rectangles next to other rings or
in a multipolygon, a polygon with more than one exterior ring (use a
multipolygon), and a polygon or multipolygon whose first ring is an interior
one.
User-defined objects and collections
Since ArpeOracle v0.4.4. Earlier versions fail a query that selects such a column.
A column of a user-defined OBJECT type reads as an Arrow struct whose fields
are the type's attributes, in declaration order, named as Oracle names them; a
VARRAY or a nested table reads as an Arrow list whose element field is
item. They nest to any depth: an attribute that is itself an object is a
struct, a collection attribute a list, a collection of objects a
list<struct>, a collection of collections a list<list>. The Oracle-supplied
types work the same way (SYS.ODCINUMBERLIST is list<item: utf8>,
SYS.ODCIOBJECT a struct of two strings).
| Oracle | Arrow |
|---|---|
CREATE TYPE addr_t AS OBJECT (street VARCHAR2(40), zip NUMBER(5), city NVARCHAR2(20)) | struct<STREET: utf8, ZIP: int64, CITY: utf8> |
CREATE TYPE num_va AS VARRAY(10) OF NUMBER | list<item: utf8> (unconstrained NUMBER, see number_mapping) |
CREATE TYPE addr_tab AS TABLE OF addr_t | list<item: struct<STREET: utf8, ZIP: int64, CITY: utf8>> |
an object with an addr_t attribute and a num_va attribute | struct<..., ADDR: struct<...>, SCORES: list<item: utf8>> |
An attribute or element of a built-in type maps exactly as a column of that type
would, so number_mapping and interval_mapping apply inside objects too:
NUMBER(p,s) (a negative scale included), INTEGER, FLOAT, BINARY_FLOAT /
BINARY_DOUBLE, VARCHAR2 / CHAR / NVARCHAR2 / NCHAR, RAW, DATE,
TIMESTAMP (with or without time zone), both INTERVAL types and, on 23ai,
BOOLEAN. NULLs are kept at every level: a NULL object is a NULL struct row, an
object whose attributes are all NULL is a valid struct of NULLs, a NULL
collection is a NULL list, an empty one an empty list, and a NULL element a
NULL item. Every field names its Oracle type in
ARPEORACLE:type (SCHEMA.TYPE for the
column and for a nested object or collection, VARCHAR2(40), NUMBER(5), …
for a built-in attribute).
The row carries an object's values but not its attributes' names or types, so
the driver reads the type from the data dictionary (ALL_TYPES,
ALL_TYPE_ATTRS, ALL_COLL_TYPES) once the query has been executed, before
its first row is fetched: a few small queries on the same connection per object
type in the select list. Each type is read once per query, however many
attributes, elements or columns use it. GetTableSchema and ExecuteSchema
report the same struct / list. A cancel that arrives while these queries run,
or between them, stops the statement with CANCELLED.
Refused, with the error naming the column, its type and why (or read as raw
bytes under unsupported_types=binary, see
Unsupported columns):
- a
NOT FINALtype, or an object with an attribute of one: a value may be any of its subtypes, so the struct's shape is not fixed; - an attribute or element that is a
CLOB,NCLOB,BLOBorBFILE, aREF, anXMLTYPE, or an opaque type (SYS.ANYDATA, …); - a type the connected user cannot see in
ALL_TYPES; - a type too large to read: more than 4096 attributes and elements in all, nested ones included, a type used in several places counting once per place (a flat type of 1000 attributes, Oracle's limit, reads); or nested more than 32 levels deep.
Writing objects other than SDO_GEOMETRY is not supported.
Unsupported columns
Since ArpeOracle v0.4.4. Earlier versions have no binary option and fail with
column <name> (Oracle type <n>) is not supported by this driver yet.
A column of a type the driver cannot decode fails the query by default, and
GetTableSchema and ExecuteSchema with it, naming the column, its Oracle type
and what to do instead:
column ADDR has Oracle type SCOTT.ADDRESS_T, which this driver cannot decode;
leave it out of the select list or convert it in SQL, or set
adbc.arpeoracle.unsupported_types=binary to read its raw bytes
With the
adbc.arpeoracle.unsupported_types=binary
database option such a column comes back as Arrow binary instead, holding the
value's raw bytes as the server sent them (NULL stays NULL), so the rest of a
SELECT * is usable. The field metadata names the Oracle type
(ARPEORACLE:type) and carries ARPEORACLE:raw = true, so the bytes are
never taken for a RAW or BLOB column's data. Every other column is
unaffected, and the types the driver decodes (SDO_GEOMETRY, XMLTYPE, …) are
decoded as always.
| Type | Default | unsupported_types=binary |
|---|---|---|
A user-defined OBJECT, VARRAY or nested table the driver cannot decode (a NOT FINAL type, a LOB, REF or XMLTYPE attribute, an opaque type; see User-defined objects and collections) | refused | the object's image as the server sends it |
VECTOR of a flexible element format (VECTOR(n, *), VECTOR(*, *, SPARSE)) | refused | the vector's image as the server sends it |
BFILE | refused | still refused: the row holds only a locator to a file outside the database, not the file's bytes |
REF CURSOR and any type number the driver does not know | refused | still refused: there is no known wire form to read the value by |
Not yet mapped
BFILE— a pointer to a server-filesystem file through aDIRECTORYobject; a different permission model, not a different encoding, so it is refused rather than half-decoded, with or withoutunsupported_types=binary(see Unsupported columns).JSONbefore 21c,BOOLEANbefore 23ai — not native column types on those versions (JSONis stored in a LOB/VARCHAR2with anIS JSONcheck), so such a column decodes as its underlying text/LOB type. The nativeJSONtype (21c and later) andBOOLEAN(23ai) are decoded directly — see Oracle 23ai native types above.- Other types — object types the driver cannot decode (see
User-defined objects and collections)
and any type not listed above — are refused rather than guessed at; see
Unsupported columns for the error and the opt-in
binarypassthrough.
Oracle type name (ARPEORACLE:type)
Since ArpeOracle v0.3.12.
Every field of a result schema (ExecuteQuery, ExecuteSchema and
GetTableSchema alike) carries its Oracle column type in the field metadata
under ARPEORACLE:type, spelled as Oracle spells it in DDL and the data
dictionary: VARCHAR2(100), NUMBER(12,2), FLOAT(126), DATE,
TIMESTAMP(6) WITH TIME ZONE, INTERVAL DAY(4) TO SECOND(6), CLOB, UROWID,
JSON, SYS.XMLTYPE, and on 23ai BOOLEAN, VECTOR(3, FLOAT32) and
VECTOR(*, FLOAT64, SPARSE); an object type is SCHEMA.NAME
(MDSYS.SDO_GEOMETRY, next to its geoarrow.wkb extension keys; a
user-defined object or collection, whose nested fields name their own types).
It tells apart columns that share an Arrow type (VARCHAR2
and CHAR, DATE and TIMESTAMP(0)). String lengths are in characters,
without a BYTE/CHAR suffix, and INTEGER reads NUMBER(38), as Oracle's
own clients report it.
Number Mapping
Oracle's unconstrained NUMBER (no declared precision or scale) is Oracle's default numeric type and has no exact Arrow equivalent.
A fixed decimal128(p,s) cannot be chosen safely (it would truncate high-scale
values and overflow large ones), and an Arrow schema is fixed before the first
batch, so the scale cannot be inferred by looking ahead in the stream. The
adbc.arpeoracle.number_mapping database
option chooses:
| Value | Output | Notes |
|---|---|---|
string (default) | utf8 | Lossless. The deliberate default — a lossy default would silently lose precision on Oracle's most common numeric column. Named string since v0.4.4; auto, its name before, stays accepted as a deprecated alias with the same behaviour (it never inferred a type) |
double | float64 | Fast, lossy — 15–17 significant digits against Oracle's 38 |
decimal:P,S | decimal128(P,S) | For callers who know their data; 1 ≤ P ≤ 38, 0 ≤ S ≤ P |
Constrained columns are unaffected by this option — only unconstrained NUMBER
(and a NUMBER(p,-s) wider than 38 digits) is routed through it. The lossless
default matters in practice: an unconstrained NUMBER can hold values with more
significant digits (21 and beyond) than float64 can represent.
A value that does not fit decimal128(P,S) fails the query; it is never
rounded, truncated or turned into NULL (since v0.4.1; before that such a
value was written unchecked and came back wrong). That is a value of
10P−S or more in magnitude, or one with more than S fractional
digits: under decimal:10,2, 1E20, 100000000 and 1.23456 all fail. The
error is INVALID_DATA with SQLSTATE 22003 and names the column, the row, the
value and the target type, e.g. failed to decode column 0 (N) of row 0: NUMBER value 1.23456 has more fractional digits than decimal128(10,2) holds. The
session and an open transaction survive: the next statement runs on the same
session.
Interval Mapping
Since ArpeOracle v0.3.7. The default changed in v0.3.7 — see the note below.
Arrow's interval(month_day_nano) type has no Parquet
representation, so any Parquet-writing consumer (FastBCP, pandas→parquet, …)
drops or errors on interval columns rendered that way. The default therefore maps
both interval types to Parquet-writable, lossless Arrow types — matching the Arrow
schema FastBCP's regular Oracle driver (oraodp) produces, so the Parquet schema
is identical across connectors. The
adbc.arpeoracle.interval_mapping
database option chooses:
| Value | INTERVAL YEAR TO MONTH | INTERVAL DAY TO SECOND | Notes |
|---|---|---|---|
parquet (default) | int64 (total months) | utf8 (ISO-8601 duration) | Both lossless and Parquet-writable |
native | interval (month_day_nano) | interval (month_day_nano) | Arrow-native, but not Parquet-writable |
The ISO-8601 duration format is [-]P{D}DT{H}H{Mi}M{S}[.frac]S — e.g. a
+4 05:06:07.891011 interval renders as P4DT5H6M7.891011S, and
-1 02:03:04.5 as -P1DT2H3M4.5S.
Before v0.3.7 both interval types defaulted to interval (month_day_nano). A
consumer relying on that output must now set interval_mapping=native to restore
it.
Write path: Arrow → Oracle (ingest & bind)
On prepared-statement bind, Arrow arrays drive positional binds — one Arrow
row is one execution. adbc_ingest (in create / append / replace /
create_append modes, with optional target_db_schema and a
GLOBAL TEMPORARY target, adbc.ingest.temporary) loads by direct path
when the target allows it (since v0.4.0) and otherwise issues an array-bound
INSERT, with a SQL-injection-safe identifier and literal escaper. See
Connection → Ingest method for
the choice and the ingest options.
Table, schema and column names are quoted exactly as given, so they are
case-sensitive: ingesting into my_table creates "my_table", which an
unquoted SELECT … FROM my_table (folded to MY_TABLE) does not find. Use
upper-case names to get ordinary unquoted Oracle identifiers.
When the ingest creates the table (create, replace, or create_append on a
missing table), each Arrow column becomes:
| Arrow type | Oracle column |
|---|---|
bool | NUMBER(1) |
int8 / uint8 | NUMBER(3) |
int16 / uint16 | NUMBER(5) |
int32 / uint32 | NUMBER(10) |
int64 | NUMBER(19) |
uint64 | NUMBER(20) (since v0.4.1; NUMBER(19) before, which could not hold values of 1019 or more) |
float32 | BINARY_FLOAT |
float64 | BINARY_DOUBLE |
decimal32(p,s) / decimal64(p,s) / decimal128(p,s) / decimal256(p,s) | NUMBER(p,s) (decimal32, decimal64 and decimal256 since v0.4.4; a decimal256 with p over 38 is refused, see below) |
utf8 / large_utf8 / string_view | VARCHAR2(4000) (string_view since v0.4.1); CLOB when a value of the first batch is longer than 4000 bytes (since v0.4.4) |
binary / large_binary / binary_view | RAW(2000) (binary_view since v0.4.1); BLOB when a value of the first batch is longer than 2000 bytes (since v0.4.4) |
fixed_size_binary(n) | RAW(n) for n up to 2000, BLOB for a wider one (since v0.4.4; refused before) |
binary tagged geoarrow.wkb | MDSYS.SDO_GEOMETRY |
date32 / date64 | DATE |
timestamp[s|ms|us|ns] | TIMESTAMP(0|3|6|9) |
timestamp[…, tz=…] | TIMESTAMP(0|3|6|9) WITH TIME ZONE |
null | VARCHAR2(1) |
list<float32> / list<float64> / list<int8> (and large_list) | VECTOR(*, FLOAT32) / VECTOR(*, FLOAT64) / VECTOR(*, INT8) (Oracle 23ai and later, since v0.4.4; reads back as the same list) |
fixed_size_list<float32 | float64 | int8>[n] | VECTOR(n, FLOAT32 | FLOAT64 | INT8) (since v0.4.4; reads back as a list) |
Any other Arrow type (float16, a list of another element type, structs,
intervals, …) is rejected with an error naming it. Ingest creates and
loads tables of any width Oracle allows (up to 1,000 columns; since v0.4.1).
The create, the bind and the direct path accept and refuse the same Arrow
input: a decimal (32, 64, 128 or 256 bits) needs a precision of 1 to 38 and a
scale Oracle NUMBER can have (-84 to 127; a decimal128 outside that is
refused since v0.4.1, where the INSERT bind used to store it scaled
wrongly), and a malformed format string is refused rather than partly read.
Every Arrow decimal width is written as NUMBER, with the same result for the
same value. Oracle NUMBER holds 38 digits, so a decimal256 whose precision
is over 38 is refused, naming the column (column "AMOUNT": decimal256 precision 40 … exceeds Oracle NUMBER's maximum precision of 38): cast it to
decimal256(38,s) or decimal128 first. string_view and
binary_view columns (as newer Polars and pyarrow produce) are written exactly
as utf8 and binary are (since v0.4.1).
A dictionary-encoded column is written as its values (since v0.3.12; its
integer indices were written before): it binds, and an ingest creates its
column, exactly as the dictionary's value type would (a
dictionary<int32, utf8> becomes VARCHAR2). A NULL index or a NULL dictionary
entry is a NULL value, and an index outside the dictionary fails the bind.
A date or timestamp outside Oracle's range (years -4712 to 9999) fails the bind
or the load with INVALID_DATA / SQLSTATE 22008, naming the row (counted
from 1) and the column, e.g. row 2, column "WHEN": the date is outside Oracle's range; it is never wrapped into the range (since v0.4.1). Dates
before 1582-10-15 are converted to Oracle's Julian calendar (see
Calendar).
Direct path load
Since ArpeOracle v0.4.0.
A direct path load stores each value exactly as sent, so the driver encodes it
in the target column's type and applies what an INSERT would, with the same
result:
| Target column | Arrow types loaded by direct path | Applied by the driver |
|---|---|---|
NUMBER(p,s), NUMBER, FLOAT(b) | integers, unsigned integers, bool, decimal32 / decimal64 / decimal128 / decimal256, float, double | Rounded half away from zero to scale s (to FLOAT(b)'s significant digits); more than p - s integer digits is refused (as ORA-01438). A double keeps 17 significant digits and a float 9, as Oracle's own conversion does. NaN and infinity are refused. |
BINARY_FLOAT, BINARY_DOUBLE | integers, bool, float, double | — |
DATE | date32, date64, timestamps | Fractional seconds dropped. |
TIMESTAMP(f) | date32, date64, timestamps | Fraction rounded to f digits. |
TIMESTAMP(f) WITH TIME ZONE | timestamps with a time zone | Stored as the UTC instant, offset +00:00. |
VARCHAR2, CHAR | utf8, large_utf8, string_view (AL32UTF8/UTF8 databases only) | Length checked in bytes and, under character semantics, characters; CHAR blank-padded; '' is NULL. |
RAW | binary, large_binary, binary_view, fixed_size_binary | Length checked. |
VECTOR(n | *, FLOAT32 | FLOAT64 | INT8 | *) (dense; since v0.4.4) | list, large_list, fixed_size_list of float32, float64, int8: the column's format, or one that widens to it exactly (int8 into FLOAT32 / FLOAT64, float32 into FLOAT64); any of them into a flexible format (*), which keeps the list's | The dimension count checked against VECTOR(n, ...); 1 to 65535 elements; NaN, infinity and NULL elements refused. |
NOT NULL is checked on every column, and a dictionary-encoded column is
loaded as its values. Other target types (LOBs, LONG, NCHAR/NVARCHAR2,
intervals, TIMESTAMP WITH LOCAL TIME ZONE, SDO_GEOMETRY and other objects,
23ai JSON/BOOLEAN, SPARSE and BINARY vectors) and other Arrow → Oracle
pairs (a string into a NUMBER, binary into VARCHAR2, a float64 list into
a FLOAT32 vector, a float list into an INT8 one) are not loaded by direct
path: with the default auto method the ingest uses INSERT instead, where
Oracle converts as usual.
Vectors
Since ArpeOracle v0.4.4, on Oracle 23ai / 26ai. Earlier versions read VECTOR
columns but refuse to bind or ingest an Arrow list.
An Arrow list, large_list or fixed_size_list of float32, float64 or
int8 is written as a dense VECTOR, by Bind, BindStream and every ingest
method. A list is sent in its own element format, and may be as large as the
largest vector (65535 dimensions). The server converts it to the column's
format and checks its dimension count, as for any INSERT, so a
list<float64> goes into a VECTOR(*, FLOAT32) column, and [1, 2] into a
VECTOR(3, FLOAT32) one fails with the server's ORA-51803. A bound list
works anywhere a vector does, for example as the query vector of
VECTOR_DISTANCE("V", :1, COSINE); the server wants the query vector in the
column's format (ORA-51812 otherwise).
- A NULL list is a NULL vector.
- A NULL element inside a list is refused by the driver before anything is
sent, naming the row (from 1), the column and the element:
row 2, column "V": element 2 of the list is NULL, which a VECTOR cannot hold. - More than 65535 elements are refused by the driver; an empty list is left to the server.
- A list of any other element type (
int16,int32,float16,utf8, …) is refused atBind, as is a dictionary-encoded list. AVECTORcannot be an OUT parameter. - Not written:
SPARSEvectors andBINARYvectors. Oracle 19c has noVECTORtype.
Ingest. create and create_append make VECTOR(*, FLOAT32),
VECTOR(*, FLOAT64) or VECTOR(*, INT8) from the element type, and
VECTOR(n, fmt) from a fixed_size_list[n]. A VECTOR column needs an ASSM
tablespace (ORA-43853 otherwise): the CREATE TABLE names none, so the
user's default tablespace must be one (SYSTEM is not).
Direct path loads vectors natively. Because the server stores a direct
path value as sent, the driver does what an INSERT would: it checks the
column's dimension count and format (see the
direct path table above), refuses NaN and infinity, and
stores the vector's norm exactly as the server computes it for the same
INSERT, so VECTOR_NORM and the COSINE distance read the same values. A
pair the load does not write (a narrowing of the format, a SPARSE or
BINARY column) makes ingest_method=auto use INSERT and direct_path fail
with column "V": Arrow type '+l' cannot be loaded into VECTOR by direct path.
Long string and binary values
Since ArpeOracle v0.4.4. Earlier versions refuse a string over 4000 bytes or a binary value over 2000 bytes.
A string longer than VARCHAR2's 4000 bytes or a binary value longer than
RAW's 2000 bytes binds and loads through the array INSERT path (Bind,
BindStream, ingest with ingest_method=insert, or auto when it falls back
to INSERT). This is how values of any length (tested up to 1 MiB, multibyte
UTF-8 text included) land in CLOB, NCLOB and BLOB columns, in an INSERT
or an UPDATE, with short values, NULLs and other long columns in the same
array and statement. A fixed_size_binary wider than 2000 bytes binds the same
way. No temporary LOB is created and there is no extra round trip.
- The target must be able to hold it. A long value into a
VARCHAR2(4000)orRAW(2000)column fails with the server's error (ORA-01461: can bind a LONG value only for insert into a LONG column, orORA-12899). - SQL expressions take at most 4000 bytes. A long value anywhere other
than a value stored into a column (a
WHEREcomparison, a function argument such asTO_CLOB(:1)) fails withORA-01460: unimplemented or unreasonable conversion requested. - A PL/SQL block takes up to 32767 bytes per string or binary IN parameter
(4000 before v0.4.4); a longer one is refused by the driver before anything
is sent, naming the column. Bind it to an
INSERTorUPDATEinstead.
Ingest. create and create_append decide each string and binary column
from the data: VARCHAR2(4000) / RAW(2000), unless a value of the first
batch (the bound array, or a stream's first batch) is longer, which makes a
CLOB / BLOB column; a fixed_size_binary wider than 2000 bytes is always a
BLOB. The Arrow type does not decide it (large_utf8 with short values stays
VARCHAR2(4000)), so short data keeps the faster, directly loadable columns. A
longer value in a later batch does not fit the VARCHAR2(4000) / RAW(2000)
made for the first one and fails with the server's error; for data whose first
batch is not representative, create the table yourself with CLOB / BLOB
columns and ingest with mode=append, which writes long values into existing
CLOB, NCLOB and BLOB columns.
A direct path load writes no LOB. ingest_method=auto uses the INSERT path
for a table it creates with a CLOB / BLOB column, and, when appending,
falls back to INSERT for a table that has one. ingest_method=direct_path
refuses both: a create before the CREATE TABLE, an append with
column "C": CLOB columns are not supported by direct path load.
OUT and IN OUT parameters
Since ArpeOracle v0.4.4.
A PL/SQL block's OUT and IN OUT parameters are marked in the bound schema with
the field metadata key ORACLE:parameter_type, set to out or inout
(case-insensitive; in, or no key, is an ordinary IN parameter; any other
value is refused at Bind). The statement must be a PL/SQL block (BEGIN ... END; or
DECLARE ...), so a procedure is called as BEGIN proc(:1, :2); END;. As for
every bind, the fields are matched to the distinct placeholders in the order
they first appear in the block, whatever their names or numbers. See
Examples.
- An OUT parameter's bound value is not sent (the block sees
NULL), but its Arrow type is the type its value comes back in. - An IN OUT parameter's value is sent and the value the block leaves in it comes back.
ExecuteQueryreturns the OUT values as the result: one row per bound row, one column per OUT / IN OUT parameter, in parameter order, named and typed as the bind field (the field metadata addsARPEORACLE:type, e.g.NUMBER,VARCHAR2(32767)). IN parameters do not appear.- With several bound rows the block runs once per row, one round trip each, and row k of the result holds row k's OUT values. A server error stops at the failing row and is reported; the rows before it have run (and, with autocommit on, committed).
ExecuteUpdaterefuses OUT parameters (their values are the result); so doBindStream, ingest, and a SQL statement that is not a PL/SQL block. A block that writes to a parameter left IN runs as before; the value the server returns for it is dropped.
| Arrow field type | Bound as | Comes back as |
|---|---|---|
int8 … int64, uint8 … uint64 | NUMBER | the field's integer type; a value with a fraction or out of its range fails (SQLSTATE 22003) |
bool | NUMBER | true for any non-zero value |
float32 / float64 | BINARY_FLOAT / BINARY_DOUBLE | the same |
decimal128(p, s) | NUMBER | decimal128(p, s); a value that does not fit fails (22003) |
utf8 / large_utf8 | VARCHAR2, 32767-byte buffer | the same |
binary / large_binary | RAW, 32767-byte buffer | the same |
date32 / date64 | DATE | the date (date32 drops the time of day) |
timestamp (any unit, with or without zone) | TIMESTAMP / TIMESTAMP WITH TIME ZONE | the field's unit and zone (a zoned value as its UTC instant) |
An OUT or IN OUT string or RAW declares PL/SQL's maximum, 32767 bytes, so an
IN OUT value may be up to 32767 bytes. A value the server had to cut to that
buffer fails the execute with SQLSTATE 22001. Other Arrow types (null,
fixed_size_binary, the view types, decimal32/64/256, dictionary-encoded
fields, geoarrow.wkb) are refused at Bind, naming the column. A
REF CURSOR OUT parameter is not supported: return the cursor with
DBMS_SQL.RETURN_RESULT instead (see
Compatibility → ADBC conformance),
and a block with OUT parameters that also returns implicit results is refused.
Spatial ingest
A geoarrow.wkb Arrow column is ingested as a real MDSYS.SDO_GEOMETRY column —
the inverse of the spatial read path (since v0.3.1). The create-table DDL emits
the SDO_GEOMETRY type, each row's WKB is converted to Oracle's packed object
image and bound as an OBJECT, a geoarrow CRS on the field maps to SDO_SRID,
and — when the ingest itself creates the table — USER_SDO_GEOM_METADATA and a
spatial index are registered. The write path accepts POINT, LINESTRING,
POLYGON with or without interior rings and the MULTIPOINT /
MULTILINESTRING / MULTIPOLYGON kinds, the shapes the read path returns
(since v0.4.4; before that these polygons and multi-part kinds could be
written but not read back), in 2D only. 3D geometries, geometry collections,
and malformed WKB are rejected, with an error naming the row and the reason.
Since v0.4.1:
- An empty geometry (
POINT EMPTY,LINESTRING EMPTY, aPOLYGONorMULTI*with no part) is written as a NULLSDO_GEOMETRY, and an empty part of aMULTI*is dropped. - A polygon ring wound the wrong way for Oracle (a clockwise exterior ring, a counter-clockwise hole, as shapefile-sourced data often has) is reversed, so the stored geometry is valid.
- A PROJJSON CRS (as GeoPandas writes it) gives the SRID of its own top-level
id; the ids of nested parts (datum ensemble members, base CRS) are ignored. - The spatial index is named
<table>_<column>_sidx, shortened with a hash when that is longer than the server's identifier limit. - Oracle Spatial can only index a table whose name reads the same unquoted (an
uppercase ASCII letter, then uppercase ASCII letters, digits,
_,$or#). A spatialcreateorreplaceinto any other name is refused withINVALID_ARGUMENTbefore anything is sent: use such a name, or setarpeoracle.sdo.spatial_indextofalseto load without a spatial index.
See also
- Connection — the
number_mapping,interval_mappingandunsupported_typesoptions - Compatibility — validated Oracle versions
- Examples — reading and ingesting typed data