Skip to content

feat: Oracle connector enhancements#25355

Open
Dilli-Babu-Godari wants to merge 5 commits intoprestodb:masterfrom
Dilli-Babu-Godari:oracle_oss_pr
Open

feat: Oracle connector enhancements#25355
Dilli-Babu-Godari wants to merge 5 commits intoprestodb:masterfrom
Dilli-Babu-Godari:oracle_oss_pr

Conversation

@Dilli-Babu-Godari
Copy link
Copy Markdown
Contributor

@Dilli-Babu-Godari Dilli-Babu-Godari commented Jun 18, 2025

Description

Oracle connector enhancements.

Motivation and Context

Impact

Test Plan

presto> CREATE TABLE oracle.tm_lakehouse_engine.orcaemp2 (
     ->     empid DOUBLE,
     ->     empname VARCHAR(255),
     ->     empbandcode DOUBLE,
     ->     location DOUBLE,
     ->     empdepcode DOUBLE,
     ->     address VARCHAR(255),
     ->     email VARCHAR(255),
     ->     ssn VARCHAR(255),
     ->     phone VARCHAR(255)
     -> );
CREATE TABLE

Query 20260326_071832_00019_85sxf, FINISHED, 0 nodes
http://localhost:8080/ui/query.html?20260326_071832_00019_85sxf
Splits: 0 total, 0 done (0.00%)
[Latency: client-side: 0:12, server-side: 0:12] [0 rows, 0B] [0 rows/s, 0B/s]


presto> INSERT INTO oracle.tm_lakehouse_engine.orcaemp2
     ->     (empid, empname, empbandcode, location, empdepcode, address, email, ssn, phone)
     -> VALUES
     ->     (1.0, 'John Doe', 3.0, 101.0, 20.0, '123 Main St, New York, NY', 'john.doe@example.com', '123-45-6789', '555-123-4567');

Query 20260326_071911_00020_85sxf, RUNNING, 1 node, 35 splits
http://localhost:8080/ui/query.html?20260326_071911_00020_85sxf

INSERT: 1 row

Query 20260326_071911_00020_85sxf, FINISHED, 1 node
http://localhost:8080/ui/query.html?20260326_071911_00020_85sxf
Splits: 35 total, 35 done (100.00%)
[Latency: client-side: 0:44, server-side: 0:44] [0 rows, 0B] [0 rows/s, 0B/s]


presto> SELECT * FROM oracle.tm_lakehouse_engine.orcaemp2;

Query 20260326_072023_00021_85sxf, RUNNING, 1 node, 17 splits

empid | empname  | empbandcode | location | empdepcode |          address          |        email         |     ssn     |    phone     
-------+----------+-------------+----------+------------+---------------------------+----------------------+-------------+--------------
   1.0 | John Doe |         3.0 |    101.0 |       20.0 | 123 Main St, New York, NY | john.doe@example.com | 123-45-6789 | 555-123-4567 
(1 row)

Query 20260326_072023_00021_85sxf, FINISHED, 1 node
http://localhost:8080/ui/query.html?20260326_072023_00021_85sxf
Splits: 17 total, 17 done (100.00%)
[Latency: client-side: 0:21, server-side: 0:21] [1 rows, 0B] [0 rows/s, 0B/s]

Testing for fetch_size:

Presto-CLI:

jdbc-fetch-size = 10

presto> select * from oracle_small_fetch.TM_LAKEHOUSE_ENGINE.TEST_FETCH;
    ID    |  DATA   
------------------+------------
 1211.0000000000 | data_1211  
 1212.0000000000 | data_1212  
 1213.0000000000 | data_1213  
 1214.0000000000 | data_1214  
 1215.0000000000 | data_1215  
 1216.0000000000 | data_1216  
 1217.0000000000 | data_1217  
 1218.0000000000 | data_1218  
 1219.0000000000 | data_1219  
 1220.0000000000 | data_1220
(query aborted by user)

Query 20260407_144910_00006_m2vrb, RUNNING, 1 node
Splits: 17 total, 0 done (0.00%)
[Latency: client-side: 1:15, server-side: 1:11] [0 rows, 0B] [0 rows/s, 0B/s]

Screenshot 2026-04-07 at 9 33 16 PM

20260407_144910_00006_m2vrb_small_fetch.json

jdbc-fetch-size = 1000

presto> select * from oracle_large_fetch.TM_LAKEHOUSE_ENGINE.TEST_FETCH;
    ID    |  DATA   
------------------+------------
 1211.0000000000 | data_1211  
 1212.0000000000 | data_1212  
 1213.0000000000 | data_1213  
 1214.0000000000 | data_1214  
 1215.0000000000 | data_1215  
 1216.0000000000 | data_1216  
 1217.0000000000 | data_1217  
 1218.0000000000 | data_1218  
 1219.0000000000 | data_1219  
 1220.0000000000 | data_1220  
 1221.0000000000 | data_1221  
 1222.0000000000 | data_1222
(query aborted by user)

Query 20260407_144746_00005_m2vrb, RUNNING, 1 node
Splits: 17 total, 0 done (0.00%)
[Latency: client-side: 0:11, server-side: 0:06] [0 rows, 0B] [0 rows/s, 0B/s]

20260407_144746_00005_m2vrb_large_fetch.json

Screenshot 2026-04-07 at 9 31 40 PM

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Oracle Connector Changes
*  Add oraorai18n.jar dependency, jdbc fetchsize and SSL config for Oracle connector.

@Dilli-Babu-Godari Dilli-Babu-Godari requested a review from a team as a code owner June 18, 2025 09:57
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jun 18, 2025
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Jun 18, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@prestodb-ci prestodb-ci requested review from a team, agrawalreetika and infvg and removed request for a team June 18, 2025 09:57
@Dilli-Babu-Godari Dilli-Babu-Godari force-pushed the oracle_oss_pr branch 2 times, most recently from 0e2d96e to cf1e277 Compare June 18, 2025 10:12
@Dilli-Babu-Godari Dilli-Babu-Godari changed the title Oracle connector enhancements in WxD Oracle connector enhancements Jun 18, 2025
@steveburnett
Copy link
Copy Markdown
Contributor

Thanks for the release note entry!

  • The PR is now automatically included, you don't have to add it in yourself anymore.
  • Revise the entry to begin with a word from the Order of changes in the Release Notes Guidelines: is the work in this PR a Fix, for example?
  • Expand the abbreviation WxD.
  • Should the section be Oracle Connector Changes instead of General Changes?

@prestodb-ci
Copy link
Copy Markdown
Contributor

@ethanyzhang imported this issue as lakehouse/presto #25355

Copy link
Copy Markdown
Member

@agrawalreetika agrawalreetika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few comments -

  1. Let's split PR in 2 commits - TLS & fetchsize changes
  2. I think TLS is going to be a generic feature acorss different JDBC connectors, maybe we can create a separate TLS config or have it in BaseJDBC config and reuse it in the required JDBC connector?

@Dilli-Babu-Godari
Copy link
Copy Markdown
Contributor Author

Dilli-Babu-Godari commented Jun 20, 2025

I have a few comments -

  1. Let's split PR in 2 commits - TLS & fetchsize changes
  2. I think TLS is going to be a generic feature acorss different JDBC connectors, maybe we can create a separate TLS config or have it in BaseJDBC config and reuse it in the required JDBC connector?

This PR currently includes 4 combined PR changes. I can split them into 2 separate commits as you suggested.

@Dilli-Babu-Godari Dilli-Babu-Godari force-pushed the oracle_oss_pr branch 2 times, most recently from 4830ea8 to e15a068 Compare June 20, 2025 09:27
@Dilli-Babu-Godari
Copy link
Copy Markdown
Contributor Author

Thanks for the release note entry!

  • The PR is now automatically included, you don't have to add it in yourself anymore.
  • Revise the entry to begin with a word from the Order of changes in the Release Notes Guidelines: is the work in this PR a Fix, for example?
  • Expand the abbreviation WxD.
  • Should the section be Oracle Connector Changes instead of General Changes?

Updated the changes

@Dilli-Babu-Godari Dilli-Babu-Godari force-pushed the oracle_oss_pr branch 5 times, most recently from c378b25 to 6de476f Compare June 20, 2025 10:00
@steveburnett
Copy link
Copy Markdown
Contributor

Updated the changes

Thanks for addressing the last point! Please address these:

  • The PR is now automatically included, you don't have to add it in yourself anymore.
  • Revise the entry to begin with a word from the Order of changes in the Release Notes Guidelines: is the work in this PR a Fix, for example?
  • Expand the abbreviation WxD.

@Dilli-Babu-Godari
Copy link
Copy Markdown
Contributor Author

Updated the changes

Thanks for addressing the last point! Please address these:

  • The PR is now automatically included, you don't have to add it in yourself anymore.
  • Revise the entry to begin with a word from the Order of changes in the Release Notes Guidelines: is the work in this PR a Fix, for example?
  • Expand the abbreviation WxD.

Updated the changes.

@Dilli-Babu-Godari Dilli-Babu-Godari force-pushed the oracle_oss_pr branch 4 times, most recently from 564d0ea to beaac68 Compare July 29, 2025 07:38
@prestodb-ci prestodb-ci added follow-up-1 1st time follow-up (alchemy generated) need-follow-up Need any type of follow-up (alchemy generated) labels Mar 12, 2026
@prestodb-ci
Copy link
Copy Markdown
Contributor

Assigning this issue to @faizdani because you are the default assignee for issue follow-up scheme ForwardFit. Feel free to re-route accordingly.

@prestodb-ci
Copy link
Copy Markdown
Contributor

@faizdani
Can you please provide an update on this issue? Thank you!

@prestodb-ci prestodb-ci added follow-up-2 2nd time follow-up (alchemy generated) and removed follow-up-1 1st time follow-up (alchemy generated) labels Mar 19, 2026
@Dilli-Babu-Godari Dilli-Babu-Godari changed the title Oracle connector enhancements feat: Oracle connector enhancements Mar 26, 2026
@Dilli-Babu-Godari Dilli-Babu-Godari changed the title feat: Oracle connector enhancements feat: Oracle connector enhancements Mar 26, 2026
@Dilli-Babu-Godari
Copy link
Copy Markdown
Contributor Author

This PR depends on the test-enabling PR: #25762 for adding tests.

@prestodb-ci
Copy link
Copy Markdown
Contributor

Assigning this issue to @faizdani because you are the default assignee for issue follow-up scheme ForwardFit. Feel free to re-route accordingly.

@prestodb-ci
Copy link
Copy Markdown
Contributor

@faizdani
Can you please provide an update on this issue? Thank you!

@prestodb-ci prestodb-ci added follow-up-3 3rd time follow-up (alchemy generated) and removed follow-up-2 2nd time follow-up (alchemy generated) labels Mar 26, 2026
@Dilli-Babu-Godari Dilli-Babu-Godari force-pushed the oracle_oss_pr branch 3 times, most recently from 0334241 to 676b9fd Compare March 27, 2026 07:47
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Codenotify: Notifying subscribers in CODENOTIFY files for diff 1968770...5310db8.

No notifications.

Copy link
Copy Markdown
Member

@agrawalreetika agrawalreetika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.
Please add documentation for all the newly added properties.

{
this.fetchSize = fetchSize;
return this;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this applicable for other JDBC connectors as well? If yes, then we need to make usagae of it in other connectors as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the jdbc-fetch-size configuration in BaseJdbcConfig is designed to be applicable across all JDBC connectors. We should make the changes in connectors that support.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it would be good to either open a follow up PR or an issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I’ll create an issue to track this and follow up with a PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link the issue to this, if you have it?

escapeNamePattern(schemaName, Optional.of(escape)).orElse(null),
escapeNamePattern(tableName, Optional.of(escape)).orElse(null),
getTableTypes());
resultSet.setFetchSize(fetchSize);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look correct - setFetchSize() is called on the ResultSet after metadata.getTables() has already executed.

I see OracleConnection has setDefaultRowPrefetch, so it should be set in the OracleConnection https://github.com/mikesmithjr/ora-jdbc-source/blob/master/OracleJDBC/src/oracle/jdbc/OracleConnection.java#L97

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out.

Updated the implementation to unwrap OracleConnection and set setDefaultRowPrefetch(fetchSize) before query execution. Applied this consistently in both getTables() and getPreparedStatement().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand how it is setting it in getTables() and getPreparedStatement(), the same as setting it in ConnectionFactory so it can be applied across all the operatoins?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oracle connector currently uses the default DriverConnectionFactory, so introducing a connection-level setting would require adding a custom factory.

Since this optimization is primarily relevant for specific operations like getTables() and prepared statements, scoped it at the method level, where large result set fetching is expected.

This avoids introducing connector-wide behavior changes while keeping the optimization targeted. That said, we can move this to a custom OracleConnectionFactory if we want it to apply uniformly across all operations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, it would be better to keep the fetch consistent across since it's an Oracle batch fetch-related config. Open to hear suggestions as well

Copy link
Copy Markdown
Contributor Author

@Dilli-Babu-Godari Dilli-Babu-Godari Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will introduce a custom OracleConnectionFactory for the batch fetch-related config instead of doing it in the connectonFactory in OracleClientModule.java

what do you think of this ?

Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A local doc build returns the following error:

/Users/steveburnett/Documents/GitHub/presto/presto-docs/src/main/sphinx/connector/oracle.rst:56: ERROR: Malformed table. Bottom/header table border does not match top border.

The entire table in General Configuration Properties is not displayed as a result. See screenshot of my local doc build.

Screenshot 2026-04-01 at 9 42 55 AM

Please fix the formatting of the table and re-request my review, and I'll be happy to review the content.

@Dilli-Babu-Godari
Copy link
Copy Markdown
Contributor Author

A local doc build returns the following error:

/Users/steveburnett/Documents/GitHub/presto/presto-docs/src/main/sphinx/connector/oracle.rst:56: ERROR: Malformed table. Bottom/header table border does not match top border.

The entire table in General Configuration Properties is not displayed as a result. See screenshot of my local doc build.

Screenshot 2026-04-01 at 9 42 55 AM Please fix the formatting of the table and re-request my review, and I'll be happy to review the content.

Thanks fixed alignment issues.

@prestodb-ci
Copy link
Copy Markdown
Contributor

Assigning this issue to @faizdani because you are the default assignee for issue follow-up scheme ForwardFit. Feel free to re-route accordingly.

@prestodb-ci
Copy link
Copy Markdown
Contributor

@faizdani
Can you please provide an update on this issue? Thank you!

steveburnett
steveburnett previously approved these changes Apr 2, 2026
Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (docs)

Pull updated branch, new local doc build, looks good. Thanks!

Dilli-Babu-Godari and others added 4 commits April 6, 2026 23:18
Oracle connector fails with a connection timeout, while show tables, when the schema has a 1 lakh tables. This happens because we are not specifying the fetch_size with the getTables method in Oracle. As a result, the connector uses the default fetch_size, which is a smaller value (10), leading to multiple network calls to the datasource and ultimately causing a connection timeout.,

Co-authored-by: lukmanulhakkeem <lukmanul.hakkeem.a@ibm.com>

# Conflicts:
#	presto-oracle/src/main/java/com/facebook/presto/plugin/oracle/OracleClient.java
added the orai18n.jar dependency, ensuring compatibility with non-UTF character sets like WE8ISO8859P9.
SSL enablement of Oracle Connector with Oracle THIN JDBC driver

Co-authored-by: lukmanulhakkeem <lukmanul.hakkeem.a@ibm.com>
Copy link
Copy Markdown
Member

@agrawalreetika agrawalreetika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly lgtm apart from few comments.

{
this.fetchSize = fetchSize;
return this;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link the issue to this, if you have it?

connectionProperties.setProperty("javax.net.ssl.trustStorePassword", oracleConfig.getTruststorePassword());
}
}
connectionProperties.setProperty(OracleConnection.CONNECTION_PROPERTY_INCLUDE_SYNONYMS, String.valueOf(oracleConfig.isSynonymsEnabled()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use static import

Comment on lines +60 to +67
if (oracleConfig.isTlsEnabled()) {
if (oracleConfig.getTrustStorePath() != null) {
connectionProperties.setProperty("javax.net.ssl.trustStore", oracleConfig.getTrustStorePath());
}
if (oracleConfig.getTruststorePassword() != null) {
connectionProperties.setProperty("javax.net.ssl.trustStorePassword", oracleConfig.getTruststorePassword());
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (oracleConfig.isTlsEnabled()) {
if (oracleConfig.getTrustStorePath() != null) {
connectionProperties.setProperty("javax.net.ssl.trustStore", oracleConfig.getTrustStorePath());
}
if (oracleConfig.getTruststorePassword() != null) {
connectionProperties.setProperty("javax.net.ssl.trustStorePassword", oracleConfig.getTruststorePassword());
}
}
if (oracleConfig.isTlsEnabled()) {
requireNonNull(oracleConfig.getTrustStorePath(), "oracle.tls.truststore-path is null");
connectionProperties.setProperty("javax.net.ssl.trustStore", oracleConfig.getTrustStorePath());
connectionProperties.setProperty("javax.net.ssl.trustStorePassword", oracleConfig.getTruststorePassword());
}

We can simplify this. Since the truststore password can be null for self-signed certs, null checks may not be needed for this.

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

Labels

follow-up-4 4th time follow-up (alchemy generated) ForwardFit Items from IBM Forward Fit from:IBM PR from IBM need-follow-up Need any type of follow-up (alchemy generated)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants