-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding QueryParameter support in BigQuery #1451
Adding QueryParameter support in BigQuery #1451
Conversation
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.
PTAL
} | ||
|
||
/** Returns the query parameter name. */ | ||
public String getName() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
/** Returns the typed query parameter value. */ | ||
public QueryParameterValue getParameterValue() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I decided to add the missing types TIME/DATE/DATETIME into LegacySQLTypeName to resolve #1388 . |
@@ -0,0 +1,51 @@ | |||
/* | |||
* Copyright 2015 Google Inc. All Rights Reserved. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
/** | ||
* A type used in legacy SQL contexts. For example, these types are used in query results, | ||
* even if the query is a standard SQL query. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* Creates a named {@code QueryParameter} object with the given value. | ||
*/ | ||
public static QueryParameter named(String name, QueryParameterValue value) { | ||
return new QueryParameter(name, value); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
/** | ||
* A type used in standard SQL contexts. For example, these types are used in queries | ||
* with query parameters, which requires usage of standard SQL. | ||
*/ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
/** Returns the query parameter name. */ | ||
public String getName() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
/** Returns the query parameter name. */ | ||
public String getName() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
if (queryParameters == null) { | ||
queryParameters = Lists.newArrayList(); | ||
} | ||
queryParameters.add(checkNotNull(queryParameter)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* Sets the query parameters for the query. | ||
* | ||
* The set of query parameters must either be all positional or all named parameters. | ||
* Positional parameters are denoted in the query with a question mark (?), and named |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
private QueryParameterValue(Builder builder) { | ||
checkArgument( | ||
(builder.arrayValues != null) == (StandardSQLTypeName.ARRAY.equals(builder.type))); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
private QueryParameterValue(Builder builder) { | ||
checkArgument( | ||
(builder.arrayValues != null) == (StandardSQLTypeName.ARRAY.equals(builder.type))); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Update PR description? |
Description updated. |
Review comments addressed - PTAL |
} | ||
|
||
private static <T> StandardSQLTypeName classToType(Class<T> type) { | ||
if (Boolean.class.isAssignableFrom(type)) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* <p>A named parameter cannot be added after positional parameters have been added. | ||
*/ | ||
public Builder addNamedParameter(String name, QueryParameterValue value) { | ||
checkNotNull(value); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…datatransfer to v2.3.5 (#1451) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-bigquerydatatransfer](https://togithub.com/googleapis/java-bigquerydatatransfer) | `2.3.4` -> `2.3.5` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquerydatatransfer/2.3.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquerydatatransfer/2.3.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquerydatatransfer/2.3.5/compatibility-slim/2.3.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquerydatatransfer/2.3.5/confidence-slim/2.3.4)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-bigquerydatatransfer</summary> ### [`v2.3.5`](https://togithub.com/googleapis/java-bigquerydatatransfer/blob/HEAD/CHANGELOG.md#​235-httpsgithubcomgoogleapisjava-bigquerydatatransfercomparev234v235-2022-08-24) [Compare Source](https://togithub.com/googleapis/java-bigquerydatatransfer/compare/v2.3.4...v2.3.5) ##### Dependencies - update dependency com.google.cloud:google-cloud-bigquery to v2.14.7 ([#​1448](https://togithub.com/googleapis/java-bigquerydatatransfer/issues/1448)) ([3310cbb](https://togithub.com/googleapis/java-bigquerydatatransfer/commit/3310cbb4f30964e4d36bcbd1f80278cac1eef9d0)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-bigquerydatatransfer). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNzQuMCIsInVwZGF0ZWRJblZlciI6IjMyLjE3NC4wIn0=-->
Also, adding DATE, TIME, and DATETIME support for legacy SQL types.
Fixes #1411