-
Notifications
You must be signed in to change notification settings - Fork 5.5k
test(connector): Enable test class for Oracle connector #25762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
...o-oracle/src/test/java/com/facebook/presto/plugin/oracle/TestOracleIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-oracle/src/test/java/com/facebook/presto/plugin/oracle/TestOracleTypes.java
Outdated
Show resolved
Hide resolved
presto-oracle/src/test/java/com/facebook/presto/plugin/oracle/TestOracleTypes.java
Outdated
Show resolved
Hide resolved
|
Please squash all your commit into one |
6642509 to
a6d7094
Compare
agrawalreetika
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
imjalpreet
left a comment
There was a problem hiding this 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:
Lines 233 to 253 in 956978a
| <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:
Lines 218 to 231 in 956978a
| <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> |
ci profile yet.
| OracleServerTester oracleServerTester = new OracleServerTester(); | ||
| this.queryRunner = createOracleQueryRunner(oracleServerTester, TpchTable.getTables()); | ||
| this.oracleServer = oracleServerTester; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| OracleServerTester oracleServerTester = new OracleServerTester(); | |
| this.queryRunner = createOracleQueryRunner(oracleServerTester, TpchTable.getTables()); | |
| this.oracleServer = oracleServerTester; | |
| this.oracleServer = new OracleServerTester(); | |
| this.queryRunner = createOracleQueryRunner(oracleServer, TpchTable.getTables()); |
| OracleServerTester oracleServerTester = new OracleServerTester(); | ||
| this.queryRunner = createOracleQueryRunner(oracleServerTester, ORDERS); | ||
| this.oracleServer = oracleServerTester; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| OracleServerTester oracleServerTester = new OracleServerTester(); | |
| this.queryRunner = createOracleQueryRunner(oracleServerTester, ORDERS); | |
| this.oracleServer = oracleServerTester; | |
| this.oracleServer = new OracleServerTester(); | |
| this.queryRunner = createOracleQueryRunner(oracleServer, ORDERS); |
| OracleServerTester oracleServerTester = new OracleServerTester(); | ||
|
|
||
| this.queryRunner = createOracleQueryRunner(oracleServerTester); | ||
| this.oracleServer = oracleServerTester; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| OracleServerTester oracleServerTester = new OracleServerTester(); | |
| this.queryRunner = createOracleQueryRunner(oracleServerTester); | |
| this.oracleServer = oracleServerTester; | |
| this.oracleServer = new OracleServerTester(); | |
| this.queryRunner = createOracleQueryRunner(oracleServer); |
| OracleContainer oracleContainer = new OracleContainer("wnameless/oracle-xe-11g-r2"); | ||
| oracleContainer.start(); |
There was a problem hiding this comment.
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?
aa8b80c to
73cc0ea
Compare
|
@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 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! |
73cc0ea to
a994f0f
Compare
a994f0f to
db91645
Compare
ef3dd50 to
26b44cc
Compare
26b44cc to
c919aec
Compare
Reviewer's GuideThis 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 generationclassDiagram
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
Class diagram for restored and added Oracle connector test classesclassDiagram
class TestOracleIntegrationSmokeTest {
+void testIntegration()
}
class TestOracleTypes {
+void testTypeMappings()
}
class TestOracleDistributedQueries {
+void testDistributedQueries()
}
TestOracleIntegrationSmokeTest <|-- TestOracleTypes
TestOracleIntegrationSmokeTest <|-- TestOracleDistributedQueries
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if (varcharType.isUnbounded()) { | ||
| return "VARCHAR2(4000)"; // Oracle max before CLOB | ||
| } |
There was a problem hiding this comment.
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.
| 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"; | |
| } |
e13c84c to
0c21aa4
Compare
Description
This PR involves re-enabling Oracle Test Classes that were previously disabled.
Motivation and Context
Impact
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.