Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ Proto conversion is split into two directions, and the class name tells you whic
to one proto value, order the deprecated ones **last** so the reverse lookup returns the
canonical one (see `Join.JoinType`). Adding an enum value is an edit to the enum, not the
converters.
- **`RelCommon` data** (emit mapping, hint, rel anchor, common advanced extension) is converted by
one helper per direction: `ProtoRelConverter.applyRelCommon(rel, relCommon)` on the way in and
`RelProtoConverter.common(Rel)` on the way out. Both are still *called* per relation, so both
halves are easy to forget: a new `newXxx` must route its result through `applyRelCommon`, and a
new `visit` must call `.setCommon(common(rel))`. `RelCommonRoundtripTest` covers every
`RelVisitor` type and fails when one has no sample — but it is keyed on POJO types, not on proto
`oneof` cases, so a new case mapping to an existing POJO type slips through. `applyRelCommon`
runs *after* `build()`, so a relation with a `@Value.Check` on one of these fields must also set
it on its builder (see `newLateralJoin`). `UpdateRel` is the only *modeled* relation message with
no `common` field (`ReferenceRel` has none either, but no POJO models it); the POJO accessors live
on `Rel`, so `NamedUpdate` can still *hold* this data —
and an emit mapping would change its `getRecordType()` — so `RelProtoConverter.checkNoRelCommon`
rejects it on the way out rather than silently serializing a plan with a different schema.
- POJO types are created with `TypeCreator.REQUIRED` / `TypeCreator.NULLABLE`.

## Building and testing
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/io/substrait/dsl/SubstraitBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,14 @@ public NamedUpdate namedUpdate(
/**
* Creates a named update relation that updates rows in a table with output field remapping.
*
* <p>Note that {@code UpdateRel} has no {@code common} field as of spec v0.99.0, so it has
* nowhere to carry the emit mapping. The resulting relation therefore cannot be serialized:
* {@link io.substrait.relation.RelProtoConverter} rejects it rather than emitting a plan whose
* schema silently differs from the relation's own {@link
* io.substrait.relation.Rel#getRecordType()}. Until the spec gives {@code UpdateRel} a {@code
* common} field, use {@link #namedUpdate(Iterable, Iterable, List, Expression, boolean)} for
* relations that have to survive a round trip.
*
* @param tableName the qualified name of the table to update
* @param columnNames the names of the columns in the table
* @param transformations the list of transformation expressions to apply
Expand Down
Loading
Loading