Skip to content

Updated getIndexInfo() to include Columnstore indexes by using custom query. #2598

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

Merged
merged 6 commits into from
May 13, 2025

Conversation

Ananya2
Copy link
Contributor

@Ananya2 Ananya2 commented Feb 10, 2025

Replaced the use of the sp_statistics stored procedure with a custom query to retrieve index information as the sp_statistics procedure did not return Columnstore indexes, so a query using sys.indexes was implemented as a workaround.
This new query ensures that all index types (Clustered, NonClustered, Columnstore) are included in the result set.
Github Issue: #2546

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 51.72%. Comparing base (f26f90c) to head (7e10f71).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...soft/sqlserver/jdbc/SQLServerDatabaseMetaData.java 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2598      +/-   ##
============================================
+ Coverage     51.63%   51.72%   +0.09%     
- Complexity     4014     4026      +12     
============================================
  Files           147      147              
  Lines         33762    33797      +35     
  Branches       5641     5650       +9     
============================================
+ Hits          17432    17482      +50     
+ Misses        13893    13864      -29     
- Partials       2437     2451      +14     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

David-Engel
David-Engel previously approved these changes Feb 10, 2025
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.

formatter not run

@github-project-automation github-project-automation bot moved this from Under Peer Review to In progress in MSSQL JDBC Mar 24, 2025
@Ananya2 Ananya2 force-pushed the users/anagarg/2546-issue branch from cf5d953 to f84e086 Compare April 22, 2025 03:21
@Ananya2
Copy link
Contributor Author

Ananya2 commented Apr 24, 2025

ADO run:

machavan
machavan previously approved these changes Apr 25, 2025
machavan
machavan previously approved these changes Apr 28, 2025
…merging sp_statistics with custom query results via CachedRowSet.
@Ananya2
Copy link
Contributor Author

Ananya2 commented May 5, 2025

David-Engel
David-Engel previously approved these changes May 7, 2025
Copy link
Collaborator

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

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

I assume this has been manually tested against a SQL DW (Synapse Analytics) instance. (Can use JDBC_DW.)

divang
divang previously approved these changes May 8, 2025
machavan
machavan previously approved these changes May 8, 2025
…in Azure Synapse Analytics, so dependent columns (CARDINALITY and PAGES) are set to NULL in the query for compatibility.
@Ananya2 Ananya2 dismissed stale reviews from machavan, divang, and David-Engel via 7e10f71 May 9, 2025 07:17
@Ananya2
Copy link
Contributor Author

Ananya2 commented May 9, 2025

I assume this has been manually tested against a SQL DW (Synapse Analytics) instance. (Can use JDBC_DW.)

After validating with Azure SQL DW, the custom query was updated to account for the unsupported dm_db_partition_stats DMV by removing its usage and setting the dependent columns (CARDINALITY, PAGES) to NULL. Additionally, I observed that the original sp_statistics procedure does not return any indexes in DW. With the updated query, the default clustered index automatically created during table creation is now correctly retrieved.

@Ananya2 Ananya2 requested review from David-Engel, machavan and divang May 9, 2025 09:52
@Ananya2 Ananya2 added this to the 12.11.0 milestone May 12, 2025
@Ananya2 Ananya2 merged commit 02673d8 into main May 13, 2025
19 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Closed/Merged PRs in MSSQL JDBC May 13, 2025
@Ananya2 Ananya2 deleted the users/anagarg/2546-issue branch June 16, 2025 06:26
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.

DatabaseMetaData getIndexInfo does not include COLUMNSTORE Indexes
6 participants