Skip to content

Provide Struct data type support for oracle plugin#659

Open
vanshikaagupta22 wants to merge 9 commits into
data-integrations:developfrom
cloudsufi:oracle-structsupport
Open

Provide Struct data type support for oracle plugin#659
vanshikaagupta22 wants to merge 9 commits into
data-integrations:developfrom
cloudsufi:oracle-structsupport

Conversation

@vanshikaagupta22

@vanshikaagupta22 vanshikaagupta22 commented May 6, 2026

Copy link
Copy Markdown
Contributor

This change adds native support for resolving Oracle STRUCT types (Object Types) into CDAP RECORD schemas. By querying the ALL_TYPE_ATTRS metadata table, the schema builder dynamically processes complex structures with support for up to 4 levels of nesting. Internal attributes are first translated to standard SQL data types via a dedicated mapper before being converted into the final CDAP schema.
When reading the data, the implementation overrides the setField() function, providing a custom implementation to properly extract and map individual custom object attributes according to requirements.

Note: Users will require explicit EXECUTE privileges on the custom Oracle object types to successfully resolve the schema.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for resolving Oracle STRUCT types into CDAP RECORD schemas by querying the ALL_TYPE_ATTRS metadata table. The implementation includes recursive resolution for nested structures and an updated mapping for primitive Oracle types. Feedback highlights several critical issues: the metadata query lacks an OWNER filter which could lead to incorrect schema resolution in multi-schema environments; fully qualified type names containing dots will cause IllegalArgumentException when creating CDAP records; and there are logic errors in the primitive type mapping, specifically regarding Oracle-specific type naming conventions and an invalid comparison between Java class names and SQL type strings.

Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java Outdated
# Conflicts:
#	oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java
#	oracle-plugin/src/test/java/io/cdap/plugin/oracle/OracleSchemaReaderTest.java
@vishwasvaidya-cloudsufi
vishwasvaidya-cloudsufi force-pushed the oracle-structsupport branch 2 times, most recently from a11f5cc to af67d36 Compare June 15, 2026 10:01
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceDBRecord.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceDBRecord.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceDBRecord.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceDBRecord.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java Outdated
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceDBRecord.java Outdated
recordBuilder.set(field.getName(), bigDecimal.longValue());
break;
case STRING:
recordBuilder.set(field.getName(), bigDecimal.toString());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use toPlainString()

Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceDBRecord.java Outdated
@vanshikaagupta22
vanshikaagupta22 force-pushed the oracle-structsupport branch 2 times, most recently from e05a911 to 3455570 Compare July 15, 2026 12:08

@vikasrathee-cs vikasrathee-cs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants