Skip to content

Commit cb57039

Browse files
authored
docs: clarify output schema handling for extension relations (#1018)
1 parent dd98752 commit cb57039

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

proto/substrait/algebra.proto

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,20 +452,23 @@ message SetRel {
452452
}
453453
}
454454

455-
// Stub to support extension with a single input
455+
// A custom relational operator with a single input. Producers and consumers
456+
// must agree on how to derive the output schema of the relation.
456457
message ExtensionSingleRel {
457458
RelCommon common = 1;
458459
Rel input = 2;
459460
google.protobuf.Any detail = 3;
460461
}
461462

462-
// Stub to support extension with a zero inputs
463+
// A custom relational operator with zero inputs. Producers and consumers
464+
// must agree on how to derive the output schema of the relation.
463465
message ExtensionLeafRel {
464466
RelCommon common = 1;
465467
google.protobuf.Any detail = 2;
466468
}
467469

468-
// Stub to support extension with multiple inputs
470+
// A custom relational operator with multiple inputs. Producers and consumers
471+
// must agree on how to derive the output schema of the relation.
469472
message ExtensionMultiRel {
470473
RelCommon common = 1;
471474
repeated Rel inputs = 2;

site/docs/extensions/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ The third form of advanced extensions provides entirely new relational operation
260260

261261
These extension relations are first-class relation types in Substrait and can be used anywhere a standard relation would be used.
262262

263+
#### Output Schema
264+
265+
Unlike standard relations, Substrait cannot specify how to derive the output schema of extension relations. It is up to producers and consumers to agree on how to derive the schema from the inputs and the `detail` field. This derivation should be documented in the protobuf definition (or equivalent) used for the `detail` field.
266+
263267
### When to Use What
264268

265269
Custom relations are the most flexible option, but also the least interoperable. Prefer enhancements to existing relations when they can express your use case, since this preserves existing patterns and compatibility. As a general rule, choose the least powerful extension mechanism that solves the problem.

0 commit comments

Comments
 (0)