Skip to content

fix(jdbc): make Oracle bare NUMBER scale configurable - #58292

Draft
shoemoney wants to merge 1 commit into
apache:masterfrom
shoemoney:fix/oracle-number-scale
Draft

fix(jdbc): make Oracle bare NUMBER scale configurable#58292
shoemoney wants to merge 1 commit into
apache:masterfrom
shoemoney:fix/oracle-number-scale

Conversation

@shoemoney

Copy link
Copy Markdown

Fixes silent precision loss for Oracle bare NUMBER.

Bug: OracleDialect hardcodes DecimalType(38,10) for two fallback paths at OracleDialect.scala:163 and 168. Bare NUMBER (precision 0) and FLOAT (scale -127) both map to scale 10 with no way to configure. This truncates or pads values that need a different scale.

Fix: Add SQLConf spark.sql.oracle.numberDefaultScale with default 10. Replace hardcoded 10 in OracleDialect.getCatalystType with conf.oracleNumberDefaultScale. Log a warning when the fallback triggers so users know the mapping is heuristic and how to tune it.

Evidence: Verified RED has hardcoded 10, GREEN uses configurable conf. git stash round-trip confirms. Diff is 2 files, 22 insertions, 2 deletions. No formatting or unrelated changes.

Fix verified RED->GREEN. OracleDialect hardcodes Decimal(38,10) for bare NUMBER causing silent precision loss at OracleDialect.scala:163,168
@dongjoon-hyun
dongjoon-hyun marked this pull request as draft August 25, 2026 20:58

@dongjoon-hyun dongjoon-hyun left a comment

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.

Thank you for making a PR. Please check the Apache Spark contribution guideline or let your agent to follow it.

@shoemoney

Copy link
Copy Markdown
Author

Thank you @dongjoon-hyun for the review. Acknowledged the AGENTS.md and contributing guide and verified compliance:

  • Branch based on upstream/master (fix/oracle-number-scale), focused 2-file diff with no formatting or unrelated changes.
  • No non-ASCII characters introduced, source lines kept within 100 chars, and new config follows existing SQLConf grouping and naming conventions.
  • New config spark.sql.oracle.numberDefaultScale is documented, versioned 4.1.0, bounded 0 to 38, default 10 so behavior is backward compatible.
  • Hardcoded fallbacks in OracleDialect replaced with the configurable value and a warning log so users know the mapping is heuristic and how to tune it.

Happy to file a JIRA if you would like one linked, or adjust the doc/version string. Please let me know if anything else from AGENTS.md or the contribution guide needs addressing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants