apache / apache/fluss

[Rust] SchemaBuilder accepts blank or duplicate nested ROW field names

Open
#4,208 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.1k
Forks
625
Avg merge
3d 14h
Merged PRs (30d)
97

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fluss/issues) and found nothing similar.

### Fluss version

main (development)

### Please describe the bug 🐞

The Rust `SchemaBuilder` accepts nested `ROW` types whose field names are blank or duplicated, while the Java `RowType` rejects these definitions.

For example, both schemas currently build successfully:

```rust
Schema::builder()
.column(
"payload",
DataTypes::row(vec![DataTypes::field(" ", DataTypes::int())]),
)
.build()
.unwrap();

Schema::builder()
.column(
"payload",
DataTypes::row(vec![
DataTypes::field("value", DataTypes::int()),
DataTypes::field("value", DataTypes::string()),
]),
)
.build()
.unwrap();
```

The problem also applies to `ROW` types nested recursively inside `ARRAY`, `MAP`, or another `ROW`.

This causes Gateway table creation with `validate_only=true` to return 200 for a schema that Fluss Server rejects during actual creation.

Related discussion:
https://github.com/apache/fluss/pull/4107#discussion_r3862660463

### Expected behavior

`SchemaBuilder::build()` should reject blank or duplicate nested `ROW` field names, consistently with the Java implementation.

### Solution

Recursively validate data types during schema construction and reject:

- field names containing only whitespace;
- duplicate field names within the same `ROW`.

Add fluss-rust unit tests and a Gateway `validate_only` regression test.

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Rust SchemaBuilder and data-type construction path, then compare its nested ROW validation with the Java RowType behavior described in the issue. Add fluss-rust unit coverage and a Gateway validate_only regression test; done means blank or duplicate nested ROW field names are rejected recursively, including inside ARRAY, MAP, and ROW types.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, rust
Domain
backend, data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.