{"record":{"id":"119bd9a9c5427ffe","repo":"apache/beam","slug":"unsupported-schema-specified-for-pubsub-source-in-create-119bd9","errorCode":null,"errorMessage":"Unsupported schema specified for Pubsub source in CREATE TABLE.CREATE TABLE for Pubsub topic must include at least 'event_timestamp' field of type 'TIMESTAMP'","messagePattern":"Unsupported schema specified for Pubsub source in CREATE TABLE\\.CREATE TABLE for Pubsub topic must include at least 'event_timestamp' field of type 'TIMESTAMP'","errorType":"validation","errorClass":"InvalidSchemaException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubSchemaIOProvider.java","lineNumber":163,"sourceCode":"\n  @Override\n  public boolean requiresDataSchema() {\n    return true;\n  }\n\n  @Override\n  public PCollection.IsBounded isBounded() {\n    return PCollection.IsBounded.UNBOUNDED;\n  }\n\n  private void validateDataSchema(@Nullable Schema schema) {\n    if (schema == null) {\n      throw new InvalidSchemaException(\n          \"Unsupported schema specified for Pubsub source in CREATE TABLE.\"\n              + \"CREATE TABLE for Pubsub topic must not be null\");\n    }\n    if (!PubsubSchemaIO.fieldPresent(schema, TIMESTAMP_FIELD, FieldType.DATETIME)) {\n      throw new InvalidSchemaException(\n          \"Unsupported schema specified for Pubsub source in CREATE TABLE.\"\n              + \"CREATE TABLE for Pubsub topic must include at least 'event_timestamp' field of \"\n              + \"type 'TIMESTAMP'\");\n    }\n  }\n\n  private void validateDlq(@Nullable String deadLetterQueue) {\n    if (deadLetterQueue != null && deadLetterQueue.isEmpty()) {\n      throw new InvalidConfigurationException(\"Dead letter queue topic name is not specified\");\n    }\n  }\n\n  private void validateConfigurationSchema(Row configuration) {\n    if (!configuration.getSchema().equals(configurationSchema())) {\n      throw new InvalidConfigurationException(\n          \"Configuration schema provided does not match expected\");\n    }\n  }","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubSchemaIOProvider.java#L145-L181","documentation":"PubsubSchemaIOProvider.validateDataSchema() requires the CREATE TABLE schema for a Pubsub source to contain an 'event_timestamp' field of type TIMESTAMP/DATETIME. Without it, messages cannot be assigned event timestamps, so an InvalidSchemaException is thrown.","triggerScenarios":"CREATE TABLE for a Pubsub topic whose column list omits 'event_timestamp' or declares it with a type other than TIMESTAMP (FieldType.DATETIME), triggering fieldPresent(schema, TIMESTAMP_FIELD, DATETIME) == false.","commonSituations":"Users defining only payload columns and forgetting the event timestamp column; naming the column differently (e.g. 'timestamp', 'ts'); declaring it as BIGINT or VARCHAR instead of TIMESTAMP.","solutions":["Add a column named 'event_timestamp' of type TIMESTAMP to the CREATE TABLE schema.","Rename the existing timestamp column to 'event_timestamp' if it exists under another name.","Cast/declare the field as TIMESTAMP (DATETIME) rather than a numeric or string type."],"exampleFix":"-- before\nCREATE TABLE t (payload VARCHAR) ...;\n-- after\nCREATE TABLE t (payload VARCHAR, event_timestamp TIMESTAMP) ...;","handlingStrategy":"validation","validationCode":"boolean hasTs = java.util.stream.Stream.of(tableSchema.getFields()).anyMatch(f -> f.getName().equals(\"event_timestamp\") && f.getType().getTypeName() == org.apache.beam.sdk.schemas.Schema.TypeName.DATETIME);\nif (!hasTs) { throw new IllegalArgumentException(\"Pubsub CREATE TABLE schema must include event_timestamp TIMESTAMP\"); }","typeGuard":null,"tryCatchPattern":"try { ioProvider.from(tableConfig); } catch (InvalidSchemaException e) { if (e.getMessage().contains(\"event_timestamp\")) { /* add the event_timestamp TIMESTAMP column */ } throw e; }","preventionTips":["Include event_timestamp TIMESTAMP in every Pubsub CREATE TABLE template.","Do not rename or retype the event_timestamp column; other timestamp names are not accepted."],"tags":["java","apache-beam","pubsub","sql","schema"],"backgroundTag":"schema-validation-failed","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"}