Skip to content

Commit 96477b1

Browse files
committed
docs: clarify FieldReference constraints for struct-based root types
1 parent f43b876 commit 96477b1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

proto/substrait/algebra.proto

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,8 @@ message Expression {
11991199
Type.Struct parameters = 1;
12001200

12011201
// The lambda body expression. Lambda parameters can be referenced using FieldReference
1202-
// with FieldReference.LambdaParameterReference as root_type.
1202+
// with FieldReference.LambdaParameterReference as root_type and ReferenceSegment.StructField
1203+
// as direct_reference to select specific parameters.
12031204
Expression body = 2;
12041205
}
12051206

@@ -1575,21 +1576,25 @@ message Expression {
15751576
MaskExpression masked_reference = 2;
15761577
}
15771578

1578-
// The origin of the data being referenced. When this is a RootReference and
1579-
// direct_reference above is used, the direct_reference must be of a type
1580-
// StructField.
1579+
// The origin of the data being referenced.
15811580
oneof root_type {
15821581
Expression expression = 3;
1582+
// When used with direct_reference, the direct_reference must be of type
1583+
// ReferenceSegment.StructField.
15831584
RootReference root_reference = 4;
1585+
// When used with direct_reference, the direct_reference must be of type
1586+
// ReferenceSegment.StructField.
15841587
OuterReference outer_reference = 5;
1588+
// Must use direct_reference and the direct_reference
1589+
// must be of type ReferenceSegment.StructField.
15851590
LambdaParameterReference lambda_parameter_reference = 6;
15861591
}
15871592

15881593
// Singleton that expresses this FieldReference is rooted off the root
1589-
// incoming record type
1594+
// incoming record type (which is always a struct).
15901595
message RootReference {}
15911596

1592-
// A root reference for the outer relation's subquery
1597+
// A root reference for the outer relation's subquery (which is always a struct).
15931598
message OuterReference {
15941599
// number of subquery boundaries to traverse up for this field's reference
15951600
//
@@ -1599,8 +1604,8 @@ message Expression {
15991604

16001605
// A reference to a lambda parameter within a lambda body expression.
16011606
// This identifies which lambda scope to reference, treating its parameters
1602-
// as a struct. Use FieldReference with this as root_type to access specific
1603-
// parameters or nested fields within parameters.
1607+
// as a struct. Further navigation into nested fields within parameters uses
1608+
// the child field of StructField.
16041609
message LambdaParameterReference {
16051610
// Number of lambda boundaries to traverse up for this reference.
16061611
// For nested lambdas:

0 commit comments

Comments
 (0)