risingwavelabs/risingwave · error

only json format is supported for now

Error message

only json format is supported for now

What it means

The datagen source can only serialize generated rows in JSON format; any other declared row format reaches an `unimplemented!` branch that panics with "only json format is supported for now". The generator builds a JSON object map per row and has no encoder for other formats.

Solutions

  1. Use `FORMAT PLAIN ENCODE JSON` in the datagen source's WITH clause.
  2. If binary-format testing is needed, use a real Kafka connector with Avro/Protobuf instead of datagen.
  3. Implement additional encoding arms in generator.rs `into_msg_stream` if you control the build.

Example fix

// before
CREATE TABLE t WITH (connector='datagen', FORMAT PLAIN ENCODE AVRO, ...);
// after
CREATE TABLE t WITH (connector='datagen', FORMAT PLAIN ENCODE JSON, ...);
Defensive patterns

Strategy: validation

Validate before calling

// Validate the WITH clause before creating a datagen table:
if (/ENCODE\s+(AVRO|PROTOBUF|BYTES)/i.test(withClause)) {
  throw new Error('datagen only supports ENCODE JSON');
}

Prevention

When it happens

Trigger: Creating a datagen source/table whose WITH options declare a format other than JSON, e.g. `FORMAT PLAIN ENCODE AVRO` / `ENCODE PROTOBUF` / `ENCODE BYTES`, then consuming rows — the map-to-payload match hits the `_` arm.

Common situations: Copying a Kafka source definition onto datagen; assuming datagen supports Avro/Protobuf for schema-registry testing; typos like ENCODE='JSONB'.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/a758e56fd90e5fc7. Report an issue: GitHub.

Appendix: source

Thrown at src/connector/src/source/datagen/source/generator.rs:129

                                        if value.is_null() {
                                            reach_end = true;
                                            tracing::info!(
                                                "datagen split {} stop generate, offset {}",
                                                self.split_id,
                                                self.offset
                                            );
                                            break 'outer;
                                        }
                                        value
                                    }
                                };

                                map.insert(name.clone(), value);
                            }
                            serde_json::Value::from(map).to_string().as_bytes().to_vec()
                        }
                        _ => {
                            unimplemented!("only json format is supported for now")
                        }
                    };
                    msgs.push(SourceMessage {
                        key: None,
                        payload: Some(payload),
                        offset: self.offset.to_string(),
                        split_id: self.split_id.clone(),
                        meta: SourceMeta::Datagen(DatagenMeta {
                            timestamp: Some(
                                SystemTime::now()
                                    .duration_since(UNIX_EPOCH)
                                    .unwrap()
                                    .as_millis() as i64,
                            ),
                        }),
                    });
                    self.offset += 1;
                    rows_generated_this_second += 1;

View on GitHub (pinned to 6469eb736d)