Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(numeric): add more functions #488

Closed
wants to merge 12 commits into from
71 changes: 71 additions & 0 deletions arroyo-sql-testing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,4 +1331,75 @@ mod tests {
},
PI
);

// iszero
single_test_codegen!(
"yes_iszero",
"iszero(0)",
arroyo_sql::TestStruct {
..Default::default()
},
true
);

single_test_codegen!(
"no_iszero",
"iszero(1)",
arroyo_sql::TestStruct {
..Default::default()
},
false
);

single_test_codegen!(
"nan_iszero",
"iszero(non_nullable_f64)",
arroyo_sql::TestStruct {
non_nullable_f64: f64::NAN,
..Default::default()
},
false
);

// isnan
single_test_codegen!(
"yes_isnan",
"isnan(non_nullable_f64)",
arroyo_sql::TestStruct {
non_nullable_f64: f64::NAN,
..Default::default()
},
true
);

single_test_codegen!(
"no_isnan",
"isnan(non_nullable_f64)",
arroyo_sql::TestStruct {
non_nullable_f64: 1f64,
..Default::default()
},
false
);

// nanvl
single_test_codegen!(
"nan_nanvl",
"nanvl(non_nullable_f64,1)",
arroyo_sql::TestStruct {
non_nullable_f64: f64::NAN,
..Default::default()
},
1f64
);

single_test_codegen!(
"no_nan_nanvl",
"nanvl(non_nullable_f64,1)",
arroyo_sql::TestStruct {
non_nullable_f64: 2f64,
..Default::default()
},
2f64
);
}
Loading
Loading