Skip to content

Enhance ComplexDataTypeParser with formatting methods for complex types when param is disabled (string handling)#839

Merged
madhav-db merged 5 commits into
mainfrom
madhav-sainanee_data/complex-hot-fix
May 29, 2025
Merged

Enhance ComplexDataTypeParser with formatting methods for complex types when param is disabled (string handling)#839
madhav-db merged 5 commits into
mainfrom
madhav-sainanee_data/complex-hot-fix

Conversation

@madhav-db

@madhav-db madhav-db commented May 28, 2025

Copy link
Copy Markdown
Collaborator
  • Added formatComplexTypeString method to standardize JSON string representation for complex types when support is disabled.
  • Introduced formatMapString method to convert map JSON strings into a consistent {key:value} format.
  • Updated ArrowStreamResult to utilize the new formatting methods for handling complex types when complex datatype support is disabled.

When a string is present it adds quotes, and when a non-string is present it doesn't add quotes
Currently, values we receive from the server are fine for structs and arrays but not for maps (in compliance with existing driver)

This does not support nested conversion. For high fidelity complex types, users must use complex types jdbc connection param

Description

Testing

unit test

Additional Notes to the Reviewer

- Added `formatComplexTypeString` method to standardize JSON string representation for complex types when support is disabled.
- Introduced `formatMapString` method to convert map JSON strings into a consistent {key:value} format.
- Updated `ArrowStreamResult` to utilize the new formatting methods for handling complex types when complex datatype support is disabled.
@github-actions

Copy link
Copy Markdown

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

@madhav-db madhav-db changed the title Enhance ComplexDataTypeParser with formatting methods for complex types Enhance ComplexDataTypeParser with formatting methods for complex types when param is disabled (string handling) May 28, 2025
…ap metadata handling

- Changed the initialization of the key-value array in the formatMapString method to use a dynamic array instead of a fixed size.
- Removed commented-out code for clarity and improved readability.

@jayantsing-db jayantsing-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Some minor comments

}

try {
if (complexType.equals(DatabricksTypeUtil.MAP)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

not for this PR but could there be other types where we need to format them in a different format than JSON?

@jayantsing-db

Copy link
Copy Markdown
Collaborator

qq: if we don't support complex types (flag is false) why do we have exceptions for few complex types? is it because the other driver does support complex types partially?

@samikshya-db samikshya-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit : error handling as J suggested. LGTM otherwise Thanks!

@madhav-db madhav-db merged commit cdf35c3 into databricks:main May 29, 2025
15 of 16 checks passed
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.

4 participants