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

Fix to ensure metadata returned follows JDBC data type specs #2326

Merged
merged 10 commits into from
Mar 5, 2024

Conversation

barryw-mssql
Copy link
Contributor

ResultSetMetadata of the ResultSet from DatabaseMetadata.getColumns() is Incorrect for Some Columns (1751)

Fix ensures the correct data types for each metadata column by mapping the data type from the SQL Server to the type specified in the JDBC spec

… is Incorrect for Some Columns (1751)

Fix ensures the correct data types for each metadata column match the data type from the SQL Server and the JDBC spec
Copy link
Contributor

@lilgreenbird lilgreenbird left a comment

Choose a reason for hiding this comment

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

pls run formatter on all files.

Copy link
Contributor

@lilgreenbird lilgreenbird left a comment

Choose a reason for hiding this comment

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

there should be a test case to cover the error msg R_colCountNotMatchColTypeCount path

Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 70 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@9b5036d). Click here to learn what that means.

❗ Current head 61ae9b6 differs from pull request most recent head 0ce310e. Consider uploading reports for the commit 0ce310e to get more accurate results

Files Patch % Lines
...soft/sqlserver/jdbc/SQLServerDatabaseMetaData.java 8.62% 53 Missing ⚠️
.../microsoft/sqlserver/jdbc/SQLServerConnection.java 59.37% 5 Missing and 8 partials ⚠️
...m/microsoft/sqlserver/jdbc/SQLServerException.java 50.00% 0 Missing and 3 partials ⚠️
...oft/sqlserver/jdbc/SQLServerPreparedStatement.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2326   +/-   ##
=======================================
  Coverage        ?   50.04%           
  Complexity      ?     3793           
=======================================
  Files           ?      143           
  Lines           ?    33179           
  Branches        ?     5631           
=======================================
  Hits            ?    16605           
  Misses          ?    14191           
  Partials        ?     2383           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tkyc tkyc dismissed lilgreenbird’s stale review March 4, 2024 18:33

Changes are addressed

@barryw-mssql barryw-mssql merged commit eae6d7b into main Mar 5, 2024
17 checks passed
@Jeffery-Wasty Jeffery-Wasty deleted the barry_test branch March 11, 2024 22:11
dongjoon-hyun pushed a commit to apache/spark that referenced this pull request Aug 3, 2024
…QLServer docker image tag to `2022-CU14-ubuntu-22.04`

### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` to 12.8.0.jre11 and MySQLServer docker image to `mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04`.

### Why are the changes needed?

This is the latest stable version of `mssql-jdbc`,  related release notes:

https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.0
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.1
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.0

Some fixed issues:

- Fix to ensure metadata returned follows JDBC data type specs microsoft/mssql-jdbc#2326
- Added token cache map to fix use of unintended auth token for subsequent connections microsoft/mssql-jdbc#2341
- Clear prepared statement handle before reconnect microsoft/mssql-jdbc#2364
- Reset socketTimeout to original value after a successful connection open microsoft/mssql-jdbc#2355
- Clear prepared statement cache when resetting statement pool connection microsoft/mssql-jdbc#2361
- Fixed ClassLoader leak of ActivityCorrelator ThreadLocal microsoft/mssql-jdbc#2366

### Does this PR introduce _any_ user-facing change?

No.
### How was this patch tested?

Pass GA.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #47569 from wayneguow/ms_12_8.

Authored-by: Wei Guo <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
fusheng-rd pushed a commit to fusheng-rd/spark that referenced this pull request Aug 6, 2024
…QLServer docker image tag to `2022-CU14-ubuntu-22.04`

### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` to 12.8.0.jre11 and MySQLServer docker image to `mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04`.

### Why are the changes needed?

This is the latest stable version of `mssql-jdbc`,  related release notes:

https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.0
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.1
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.0

Some fixed issues:

- Fix to ensure metadata returned follows JDBC data type specs microsoft/mssql-jdbc#2326
- Added token cache map to fix use of unintended auth token for subsequent connections microsoft/mssql-jdbc#2341
- Clear prepared statement handle before reconnect microsoft/mssql-jdbc#2364
- Reset socketTimeout to original value after a successful connection open microsoft/mssql-jdbc#2355
- Clear prepared statement cache when resetting statement pool connection microsoft/mssql-jdbc#2361
- Fixed ClassLoader leak of ActivityCorrelator ThreadLocal microsoft/mssql-jdbc#2366

### Does this PR introduce _any_ user-facing change?

No.
### How was this patch tested?

Pass GA.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47569 from wayneguow/ms_12_8.

Authored-by: Wei Guo <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
attilapiros pushed a commit to attilapiros/spark that referenced this pull request Oct 4, 2024
…QLServer docker image tag to `2022-CU14-ubuntu-22.04`

### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` to 12.8.0.jre11 and MySQLServer docker image to `mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04`.

### Why are the changes needed?

This is the latest stable version of `mssql-jdbc`,  related release notes:

https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.0
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.1
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.0

Some fixed issues:

- Fix to ensure metadata returned follows JDBC data type specs microsoft/mssql-jdbc#2326
- Added token cache map to fix use of unintended auth token for subsequent connections microsoft/mssql-jdbc#2341
- Clear prepared statement handle before reconnect microsoft/mssql-jdbc#2364
- Reset socketTimeout to original value after a successful connection open microsoft/mssql-jdbc#2355
- Clear prepared statement cache when resetting statement pool connection microsoft/mssql-jdbc#2361
- Fixed ClassLoader leak of ActivityCorrelator ThreadLocal microsoft/mssql-jdbc#2366

### Does this PR introduce _any_ user-facing change?

No.
### How was this patch tested?

Pass GA.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47569 from wayneguow/ms_12_8.

Authored-by: Wei Guo <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
himadripal pushed a commit to himadripal/spark that referenced this pull request Oct 19, 2024
…QLServer docker image tag to `2022-CU14-ubuntu-22.04`

### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` to 12.8.0.jre11 and MySQLServer docker image to `mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04`.

### Why are the changes needed?

This is the latest stable version of `mssql-jdbc`,  related release notes:

https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.0
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.7.1
https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.0

Some fixed issues:

- Fix to ensure metadata returned follows JDBC data type specs microsoft/mssql-jdbc#2326
- Added token cache map to fix use of unintended auth token for subsequent connections microsoft/mssql-jdbc#2341
- Clear prepared statement handle before reconnect microsoft/mssql-jdbc#2364
- Reset socketTimeout to original value after a successful connection open microsoft/mssql-jdbc#2355
- Clear prepared statement cache when resetting statement pool connection microsoft/mssql-jdbc#2361
- Fixed ClassLoader leak of ActivityCorrelator ThreadLocal microsoft/mssql-jdbc#2366

### Does this PR introduce _any_ user-facing change?

No.
### How was this patch tested?

Pass GA.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47569 from wayneguow/ms_12_8.

Authored-by: Wei Guo <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed/Merged PRs
Development

Successfully merging this pull request may close these issues.

ResultSetMetadata of the ResultSet from DatabaseMetadata.getColumns() is Incorrect for Some Columns
5 participants