{"record":{"id":"21b401eaec94de04","repo":"apache/beam","slug":"the-setting-of-auto-sharding-is-ignored-it-is-only-supported","errorCode":null,"errorMessage":"The setting of auto-sharding is ignored. It is only supported when writing an unbounded PCollection via FILE_LOADS, STREAMING_INSERTS or STORAGE_WRITE_API, but the method was {}.","messagePattern":"The setting of auto-sharding is ignored\\. It is only supported when writing an unbounded PCollection via FILE_LOADS, STREAMING_INSERTS or STORAGE_WRITE_API, but the method was (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java","lineNumber":3889,"sourceCode":"        }\n        if (method == Method.STORAGE_API_AT_LEAST_ONCE\n            && getStorageApiTriggeringFrequency(bqOptions) != null) {\n          LOG.warn(\n              \"Storage API triggering frequency option will be ignored is it can only be specified only \"\n                  + \"when writing via STORAGE_WRITE_API, but the method was {}.\",\n              method);\n        }\n        if (getAutoSharding()) {\n          if (method == Method.STORAGE_WRITE_API && getStorageApiNumStreams(bqOptions) > 0) {\n            LOG.warn(\n                \"Both numStorageWriteApiStreams and auto-sharding options are set. Will default to auto-sharding.\"\n                    + \" To set a fixed number of streams, do not enable auto-sharding.\");\n          } else if (method == Method.FILE_LOADS && getNumFileShards() > 0) {\n            LOG.warn(\n                \"Both numFileShards and auto-sharding options are set. Will default to auto-sharding.\"\n                    + \" To set a fixed number of file shards, do not enable auto-sharding.\");\n          } else if (method == Method.STORAGE_API_AT_LEAST_ONCE) {\n            LOG.warn(\n                \"The setting of auto-sharding is ignored. It is only supported when writing an\"\n                    + \" unbounded PCollection via FILE_LOADS, STREAMING_INSERTS or\"\n                    + \" STORAGE_WRITE_API, but the method was {}.\",\n                method);\n          }\n        }\n      } else { // PCollection is bounded\n        checkArgument(\n            getTriggeringFrequency() == null,\n            \"Triggering frequency is only applicable to an unbounded PCollection.\");\n        checkArgument(\n            !getAutoSharding(), \"Auto-sharding is only applicable to an unbounded PCollection.\");\n        checkArgument(\n            getNumFileShards() == 0,\n            \"Number of file shards is only applicable to an unbounded PCollection.\");\n\n        if (getStorageApiTriggeringFrequency(bqOptions) != null) {\n          LOG.warn(","sourceCodeStart":3871,"sourceCodeEnd":3907,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java#L3871-L3907","documentation":"Auto-sharding in BigQueryIO is only supported for unbounded PCollections written via FILE_LOADS, STREAMING_INSERTS, or STORAGE_WRITE_API. When a bounded input is written with STORAGE_API_AT_LEAST_ONCE, auto-sharding cannot apply, so the setting is ignored and this warning is logged.","triggerScenarios":"Writing a bounded PCollection with method STORAGE_API_AT_LEAST_ONCE while getAutoSharding() is true (e.g. withAutoSharding() was called).","commonSituations":"Batch (bounded) pipelines that reused a streaming write configuration containing withAutoSharding(), or batch pipelines migrated to the Storage API at-least-once method.","solutions":["Remove the withAutoSharding() call for the bounded STORAGE_API_AT_LEAST_ONCE write","Switch the method to STORAGE_WRITE_API on an unbounded PCollection if auto-sharding is needed","Accept the warning; the flag simply has no effect for this combination"],"exampleFix":"// before\nBigQueryIO.writeTableRows().to(table).withMethod(Method.STORAGE_API_AT_LEAST_ONCE).withAutoSharding() // bounded input\n// after\nBigQueryIO.writeTableRows().to(table).withMethod(Method.STORAGE_API_AT_LEAST_ONCE) // auto-sharding removed","handlingStrategy":"validation","validationCode":"if (method == Method.STORAGE_API_AT_LEAST_ONCE && input.isBounded() == PCollection.IsBounded.BOUNDED && autoSharding) { /* remove withAutoSharding */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable withAutoSharding only for unbounded PCollections","Separate streaming and batch sink builders to avoid inheriting auto-sharding","Check input boundedness when changing pipeline sources"],"tags":["java","apache-beam","bigquery","configuration"],"backgroundTag":"conflicting-config-options","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"}