apache/beam · error · java.lang.IllegalArgumentException
table and query are mutually exclusive.
Error message
table and query are mutually exclusive.
What it means
SnowflakeReadSchemaTransformProvider.validate enforces that a read source is specified exactly one way: table and query are mutually exclusive, and both being present makes the source ambiguous, so this IllegalArgumentException fires. (A sibling check rejects neither being present.)
Solutions
- Remove the table entry and keep the query, or vice versa.
- If a query is needed for filtering, drop the table and write SELECT ... FROM <table> in the query.
- In YAML, delete the unused key rather than leaving it empty-but-present logic aside (both non-empty triggers this).
- Centralize read-source configuration so table/query can't both be set programmatically.
Example fix
// before
configuration.setTable("events").setQuery("SELECT * FROM events LIMIT 10");
// after
configuration.setQuery("SELECT * FROM events LIMIT 10"); Defensive patterns
Strategy: validation
Validate before calling
if (table != null && !table.isEmpty() && query != null && !query.isEmpty()) {
throw new IllegalArgumentException("Provide only one of table or query");
} Prevention
- Remove (not empty) the unused key in configs.
- Keep a single source-of-truth for the read source.
- Code-review template merges for duplicated options.
When it happens
Trigger: Setting both setTable("t") and setQuery("SELECT ...") on SnowflakeReadSchemaTransformConfiguration, or a YAML config that includes both keys.
Common situations: Template config with table filled in plus a pasted query; merging default config with user overrides where both survive; script-generated configs concatenating options.
Related errors
- Either table or query must be specified.
- name + " cannot be empty"
- Batch size is too large! It should be smaller or equal than
- Column delimiter should be set if headers are present.
- Column headers should be supplied when delimiter is present.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/c6cda75ab3e72021.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeReadSchemaTransformProvider.java:234
SnowflakeSchemaTransformUtils.validateAuthentication(
getUsername(),
getPassword(),
getOauthToken(),
getPrivateKey(),
getPrivateKeyPassphrase());
String table = getTable();
boolean tablePresent = table != null && !table.isEmpty();
String query = getQuery();
boolean queryPresent = query != null && !query.isEmpty();
if (!tablePresent && !queryPresent) {
throw new IllegalArgumentException("Either table or query must be specified.");
}
if (tablePresent && queryPresent) {
throw new IllegalArgumentException("table and query are mutually exclusive.");
}
if (!getStagingBucketName().endsWith("/")) {
throw new IllegalArgumentException("stagingBucketName must end with '/'");
}
// Validate JSON schema early.
JsonUtils.beamSchemaFromJsonSchema(getSchema());
}
private static void requireNonEmpty(String value, String name) {
if (value == null || value.isEmpty()) {
throw new IllegalArgumentException(name + " cannot be empty");
}
}
@AutoValue.Builder
public abstract static class Builder {View on GitHub (pinned to 12126d8942)