Skip to content

Dynamic router extract_route_field produces JSON-escaped strings #3177

@atharvalade

Description

@atharvalade

In iceberg_sink/src/router/dynamic_router.rs, the extract_route_field method used val.to_string() on a simd_json::OwnedValue:

.map(|val| val.to_string())

For a string value like tpch.lineitem, to_string() produces the JSON representation "tpch.lineitem" (with literal quote characters). This means the route field value passed to is_valid_namespaced_table and used as a table lookup key contains surrounding quotes, so it either fails validation or looks up a nonexistent table name.

This means dynamic routing with string-valued route fields has never worked correctly, or has never been tested with a real Iceberg catalog end-to-end.

Fix : Use val.as_str().map(|s| s.to_string()) instead of val.to_string().

This should be covered by an integration test that writes a message with a string route field and verifies it lands in the correct Iceberg table.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions