Skip to content
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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

BoqianShi
Copy link
Collaborator

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 disallowing ARRAY/STRUCT for now), and indices. Includes updated unit and integration tests.

@BoqianShi
Copy link
Collaborator Author

/gcbrun

@BoqianShi BoqianShi self-assigned this Apr 2, 2025
@BoqianShi BoqianShi force-pushed the parameterized_squashed branch from 2b61789 to 2977405 Compare April 3, 2025 01:16
@BoqianShi
Copy link
Collaborator Author

/gcbrun

@BoqianShi
Copy link
Collaborator Author

/gcbrun


if (keyLower.startsWith(NAMED_PARAM_PREFIX)) {
Preconditions.checkArgument(
currentMode != ParameterMode.POSITIONAL,
Copy link
Collaborator Author

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(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Private

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Null check

});

Throwable cause = thrown;
if (cause instanceof ProvisionException && cause.getCause() != null) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Provision Exception

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.

2 participants