Skip to content

Commit e6450b1

Browse files
committed
feat(query): fix tests
1 parent e89232e commit e6450b1

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

src/query/functions-v2/src/scalars/boolean.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@ pub fn register(registry: &mut FunctionRegistry) {
4545
|lhs, rhs| lhs & rhs,
4646
);
4747

48+
registry.register_2_arg_core::<BooleanType, BooleanType, BooleanType, _, _>(
49+
"and",
50+
FunctionProperty::default(),
51+
|lhs, rhs| {
52+
Some(BooleanDomain {
53+
has_false: lhs.has_false || rhs.has_false,
54+
has_true: lhs.has_true && rhs.has_true,
55+
})
56+
},
57+
vectorize_2_arg::<BooleanType, BooleanType, BooleanType>(|lhs, rhs| lhs & rhs),
58+
);
59+
60+
registry.register_2_arg_core::<BooleanType, BooleanType, BooleanType, _, _>(
61+
"or",
62+
FunctionProperty::default(),
63+
|lhs, rhs| {
64+
Some(BooleanDomain {
65+
has_false: lhs.has_false && rhs.has_false,
66+
has_true: lhs.has_true || rhs.has_true,
67+
})
68+
},
69+
vectorize_2_arg::<BooleanType, BooleanType, BooleanType>(|lhs, rhs| lhs | rhs),
70+
);
71+
4872
// https://en.wikibooks.org/wiki/Structured_Query_Language/NULLs_and_the_Three_Valued_Logic
4973
registry.register_2_arg_core::<NullableType<BooleanType>, NullableType<BooleanType>, NullableType<BooleanType>, _, _>(
5074
"and",
@@ -82,30 +106,6 @@ pub fn register(registry: &mut FunctionRegistry) {
82106
}),
83107
);
84108

85-
registry.register_2_arg_core::<BooleanType, BooleanType, BooleanType, _, _>(
86-
"and",
87-
FunctionProperty::default(),
88-
|lhs, rhs| {
89-
Some(BooleanDomain {
90-
has_false: lhs.has_false || rhs.has_false,
91-
has_true: lhs.has_true && rhs.has_true,
92-
})
93-
},
94-
vectorize_2_arg::<BooleanType, BooleanType, BooleanType>(|lhs, rhs| lhs & rhs),
95-
);
96-
97-
registry.register_2_arg_core::<BooleanType, BooleanType, BooleanType, _, _>(
98-
"or",
99-
FunctionProperty::default(),
100-
|lhs, rhs| {
101-
Some(BooleanDomain {
102-
has_false: lhs.has_false && rhs.has_false,
103-
has_true: lhs.has_true || rhs.has_true,
104-
})
105-
},
106-
vectorize_2_arg::<BooleanType, BooleanType, BooleanType>(|lhs, rhs| lhs | rhs),
107-
);
108-
109109
registry.register_2_arg::<BooleanType, BooleanType, BooleanType, _, _>(
110110
"xor",
111111
FunctionProperty::default(),

src/query/functions-v2/tests/it/scalars/testdata/boolean.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ast : true AND false
22
raw expr : and(true, false)
3-
checked expr : and<Boolean NULL, Boolean NULL>(CAST(true AS Boolean NULL), CAST(false AS Boolean NULL))
3+
checked expr : and<Boolean, Boolean>(true, false)
44
optimized expr : false
5-
output type : Boolean NULL
6-
output domain : Unknown
5+
output type : Boolean
6+
output domain : {FALSE}
77
output : false
88

99

@@ -18,19 +18,19 @@ output : false
1818

1919
ast : true AND true
2020
raw expr : and(true, true)
21-
checked expr : and<Boolean NULL, Boolean NULL>(CAST(true AS Boolean NULL), CAST(true AS Boolean NULL))
21+
checked expr : and<Boolean, Boolean>(true, true)
2222
optimized expr : true
23-
output type : Boolean NULL
24-
output domain : Unknown
23+
output type : Boolean
24+
output domain : {TRUE}
2525
output : true
2626

2727

2828
ast : false AND false
2929
raw expr : and(false, false)
30-
checked expr : and<Boolean NULL, Boolean NULL>(CAST(false AS Boolean NULL), CAST(false AS Boolean NULL))
30+
checked expr : and<Boolean, Boolean>(false, false)
3131
optimized expr : false
32-
output type : Boolean NULL
33-
output domain : Unknown
32+
output type : Boolean
33+
output domain : {FALSE}
3434
output : false
3535

3636

@@ -45,10 +45,10 @@ output : NULL
4545

4646
ast : false AND true
4747
raw expr : and(false, true)
48-
checked expr : and<Boolean NULL, Boolean NULL>(CAST(false AS Boolean NULL), CAST(true AS Boolean NULL))
48+
checked expr : and<Boolean, Boolean>(false, true)
4949
optimized expr : false
50-
output type : Boolean NULL
51-
output domain : Unknown
50+
output type : Boolean
51+
output domain : {FALSE}
5252
output : false
5353

5454

@@ -129,10 +129,10 @@ evaluation (internal):
129129

130130
ast : true OR false
131131
raw expr : or(true, false)
132-
checked expr : or<Boolean NULL, Boolean NULL>(CAST(true AS Boolean NULL), CAST(false AS Boolean NULL))
132+
checked expr : or<Boolean, Boolean>(true, false)
133133
optimized expr : true
134-
output type : Boolean NULL
135-
output domain : Unknown
134+
output type : Boolean
135+
output domain : {TRUE}
136136
output : true
137137

138138

0 commit comments

Comments
 (0)