{"record":{"id":"2b36097faa8036b3","repo":"apache/beam","slug":"unsupported-timestamp-precision-for-storage-read-api","errorCode":null,"errorMessage":"Unsupported timestamp precision for Storage Read API: ","messagePattern":"Unsupported timestamp precision for Storage Read API: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageSourceBase.java","lineNumber":301,"sourceCode":"    }\n  }\n\n  private static void setArrowTimestampPrecision(\n      ReadSession.TableReadOptions.Builder tableReadOptionsBuilder,\n      TimestampPrecision timestampPrecision) {\n    ArrowSerializationOptions.PicosTimestampPrecision precision;\n    switch (timestampPrecision) {\n      case MICROS:\n        precision = ArrowSerializationOptions.PicosTimestampPrecision.TIMESTAMP_PRECISION_MICROS;\n        break;\n      case NANOS:\n        precision = ArrowSerializationOptions.PicosTimestampPrecision.TIMESTAMP_PRECISION_NANOS;\n        break;\n      case PICOS:\n        precision = ArrowSerializationOptions.PicosTimestampPrecision.TIMESTAMP_PRECISION_PICOS;\n        break;\n      default:\n        throw new IllegalArgumentException(\n            \"Unsupported timestamp precision for Storage Read API: \" + timestampPrecision);\n    }\n    tableReadOptionsBuilder.setArrowSerializationOptions(\n        ArrowSerializationOptions.newBuilder().setPicosTimestampPrecision(precision));\n  }\n\n  private static void setAvroTimestampPrecision(\n      ReadSession.TableReadOptions.Builder tableReadOptionsBuilder,\n      TimestampPrecision timestampPrecision) {\n    AvroSerializationOptions.PicosTimestampPrecision precision;\n    switch (timestampPrecision) {\n      case MICROS:\n        precision = AvroSerializationOptions.PicosTimestampPrecision.TIMESTAMP_PRECISION_MICROS;\n        break;\n      case NANOS:\n        precision = AvroSerializationOptions.PicosTimestampPrecision.TIMESTAMP_PRECISION_NANOS;\n        break;\n      case PICOS:","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageSourceBase.java#L283-L319","documentation":"setArrowTimestampPrecision maps Beam's TimestampPrecision enum onto the Arrow PicosTimestampPrecision proto used by the Storage Read API. The switch handles MICROS, NANOS and PICOS; any other value falls through to default and throws IllegalArgumentException. This is an exhaustive-enum guard against unexpected precision values.","triggerScenarios":"Calling setPicosTimestampPrecision (indirectly via Beam source configuration) with a TimestampPrecision value that is not MICROS/NANOS/PICOS — only possible via a null-unsafe custom enum, a differently-shipped TimestampPrecision enum version, or reflection-built values.","commonSituations":"Version skew where a new TimestampPrecision constant was added in one library version but this Beam switch predates it; user code passing its own precision abstraction misinterpreted as Beam's enum.","solutions":["Pass only TimestampPrecision.MICROS, NANOS, or PICOS when configuring withTimestampPrecision/withPicosTimestampPrecision","Check that beam-sdks-java-io-google-cloud-platform and google-cloud-bigquery-storage versions are aligned","Wrap source construction in code that validates the configured precision against EnumSet.of(MICROS, NANOS, PICOS) before building the source"],"exampleFix":"// before\nTimestampPrecision p = TimestampPrecision.valueOf(userInput); // may be unknown\n// after\nTimestampPrecision p = TimestampPrecision.valueOf(userInput);\nif (p != TimestampPrecision.MICROS && p != TimestampPrecision.NANOS && p != TimestampPrecision.PICOS) {\n  throw new IllegalArgumentException(\"Precision must be MICROS, NANOS or PICOS: \" + userInput);\n}","handlingStrategy":"validation","validationCode":"static final Set<TimestampPrecision> SUPPORTED =\n    EnumSet.of(TimestampPrecision.MICROS, TimestampPrecision.NANOS, TimestampPrecision.PICOS);\nif (!SUPPORTED.contains(precision)) throw new IllegalArgumentException(\"Unsupported precision: \" + precision);","typeGuard":"boolean isSupportedPrecision(TimestampPrecision p) {\n  return p == TimestampPrecision.MICROS || p == TimestampPrecision.NANOS || p == TimestampPrecision.PICOS;\n}","tryCatchPattern":"try {\n  source = source.withTimestampPrecision(precision);\n} catch (IllegalArgumentException e) {\n  precision = TimestampPrecision.NANOS; // safe fallback\n  source = source.withTimestampPrecision(precision);\n}","preventionTips":["Whitelist precision values in pipeline-options parsing","Keep Beam GCP SDK and BQ storage client on matching versions","Prefer NANOS/MICROS unless picosecond precision is truly required"],"tags":["bigquery","storage-read-api","arrow","timestamp","enum"],"backgroundTag":"invalid-enum-value","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"}