hansva opened a new issue, #9420:
URL: https://github.com/apache/hop/issues/9420
### Apache Hop version?
2.20.0
### Java version?
21
### Operating system
Other
### What happened?
A Table output into Oracle fails on the first row when the target table has
a few hundred columns or more. The same pipeline works on 2.19 with the same
JDBC driver. Reported in discussion #9412 for a 577-column table:
Table output.0 - ERROR: Unexpected error
Table output.0 - java.lang.StackOverflowError
at java.base/java.util.TreeMap.getEntry(TreeMap.java:385)
at oracle.jdbc.driver.parser.Matrix.get(Matrix.java:59)
at oracle.jdbc.driver.parser.Earley.tree(Earley.java:778)
at oracle.jdbc.driver.parser.SqlEarley.tree(SqlEarley.java:1212)
at oracle.jdbc.driver.parser.Earley.tree(Earley.java:849)
at oracle.jdbc.driver.parser.SqlEarley.tree(SqlEarley.java:1212)
...
Reducing the commit size does not help, because the failure happens once per
prepared statement, before any row is written.
### Cause
#8446 (fix for #7057) added `OraclePreparedStatementBinding`, which binds
every string by the type of its target column: `setNString` for
NVARCHAR2/NCHAR, and a character stream for CLOB/NCLOB. To learn those types it
calls `PreparedStatement.getParameterMetaData()` and then `getParameterType(i)`
/ `getParameterTypeName(i)` once per statement.
The Oracle thin driver answers those calls by parsing the full SQL statement
on the client, using a recursive Earley parser (`oracle.jdbc.driver.parser`).
The column list and the `VALUES (?, ?, …)` list are recursive grammar rules, so
recursion depth grows linearly with the column count: about two `Earley.tree` +
`SqlEarley.tree` levels per column. On the 1 MB default thread stack of a Linux
JVM, this overflows at roughly 470 columns; the 2 MB default on macOS aarch64
raises the limit.
2.19 never called `getParameterMetaData()`. A plain `prepareStatement` only
does a light lexical scan for bind markers, so the same driver and the same SQL
worked.
`StackOverflowError` is an `Error`, so the existing `catch (SQLException |
RuntimeException e)` fallback to `setString` does not catch it, and the
transform dies.
### How to reproduce
1. Create an Oracle table with 1000 columns (for example 899 ×
VARCHAR2(255), 100 × NVARCHAR2(100), 1 × CLOB).
2. Run a pipeline with a Table output into that table, using a JVM with a 1
MB thread stack (`-Xss1m`, the Linux default).
3. Table output fails with the `StackOverflowError` above.
Verified with ojdbc11 23.9 against Oracle Free 23.
### Issue Priority
Priority: 2
### Issue Component
Component: Database
--
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]