{"record":{"id":"4659f342e445d458","repo":"apache/beam","slug":"either-table-or-query-must-be-specified","errorCode":null,"errorMessage":"Either table or query must be specified.","messagePattern":"Either table or query must be specified\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeReadSchemaTransformProvider.java","lineNumber":230,"sourceCode":"      requireNonEmpty(getSnowflakeSchema(), \"snowflakeSchema\");\n      requireNonEmpty(getStagingBucketName(), \"stagingBucketName\");\n      requireNonEmpty(getStorageIntegrationName(), \"storageIntegrationName\");\n      requireNonEmpty(getSchema(), \"schema\");\n\n      SnowflakeSchemaTransformUtils.validateAuthentication(\n          getUsername(),\n          getPassword(),\n          getOauthToken(),\n          getPrivateKey(),\n          getPrivateKeyPassphrase());\n\n      String table = getTable();\n      boolean tablePresent = table != null && !table.isEmpty();\n      String query = getQuery();\n      boolean queryPresent = query != null && !query.isEmpty();\n\n      if (!tablePresent && !queryPresent) {\n        throw new IllegalArgumentException(\"Either table or query must be specified.\");\n      }\n\n      if (tablePresent && queryPresent) {\n        throw new IllegalArgumentException(\"table and query are mutually exclusive.\");\n      }\n\n      if (!getStagingBucketName().endsWith(\"/\")) {\n        throw new IllegalArgumentException(\"stagingBucketName must end with '/'\");\n      }\n\n      // Validate JSON schema early.\n      JsonUtils.beamSchemaFromJsonSchema(getSchema());\n    }\n\n    private static void requireNonEmpty(String value, String name) {\n      if (value == null || value.isEmpty()) {\n        throw new IllegalArgumentException(name + \" cannot be empty\");\n      }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeReadSchemaTransformProvider.java#L212-L248","documentation":"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.').","triggerScenarios":"Constructing a SnowflakeReadSchemaTransform (e.g. via SchemaTransform catalog/YAML) with serverName/database/schema set but both 'table' and 'query' left null or empty strings.","commonSituations":"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.","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')."],"exampleFix":"// before\nSnowflakeReadSchemaTransformConfiguration.builder().setServerName(...).build();\n// after\nSnowflakeReadSchemaTransformConfiguration.builder().setServerName(...).setTable(\"my_table\").build();","handlingStrategy":"validation","validationCode":"if ((table == null || table.isEmpty()) && (query == null || query.isEmpty())) {\n  throw new IllegalArgumentException(\"Set either table or query for the Snowflake read transform\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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'."],"tags":["java","snowflake","validation","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}