Skip to content

fix(bq jdbc): allow & ignore unknown parameters#12352

Merged
logachev merged 6 commits intomainfrom
kirl/parser_no_error
Apr 1, 2026
Merged

fix(bq jdbc): allow & ignore unknown parameters#12352
logachev merged 6 commits intomainfrom
kirl/parser_no_error

Conversation

@logachev
Copy link
Copy Markdown
Contributor

@logachev logachev commented Apr 1, 2026

Looks like some existing apps provide keys that are not editable by user. At some point we will have an ability to collect such properties & build more permissive map, but for now we will ignore it & log it.

This PR also introduces helper methods for unittests to validate certain log messages were actually logged.

@logachev logachev requested review from a team as code owners April 1, 2026 03:51
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies BigQueryJdbcUrlUtility to log a message instead of throwing an exception when unknown properties are encountered in the JDBC URL, enhancing compatibility with various tools. It also introduces BigQueryJdbcLoggingBaseTest to enable log verification in tests. Review feedback highlights that the logger implementation in BigQueryJdbcUrlUtility incorrectly uses printf-style formatting and suggests using a less aggressive log level. Furthermore, a suggestion was provided to safely access captured logs in tests to avoid potential IndexOutOfBoundsException.

@logachev logachev force-pushed the kirl/parser_no_error branch 3 times, most recently from cf5bb99 to b2fbafb Compare April 1, 2026 06:37
@logachev logachev force-pushed the kirl/parser_no_error branch from b2fbafb to b93e50b Compare April 1, 2026 06:46
throw new BigQueryJdbcRuntimeException(
String.format("Wrong value or unknown setting: %s", safeRef));
} else {
LOG.severe("Wrong value or unknown setting: %s", safeRef);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I kinda agree with gemini about this log should be warning instead of severe considering it's something the user should ideally fix but can proceed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

String safeRef = ref.length() > 32 ? ref.substring(0, 32) + "..." : ref;
throw new BigQueryJdbcRuntimeException(
String.format("Wrong value or unknown setting: %s", safeRef));
// Some tools can pass unknown keys. In order not to break compatibility, throw
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doubt: So, now we allow unknown connection properties BUT with correct format of key=value. Should we consider allowing unknown connection properties that do not follow correct format (e.g. just a key like ;CustomToolFlag;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a use case in the JDBC spec(or any known tools) that use just the key without value in the connection property?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess not really. I was just thinking if the tool passes connection property like SomeProp= and then we end up with same problem. But yeah, maybe it is an edge case and we would still want to throw error for it for now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Long-term I want to have this enforcement enabled for unknown parameters.. Maybe if we collect information about parameters use, we can get a full list of parameters that should be allowlisted (even if ignored).

String safeRef = ref.length() > 32 ? ref.substring(0, 32) + "..." : ref;
throw new BigQueryJdbcRuntimeException(
String.format("Wrong value or unknown setting: %s", safeRef));
// Some tools can pass unknown keys. In order not to break compatibility, throw
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a use case in the JDBC spec(or any known tools) that use just the key without value in the connection property?

@logachev logachev merged commit 2332ff1 into main Apr 1, 2026
113 checks passed
@logachev logachev deleted the kirl/parser_no_error branch April 1, 2026 23:10
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.

3 participants