Skip to content
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

HIVE-28285: Exception when querying JDBC tables with Hive/DB column types mismatch #5274

Closed
wants to merge 1 commit into from

Conversation

zabetak
Copy link
Contributor

@zabetak zabetak commented May 31, 2024

What changes were proposed in this pull request?

  1. Revert changes from HIVE-27487 for fetching types from the database (RS).
  2. Enrich JDBC type conversion test matrix for Derby: a) Increase type combinations; b) Increase test row/values c)Test with CBO on/off

Why are the changes needed?

  1. Avoid runtime exceptions when Hive and DB column types are different.
  2. Restore the behavior change introduced by HIVE-27487

When Hive types and database (DB) column types are different there is an implicit type conversion that must be done. The JdbcRecordIterator drives the type conversion, and the way we extract values from the ResultSet largely determines the result. In order to perform the conversion the iterator must use the Hive DDL types and not the database DDL types obtained from the result set.

Does this PR introduce any user-facing change?

Yes, as explained above.

Is the change a dependency upgrade?

No

How was this patch tested?

mvn test -Dtest=TestMiniLlapLocalCliDriver -Dqfile_regex=.*jdbc.*.q -Dtest.output.overwrite

…ypes mismatch

1. Revert changes from HIVE-27487 for fetching types from the database (RS) and restore the old behavior.
2. Enrich JDBC type conversion test matrix for Derby
a. Increase type combinations
b. Increase test row/values
c. Test with CBO on/off

When Hive types and database (DB) column types are different there is an implicit type conversion that must be done.
The JdbcRecordIterator drives the type conversion, and the way we extract values from the ResultSet largely determines the result.
In order to perform the conversion the iterator must use the Hive DDL types and not the database DDL types obtained from the result set.
Copy link

sonarcloud bot commented May 31, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@zabetak zabetak closed this in 07cc9c3 Jun 3, 2024
@zabetak zabetak deleted the HIVE-28285 branch June 3, 2024 08:22
dengzhhu653 pushed a commit to dengzhhu653/hive that referenced this pull request Jun 13, 2024
…ypes mismatch (Stamatis Zampetakis reviewed by Zhihua Deng)

1. Revert changes from HIVE-27487 for fetching types from the database (RS) and restore the old behavior.
2. Enrich JDBC type conversion test matrix for Derby
a. Increase type combinations
b. Increase test row/values
c. Test with CBO on/off

When Hive types and database (DB) column types are different there is an implicit type conversion that must be done.
The JdbcRecordIterator drives the type conversion, and the way we extract values from the ResultSet largely determines the result.
In order to perform the conversion the iterator must use the Hive DDL types and not the database DDL types obtained from the result set.

Close apache#5274
mr3project pushed a commit to mr3project/hive-mr3 that referenced this pull request Aug 21, 2024
…ypes mismatch (Stamatis Zampetakis reviewed by Zhihua Deng)

1. Revert changes from HIVE-27487 for fetching types from the database (RS) and restore the old behavior.
2. Enrich JDBC type conversion test matrix for Derby
a. Increase type combinations
b. Increase test row/values
c. Test with CBO on/off

When Hive types and database (DB) column types are different there is an implicit type conversion that must be done.
The JdbcRecordIterator drives the type conversion, and the way we extract values from the ResultSet largely determines the result.
In order to perform the conversion the iterator must use the Hive DDL types and not the database DDL types obtained from the result set.

Close apache/hive#5274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants