Skip to content

Commit 968391d

Browse files
committed
Align label_infallible with label_strict and fix comment grammar
Rename the labeling analysis to `label_infallible` to match its sibling `label_strict`, document it in the same shape, and fix the comment fragments in the `GetItem` and `Select` fallibility overrides. Signed-off-by: Claude <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_011DaVCc8ZmJ13JtPGQYMM3o
1 parent 9ecdc51 commit 968391d

4 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎vortex-array/src/expr/analysis/infallible.rs‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ use crate::expr::Expression;
55
use crate::expr::analysis::BooleanLabels;
66
use crate::expr::label_tree;
77

8-
pub fn label_is_infallible(expr: &Expression) -> BooleanLabels<'_> {
8+
/// Label each expression with whether its entire subtree is infallible.
9+
///
10+
/// A subtree is infallible only when the node's scalar function and every child subtree are
11+
/// infallible. See [`crate::scalar_fn::ScalarFnVTable::is_infallible`] for the scalar-function
12+
/// contract.
13+
pub fn label_infallible(expr: &Expression) -> BooleanLabels<'_> {
914
label_tree(
1015
expr,
1116
|expr| match expr {
@@ -32,43 +37,43 @@ mod tests {
3237
#[test]
3338
fn not_is_infallible() {
3439
let expr = not(col("x"));
35-
let labels = label_is_infallible(&expr);
40+
let labels = label_infallible(&expr);
3641
assert_eq!(labels.get(&expr), Some(&true));
3742
}
3843

3944
#[test]
4045
fn checked_add_defaults_to_fallible() {
4146
let expr = checked_add(col("a"), col("b"));
42-
let labels = label_is_infallible(&expr);
47+
let labels = label_infallible(&expr);
4348
assert_eq!(labels.get(&expr), Some(&false));
4449
}
4550

4651
#[test]
4752
fn eq_is_infallible() {
4853
let expr = eq(col("a"), lit(5));
49-
let labels = label_is_infallible(&expr);
54+
let labels = label_infallible(&expr);
5055
assert_eq!(labels.get(&expr), Some(&true));
5156
}
5257

5358
#[test]
5459
fn merge_with_error_handling_is_fallible() {
5560
let expr = merge_opts([col("a"), col("b")], DuplicateHandling::Error);
56-
let labels = label_is_infallible(&expr);
61+
let labels = label_infallible(&expr);
5762
assert_eq!(labels.get(&expr), Some(&false));
5863
}
5964

6065
#[test]
6166
fn merge_with_rightmost_handling_is_infallible() {
6267
let expr = merge_opts([col("a"), col("b")], DuplicateHandling::RightMost);
63-
let labels = label_is_infallible(&expr);
68+
let labels = label_infallible(&expr);
6469
assert_eq!(labels.get(&expr), Some(&true));
6570
}
6671

6772
#[test]
6873
fn nested_with_fallible_child() {
6974
let child = checked_add(col("a"), col("b"));
7075
let expr = not(child.clone());
71-
let labels = label_is_infallible(&expr);
76+
let labels = label_infallible(&expr);
7277
assert_eq!(labels.get(&child), Some(&false));
7378
assert_eq!(labels.get(&expr), Some(&false));
7479
}
@@ -77,7 +82,7 @@ mod tests {
7782
fn nested_without_fallible_child() {
7883
let child = is_null(col("x"));
7984
let expr = not(child.clone());
80-
let labels = label_is_infallible(&expr);
85+
let labels = label_infallible(&expr);
8186
assert_eq!(labels.get(&child), Some(&true));
8287
assert_eq!(labels.get(&expr), Some(&true));
8388
}

‎vortex-array/src/expr/analysis/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mod strict;
1010

1111
pub use annotation::*;
1212
pub use immediate_access::*;
13-
pub use infallible::label_is_infallible;
13+
pub use infallible::label_infallible;
1414
pub use labeling::*;
1515
pub use referenced_field_paths::referenced_field_paths;
1616
pub use strict::label_strict;

‎vortex-array/src/scalar_fn/fns/get_item.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl ScalarFnVTable for GetItem {
200200
}
201201

202202
fn is_infallible(&self, _field_name: &FieldName) -> bool {
203-
// If this type-checks its infallible.
203+
// If this type-checks, it is infallible.
204204
true
205205
}
206206
}

‎vortex-array/src/scalar_fn/fns/select.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl ScalarFnVTable for Select {
238238
}
239239

240240
fn is_infallible(&self, _instance: &FieldSelection) -> bool {
241-
// If this type-checks its infallible.
241+
// If this type-checks, it is infallible.
242242
true
243243
}
244244
}

0 commit comments

Comments
 (0)