Fix getColumns() flooding DriverManager log writer with stack traces#1494
Open
sreekanth-db wants to merge 1 commit into
Open
Fix getColumns() flooding DriverManager log writer with stack traces#1494sreekanth-db wants to merge 1 commit into
sreekanth-db wants to merge 1 commit into
Conversation
getColumns() probed JDBC columns absent from the underlying SHOW COLUMNS result by calling resultSet.getObject(name), which throws "Invalid column index" as a control-flow signal for the fallback path. The throw was silenced for telemetry, but its stack trace still reached the DriverManager log writer, flooding it on every call (GitHub #1490). Detect absent columns up front via DatabricksResultSetMetaData and compute the default directly, avoiding the throw. The getObject() path (and a catch-block safety net) is preserved when metadata is unavailable, so behavior is unchanged. Co-authored-by: Isaac Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DatabaseMetaData.getColumns()floods theDriverManagerlog writer with caught-and-recoveredInvalid column indexstack traces on every call, even though the call succeeds (GitHub #1490).Root cause:
MetadataResultSetBuilder.getRows()probes JDBC columns that are not present in the underlyingSHOW COLUMNSresult by callingresultSet.getObject(name), which throwsInvalid column indexas a control-flow signal for the fallback path. The throw is silenced for telemetry, but its stack trace still reaches theDriverManagerlog writer.Fix
Detect absent columns up front via
DatabricksResultSetMetaData.getColumnNameIndex()and compute the default value directly, avoiding the throw. The originalgetObject()path — and acatch-block safety net — are preserved when metadata is unavailable (e.g. test mocks), so output is identical and behavior is unchanged for present columns.Testing
exampleGetColumnsLogFlood) confirms the log writer receives zeroInvalid column indexlines after the fix.Fixes #1490
This pull request and its description were written by Isaac.