apache/beam · error · java.lang.IllegalArgumentException
Either table or query must be specified.
Error message
Either table or query must be specified.
What it means
SnowflakeReadSchemaTransformProvider.validate() enforces that a read specifies exactly one data source: a table or a query. When neither is present it throws IllegalArgumentException('Either table or query must be specified.').
Solutions
- Add table: <table_name> to the transform configuration.
- Or provide query: <SELECT ...> instead of a table name.
- Check for empty-string values — an empty table is treated as absent; remove the key or give it a real value.
- Validate the YAML/arguments mapping keys match the provider's expected parameter names (e.g. 'table' not 'tableName').
Example fix
// before
SnowflakeReadSchemaTransformConfiguration.builder().setServerName(...).build();
// after
SnowflakeReadSchemaTransformConfiguration.builder().setServerName(...).setTable("my_table").build(); Defensive patterns
Strategy: validation
Validate before calling
if ((table == null || table.isEmpty()) && (query == null || query.isEmpty())) {
throw new IllegalArgumentException("Set either table or query for the Snowflake read transform");
} Prevention
- Always set exactly one of table/query in YAML or builder configs.
- Validate config objects before pipeline expansion.
- Watch for empty-string values counting as 'unset'.
When it happens
Trigger: Constructing a SnowflakeReadSchemaTransform (e.g. via SchemaTransform catalog/YAML) with serverName/database/schema set but both 'table' and 'query' left null or empty strings.
Common situations: YAML config missing the 'table' key; passing an empty string for table thinking it means 'default'; forgetting the table parameter when converting a pipeline from direct code to schema transforms.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- name + " cannot be empty"
- table and query are mutually exclusive.
- 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/4659f342e445d458.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeReadSchemaTransformProvider.java:230
requireNonEmpty(getSnowflakeSchema(), "snowflakeSchema");
requireNonEmpty(getStagingBucketName(), "stagingBucketName");
requireNonEmpty(getStorageIntegrationName(), "storageIntegrationName");
requireNonEmpty(getSchema(), "schema");
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");
}View on GitHub (pinned to 12126d8942)