{"record":{"id":"61fd02b7411e70ee","repo":"apache/beam","slug":"splunkevent-can-hold-arbitrary-instances-which-may-be-non","errorCode":null,"errorMessage":"SplunkEvent can hold arbitrary instances, which may be non-deterministic.","messagePattern":"SplunkEvent can hold arbitrary instances, which may be non-deterministic\\.","errorType":"validation","errorClass":"NonDeterministicException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/splunk/src/main/java/org/apache/beam/sdk/io/splunk/SplunkEventCoder.java","lineNumber":203,"sourceCode":"    String sourceType = STRING_NULLABLE_CODER.decode(in);\n    if (sourceType != null) {\n      builder.withSourceType(sourceType);\n    }\n\n    String index = STRING_NULLABLE_CODER.decode(in);\n    if (index != null) {\n      builder.withIndex(index);\n    }\n  }\n\n  @Override\n  public TypeDescriptor<SplunkEvent> getEncodedTypeDescriptor() {\n    return TYPE_DESCRIPTOR;\n  }\n\n  @Override\n  public void verifyDeterministic() throws NonDeterministicException {\n    throw new NonDeterministicException(\n        this, \"SplunkEvent can hold arbitrary instances, which may be non-deterministic.\");\n  }\n}\n","sourceCodeStart":185,"sourceCodeEnd":207,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/splunk/src/main/java/org/apache/beam/sdk/io/splunk/SplunkEventCoder.java#L185-L207","documentation":"SplunkEventCoder.verifyDeterministic() unconditionally declares that SplunkEvent coding is non-deterministic, because a SplunkEvent can contain arbitrary Java objects (nested maps/lists) whose encoded byte form may differ between encodes of equal events. Beam requires deterministic coders for grouping (GBK), state/timers, and some sinks, so this coder refuses.","triggerScenarios":"Using SplunkEvent in a PCollection that requires deterministic encoding: Apply.groupByKey(), Combine, stateful DoFns, or writing SplunkEvents through a runner stage that checks coder determinism (e.g., after SplunkIO.read() results are re-grouped).","commonSituations":"Users parse Splunk events then groupByKey on event fields to deduplicate or join; deterministic-coder validation fails at job submission with this NonDeterministicException.","solutions":["Convert SplunkEvents to a deterministically codable type (e.g., a custom Avro/POJO/Row with ordered fields) before grouping.","Provide an explicit deterministic coder via .setCoder() on the PCollection with a canonical serialization (sorted keys, fixed field order).","If only the event's byte payload matters, extract a String/byte[] representation and use StringUtf8Coder/ByteArrayCoder semantics."],"exampleFix":"// before\nPCollection<KV<String, Iterable<SplunkEvent>>> grouped = events\n    .apply(GroupByKey.create());\n// after\nPCollection<KV<String, String>> flat = events.apply(MapElements.into(TypeDescriptor.of(String.class))\n    .via(e -> canonicalJson(e)));\nPCollection<KV<String, Iterable<String>>> grouped = flat.apply(GroupByKey.create());","handlingStrategy":"type-guard","validationCode":"// Java — avoid grouping SplunkEvents; convert to a deterministic type first\nPCollection<KV<String, String>> kv = events.apply(MapElements.into(TypeDescriptors.strings()).via(e -> e.value() == null ? \"\" : e.value()));","typeGuard":"boolean deterministicSafe(Class<?> c) { return String.class.equals(c) || byte[].class.equals(c) || Row.class.isAssignableFrom(c); }","tryCatchPattern":null,"preventionTips":["Never groupByKey/Combine directly on PCollections of SplunkEvent.","Project events into fixed-schema types (Row/Avro) before shuffles.","Remember all Java Coder instances in Beam are non-deterministic by default unless verified."],"tags":["apache-beam","java","coder","splunk","determinism"],"backgroundTag":"unsupported-operation","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"}