-
Notifications
You must be signed in to change notification settings - Fork 203
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
Add parameterized queries support as new Spark options #1349
base: master
Are you sure you want to change the base?
Add parameterized queries support as new Spark options #1349
Conversation
/gcbrun |
...uery-connector-common/src/main/java/com/google/cloud/spark/bigquery/SparkBigQueryConfig.java
Outdated
Show resolved
Hide resolved
...-connector-common/src/main/java/com/google/cloud/bigquery/connector/common/BigQueryUtil.java
Outdated
Show resolved
Hide resolved
...onnector-common/src/main/java/com/google/cloud/bigquery/connector/common/BigQueryClient.java
Show resolved
Hide resolved
…a top-level class
2b61789
to
2977405
Compare
/gcbrun |
/gcbrun |
|
||
if (keyLower.startsWith(NAMED_PARAM_PREFIX)) { | ||
Preconditions.checkArgument( | ||
currentMode != ParameterMode.POSITIONAL, |
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.
Readibility.
private final ImmutableMap<String, QueryParameterValue> namedParameters; | ||
private final ImmutableList<QueryParameterValue> positionalParameters; | ||
|
||
public QueryParameterHelper( |
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.
Private
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.
Null check
...nector-common/src/test/java/com/google/cloud/bigquery/connector/common/BigQueryUtilTest.java
Show resolved
Hide resolved
...nector-common/src/test/java/com/google/cloud/bigquery/connector/common/BigQueryUtilTest.java
Show resolved
Hide resolved
}); | ||
|
||
Throwable cause = thrown; | ||
if (cause instanceof ProvisionException && cause.getCause() != null) { |
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.
Provision Exception
This PR introduces new Spark options (
NamedParameters.<name>
,PositionalParameters.<index>
) for specifying BigQuery parameterized query arguments, stated in issues/506.Parameters use the
"TYPE:value"
string format (e.g.,"STRING:value"
,"INT64:123"
). Added validation prevents mixing named/positional parameters and checks format, supported types (explicitly disallowingARRAY
/STRUCT
for now), and indices. Includes updated unit and integration tests.