File tree Expand file tree Collapse file tree 12 files changed +96
-12
lines changed
vortex-layout/src/layouts/dict Expand file tree Collapse file tree 12 files changed +96
-12
lines changed Original file line number Diff line number Diff line change 6262{
6363 type NodeTy = Expression ;
6464
65+ fn visit_down ( & mut self , _node : & ' a Self :: NodeTy ) -> VortexResult < TraversalOrder > {
66+ Ok ( TraversalOrder :: Continue )
67+ }
68+
6569 fn visit_up ( & mut self , node : & ' a Expression ) -> VortexResult < TraversalOrder > {
6670 let self_label = ( self . self_label ) ( node) ;
6771
Original file line number Diff line number Diff line change @@ -238,6 +238,12 @@ impl Expression {
238238 self . vtable . as_dyn ( ) . is_null_sensitive ( self . data . as_ref ( ) )
239239 }
240240
241+ /// Returns whether this expression itself is fallible.
242+ /// See [`VTable::is_fallible`].
243+ pub fn is_fallible ( & self ) -> bool {
244+ self . vtable . as_dyn ( ) . is_fallible ( self . data . as_ref ( ) )
245+ }
246+
241247 /// Format the expression as a compact string.
242248 ///
243249 /// Since this is a recursive formatter, it is exposed on the public Expression type.
Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ impl VTable for GetItem {
155155 fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
156156 true
157157 }
158+
159+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
160+ // If this type-checks its infallible.
161+ false
162+ }
158163}
159164
160165/// Creates an expression that accesses a field from the root array.
Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ impl VTable for IsNull {
106106 fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
107107 true
108108 }
109+
110+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
111+ false
112+ }
109113}
110114
111115/// Creates an expression that checks for null values.
Original file line number Diff line number Diff line change @@ -130,6 +130,10 @@ impl VTable for Literal {
130130 fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
131131 false
132132 }
133+
134+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
135+ false
136+ }
133137}
134138
135139/// Create a new `Literal` expression from a type that coerces to `Scalar`.
Original file line number Diff line number Diff line change @@ -166,6 +166,14 @@ impl VTable for Merge {
166166 . into_array ( ) ,
167167 )
168168 }
169+
170+ fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
171+ true
172+ }
173+
174+ fn is_fallible ( & self , instance : & Self :: Instance ) -> bool {
175+ matches ! ( instance, DuplicateHandling :: Error )
176+ }
169177}
170178
171179/// What to do when merged structs share a field name.
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ impl VTable for Not {
8585 fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
8686 false
8787 }
88+
89+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
90+ false
91+ }
8892}
8993
9094/// Creates an expression that logically inverts boolean values.
Original file line number Diff line number Diff line change @@ -145,6 +145,10 @@ impl VTable for Pack {
145145 fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
146146 true
147147 }
148+
149+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
150+ false
151+ }
148152}
149153
150154impl ExpressionView < ' _ , Pack > {
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ impl VTable for Root {
8585 fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
8686 false
8787 }
88+
89+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
90+ false
91+ }
8892}
8993
9094/// Creates an expression that references the root scope.
Original file line number Diff line number Diff line change @@ -201,6 +201,15 @@ impl VTable for Select {
201201 . collect ( ) ;
202202 Ok ( unsafe { StructVector :: new_unchecked ( Arc :: new ( new_fields) , mask) } . into ( ) )
203203 }
204+
205+ fn is_null_sensitive ( & self , _instance : & Self :: Instance ) -> bool {
206+ true
207+ }
208+
209+ fn is_fallible ( & self , _instance : & Self :: Instance ) -> bool {
210+ // If this type-checks its infallible.
211+ false
212+ }
204213}
205214
206215/// Creates an expression that selects (includes) specific fields from an array.
You can’t perform that action at this time.
0 commit comments