{"record":{"id":"dd9ecef2ec463939","repo":"apache/beam","slug":"unsupported-timestamp-unit-type-getunit-name","errorCode":null,"errorMessage":"Unsupported timestamp unit: ${type.getUnit().name()}","messagePattern":"Unsupported timestamp unit: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/arrow/src/main/java/org/apache/beam/sdk/extensions/arrow/ArrowConversion.java","lineNumber":267,"sourceCode":"                    throw new IllegalArgumentException(\n                        \"Type \\'\" + type.toString() + \"\\' not supported.\");\n                  }\n\n                  @Override\n                  public FieldType visit(ArrowType.Time type) {\n                    throw new IllegalArgumentException(\n                        \"Type \\'\" + type.toString() + \"\\' not supported.\");\n                  }\n\n                  @Override\n                  public FieldType visit(ArrowType.Timestamp type) {\n                    if (type.getUnit() == TimeUnit.MILLISECOND\n                        || type.getUnit() == TimeUnit.MICROSECOND) {\n                      return FieldType.DATETIME;\n                    } else if (type.getUnit() == TimeUnit.NANOSECOND) {\n                      return FieldType.logicalType(Timestamp.NANOS);\n                    } else {\n                      throw new IllegalArgumentException(\n                          \"Unsupported timestamp unit: \" + type.getUnit().name());\n                    }\n                  }\n\n                  @Override\n                  public FieldType visit(ArrowType.Interval type) {\n                    throw new IllegalArgumentException(\n                        \"Type \\'\" + type.toString() + \"\\' not supported.\");\n                  }\n\n                  @Override\n                  public FieldType visit(ArrowType.Duration type) {\n                    throw new IllegalArgumentException(\n                        \"Type \\'\" + type.toString() + \"\\' not supported.\");\n                  }\n\n                  @Override\n                  public FieldType visit(ArrowType.ListView type) {","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/arrow/src/main/java/org/apache/beam/sdk/extensions/arrow/ArrowConversion.java#L249-L285","documentation":"Thrown when converting an ArrowType.Timestamp whose time unit is not MILLISECOND, MICROSECOND, or NANOSECOND (milliseconds and microseconds map to FieldType.DATETIME; nanoseconds to Timestamp.NANOS). Only SECOND-unit timestamps fall through to this error.","triggerScenarios":"Converting an Arrow schema with a Timestamp column in TimeUnit.SECOND (e.g. unix-seconds timestamps) via ArrowConversion.","commonSituations":"Data produced by systems exporting epoch-seconds timestamps (common in C/Rust tooling and unix time storage) fed into a Beam ArrowIO pipeline.","solutions":["Re-cast the timestamp column to MILLISECOND or MICROSECOND unit in the Arrow schema before conversion.","Convert at the producer: multiply epoch seconds by 1000 and emit millisecond-precision timestamps.","Patch the visitor to map SECOND to FieldType.DATETIME (seconds are representable in millis)."],"exampleFix":"// before\nField ts = Field.nullable(\"ts\", new ArrowType.Timestamp(TimeUnit.SECOND, null));\n// after\nField ts = Field.nullable(\"ts\", new ArrowType.Timestamp(TimeUnit.MILLISECOND, null));","handlingStrategy":"validation","validationCode":"for (Field f : schema.getFields()) {\n  if (f.getType() instanceof ArrowType.Timestamp) {\n    TimeUnit u = ((ArrowType.Timestamp) f.getType()).getUnit();\n    if (u != TimeUnit.MILLISECOND && u != TimeUnit.MICROSECOND && u != TimeUnit.NANOSECOND) {\n      throw new IllegalArgumentException(\n          \"Column \" + f.getName() + \" uses timestamp unit \" + u + \"; use MILLI/MICRO/NANO\");\n    }\n  }\n}","typeGuard":"boolean isConvertibleTimestamp(ArrowType t) {\n  if (!(t instanceof ArrowType.Timestamp)) return false;\n  TimeUnit u = ((ArrowType.Timestamp) t).getUnit();\n  return u == TimeUnit.MILLISECOND || u == TimeUnit.MICROSECOND || u == TimeUnit.NANOSECOND;\n}","tryCatchPattern":"try {\n  Schema beamSchema = ArrowConversion.toBeamSchema(arrowSchema);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported timestamp unit\")) {\n    arrowSchema = retimeTimestampUnits(arrowSchema); // SECOND -> MILLISECOND, then retry\n  } else { throw e; }\n}","preventionTips":["Standardize on millisecond or microsecond timestamp units across producers.","Multiply epoch-seconds at the source instead of shipping second-unit timestamps.","Assert timestamp units in data-contract tests for new producers."],"tags":["java","arrow","beam","timestamp","time-unit"],"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-14T16:17:12.679Z"}