-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(bq jdbc): allow & ignore unknown parameters #12352
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ba1392b
fix(bq jdbc): allow & ignore unknown parameters
logachev ac2afdc
Merge branch 'main' into kirl/parser_no_error
logachev b93e50b
Update unittest
logachev 53dd6c8
Change log to warning
logachev 1ed6236
Merge branch 'main' into kirl/parser_no_error
logachev 60661bf
Merge branch 'main' into kirl/parser_no_error
logachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
67 changes: 67 additions & 0 deletions
67
...gquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcLoggingBaseTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.google.cloud.bigquery.jdbc; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.logging.Handler; | ||
| import java.util.logging.LogRecord; | ||
| import java.util.logging.Logger; | ||
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
|
|
||
| public abstract class BigQueryJdbcLoggingBaseTest extends BigQueryJdbcBaseTest { | ||
|
|
||
| protected List<LogRecord> capturedLogs = new ArrayList<>(); | ||
| private Handler handler; | ||
| private Logger logger; | ||
| private long threadId; | ||
|
|
||
| @BeforeEach | ||
| public void setUpLogValidator() { | ||
| logger = BigQueryJdbcRootLogger.getRootLogger(); | ||
| capturedLogs.clear(); | ||
| threadId = Thread.currentThread().getId(); | ||
| handler = | ||
| new Handler() { | ||
| @Override | ||
| public void publish(LogRecord record) { | ||
| if (record.getThreadID() == threadId) { | ||
| capturedLogs.add(record); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void flush() {} | ||
|
|
||
| @Override | ||
| public void close() throws SecurityException {} | ||
| }; | ||
| logger.addHandler(handler); | ||
| } | ||
|
|
||
| @AfterEach | ||
| public void tearDownLogValidator() { | ||
| if (logger != null && handler != null) { | ||
| logger.removeHandler(handler); | ||
| } | ||
| } | ||
|
|
||
| protected boolean assertLogContains(String snippet) { | ||
| return capturedLogs.stream().anyMatch(r -> r.getMessage().contains(snippet)); | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
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;)There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 nowThere was a problem hiding this comment.
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).