Skip to content

Conversation

@namya28
Copy link
Contributor

@namya28 namya28 commented Aug 13, 2025

Description

This PR involves re-enabling Oracle Test Classes that were previously disabled.

Motivation and Context

Impact

Test Plan

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
* Update Oracle test classes to re-enable them.

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Aug 13, 2025
@namya28 namya28 marked this pull request as ready for review August 14, 2025 13:15
@namya28 namya28 requested a review from a team as a code owner August 14, 2025 13:15
@prestodb-ci prestodb-ci requested review from a team, sh-shamsan and wanglinsong and removed request for a team August 14, 2025 13:15
@namya28 namya28 requested a review from agrawalreetika August 14, 2025 13:15
@agrawalreetika
Copy link
Member

Please squash all your commit into one

@tdcmeehan tdcmeehan self-assigned this Aug 14, 2025
@namya28 namya28 force-pushed the enableoracletestclass branch 3 times, most recently from 6642509 to a6d7094 Compare August 14, 2025 14:53
agrawalreetika
agrawalreetika previously approved these changes Aug 14, 2025
Copy link
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.

LGTM

Copy link
Member

@imjalpreet imjalpreet left a comment

Choose a reason for hiding this comment

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

@namya28, thank you, I have a few comments below.

Also, I don't believe the TestOracleIntegrationSmokeTest and TestOracleDistributedQueries are still enabled. These are excluded from the default profile:

<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- these tests take a very long time so only run them in the CI server -->
<excludes>
<exclude>**/TestOracleIntegrationSmokeTest.java</exclude>
<include>**/TestOracleDistributedQueries.java</include>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>

They will run if the profile used is ci, as they are not excluded from that:

<profile>
<id>ci</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes combine.self="override" />
</configuration>
</plugin>
</plugins>
</build>
</profile>
, but I don't see Oracle tests enabled with the ci profile yet.

Comment on lines 43 to 45
OracleServerTester oracleServerTester = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServerTester, TpchTable.getTables());
this.oracleServer = oracleServerTester;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
OracleServerTester oracleServerTester = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServerTester, TpchTable.getTables());
this.oracleServer = oracleServerTester;
this.oracleServer = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServer, TpchTable.getTables());

Comment on lines 36 to 38
OracleServerTester oracleServerTester = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServerTester, ORDERS);
this.oracleServer = oracleServerTester;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
OracleServerTester oracleServerTester = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServerTester, ORDERS);
this.oracleServer = oracleServerTester;
this.oracleServer = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServer, ORDERS);

Comment on lines 52 to 55
OracleServerTester oracleServerTester = new OracleServerTester();

this.queryRunner = createOracleQueryRunner(oracleServerTester);
this.oracleServer = oracleServerTester;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
OracleServerTester oracleServerTester = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServerTester);
this.oracleServer = oracleServerTester;
this.oracleServer = new OracleServerTester();
this.queryRunner = createOracleQueryRunner(oracleServer);

Comment on lines 49 to 50
OracleContainer oracleContainer = new OracleContainer("wnameless/oracle-xe-11g-r2");
oracleContainer.start();
Copy link
Member

Choose a reason for hiding this comment

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

To clarify, why do we need this only in this test class?

Also, isn't OracleServerTester's constructor already handling this?

@namya28 namya28 force-pushed the enableoracletestclass branch 2 times, most recently from aa8b80c to 73cc0ea Compare September 9, 2025 06:38
@tdcmeehan
Copy link
Contributor

@namya28 what is the state of this review?

@namya28
Copy link
Contributor Author

namya28 commented Sep 17, 2025

@namya28 what is the state of this review?

Hi @tdcmeehan , I've addressed the test case failures for the two test classes in this PR. However, the third test class TestOracleDistributedQueries inherits from AbstractTestDistributedQueries class and currently has over 90 test failures after running in CI tests. I’m working through them methodically, but given the volume and complexity, it may take some time to resolve them all.

To keep things clean and avoid premature reviews, I’m considering converting this PR to draft status while I continue working on the remaining test failures. Once I’ve resolved as many as possible and the test suite is in a more stable state, I’ll mark the PR as ready for review again.

Please let me know if this approach works for you, or if you’d suggest an alternative.

Thanks!

@namya28 namya28 marked this pull request as draft September 18, 2025 06:23
@namya28 namya28 changed the title Enable Oracle Test Class Enable Oracle Test Class [WIP] Sep 18, 2025
@namya28 namya28 force-pushed the enableoracletestclass branch from 73cc0ea to a994f0f Compare October 13, 2025 12:27
@namya28 namya28 force-pushed the enableoracletestclass branch from a994f0f to db91645 Compare October 15, 2025 07:11
@namya28 namya28 force-pushed the enableoracletestclass branch 2 times, most recently from ef3dd50 to 26b44cc Compare November 18, 2025 06:11
@namya28 namya28 changed the title Enable Oracle Test Class [WIP] test(oracle): Enable test class for Oracle connector Nov 18, 2025
@namya28 namya28 force-pushed the enableoracletestclass branch from 26b44cc to c919aec Compare November 18, 2025 07:20
@namya28 namya28 changed the title test(oracle): Enable test class for Oracle connector test(connector): Enable test class for Oracle connector Nov 18, 2025
@namya28 namya28 marked this pull request as ready for review November 18, 2025 12:13
@prestodb-ci prestodb-ci requested a review from a team November 18, 2025 12:13
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 18, 2025

Reviewer's Guide

This PR restores disabled Oracle connector tests, adds a full distributed query test suite, enriches OracleClient with additional type mappings and SQL generation, extends the shared test framework with new helpers, and updates CI to include Oracle connector tests.

Class diagram for updated OracleClient type mappings and SQL generation

classDiagram
    class OracleClient {
        +Optional<ReadMapping> toPrestoType(ConnectorSession, JdbcTypeHandle)
        +String toSqlType(Type)
        +String normalizeIdentifier(ConnectorSession, String)
    }
    class ReadMapping
    class ConnectorSession
    class JdbcTypeHandle
    class Type
    class VarcharType {
        +boolean isUnbounded()
        +int getLengthSafe()
    }
    class CharType {
        +int getLength()
    }
    class DecimalType {
        +int getPrecision()
        +int getScale()
    }
    OracleClient --> ReadMapping
    OracleClient --> ConnectorSession
    OracleClient --> JdbcTypeHandle
    OracleClient --> Type
    Type <|-- VarcharType
    Type <|-- CharType
    Type <|-- DecimalType
Loading

Class diagram for restored and added Oracle connector test classes

classDiagram
    class TestOracleIntegrationSmokeTest {
        +void testIntegration()
    }
    class TestOracleTypes {
        +void testTypeMappings()
    }
    class TestOracleDistributedQueries {
        +void testDistributedQueries()
    }
    TestOracleIntegrationSmokeTest <|-- TestOracleTypes
    TestOracleIntegrationSmokeTest <|-- TestOracleDistributedQueries
Loading

File-Level Changes

Change Details Files
Re-enable/refactor Oracle connector integration and types test classes
  • Renamed disabled test classes and updated constructors
  • Restored @test annotations and session property setups
  • Adjusted expected column definitions in DESCRIBE and type‐roundtrip tests
presto-oracle/src/test/java/com/facebook/presto/plugin/oracle/TestOracleIntegrationSmokeTest.java
presto-oracle/src/test/java/com/facebook/presto/plugin/oracle/TestOracleTypes.java
Introduce comprehensive Oracle distributed query tests
  • Added full TestOracleDistributedQueries suite extending AbstractTestDistributedQueries
  • Configured various system properties (optimizer, timestamp) per test scenario
presto-oracle/src/test/java/com/facebook/presto/plugin/oracle/TestOracleDistributedQueries.java
Extend OracleClient type mapping and SQL type generation
  • Mapped OracleTypes.BINARY_DOUBLE, DATE, TIMESTAMP in toPrestoType
  • Overrode toSqlType to emit VARCHAR2, CHAR, NUMBER(n,m), BINARY_DOUBLE/FLOAT, DATE, TIMESTAMP
presto-oracle/src/main/java/com/facebook/presto/plugin/oracle/OracleClient.java
Enhance shared test framework utilities
  • Added assertCreateTableAsSelect overload supporting row count verification and drop
  • Introduced computeExpected(session, sql, resultTypes) helper
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueryFramework.java
Update CI configuration for Oracle connector
  • Included presto-oracle in the tests workflow matrix
.github/workflows/tests.yml

Possibly linked issues

  • #[Issue ID]: The PR enables the Oracle connector tests in the CI pipeline, directly addressing the issue's goal of enabling container-based tests.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `presto-oracle/src/main/java/com/facebook/presto/plugin/oracle/OracleClient.java:312-314` </location>
<code_context>
+        if (isVarcharType(type)) {
+            VarcharType varcharType = (VarcharType) type;
+            if (varcharType.isUnbounded()) {
+                return "VARCHAR2(4000)"; // Oracle max before CLOB
+            }
+            return format("VARCHAR2(%s)", varcharType.getLengthSafe());
</code_context>

<issue_to_address>
**suggestion:** Hardcoding VARCHAR2(4000) for unbounded varchar may not handle larger text fields.

This mapping may cause errors or data loss for inputs exceeding 4000 bytes. Consider documenting the limitation or implementing a fallback to CLOB for unbounded types.

```suggestion
            if (varcharType.isUnbounded()) {
                // Unbounded VARCHAR mapped to CLOB to avoid data loss for inputs exceeding 4000 bytes.
                // See: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Character-Data-Types.html
                return "CLOB";
            }
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +312 to +317
if (varcharType.isUnbounded()) {
return "VARCHAR2(4000)"; // Oracle max before CLOB
}
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Hardcoding VARCHAR2(4000) for unbounded varchar may not handle larger text fields.

This mapping may cause errors or data loss for inputs exceeding 4000 bytes. Consider documenting the limitation or implementing a fallback to CLOB for unbounded types.

Suggested change
if (varcharType.isUnbounded()) {
return "VARCHAR2(4000)"; // Oracle max before CLOB
}
if (varcharType.isUnbounded()) {
// Unbounded VARCHAR mapped to CLOB to avoid data loss for inputs exceeding 4000 bytes.
// See: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Character-Data-Types.html
return "CLOB";
}

@namya28 namya28 force-pushed the enableoracletestclass branch from e13c84c to 0c21aa4 Compare November 20, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants