github-actions[bot] commented on code in PR #70520:
URL: https://github.com/apache/doris/pull/70520#discussion_r4560457547
##########
be/test/exprs/function/function_string_test.cpp:
##########
@@ -106,6 +107,22 @@ void check_encryption_function_all_arg_comb(const
std::string& func_name,
} // namespace
+TEST(function_string_test, crc32_binary_boundaries) {
+ DataSet data_set = {{{Null()}, Null()}};
+ for (size_t length :
+ {0, 1, 3, 4, 5, 7, 8, 9, 15, 16, 17, 63, 64, 65, 127, 128, 129, 255,
256, 257, 4097}) {
+ std::string input(length, '\0');
+ for (size_t i = 0; i < length; ++i) {
+ input[i] = static_cast<char>((i * 37 + 11) & 0xFF);
+ }
+ auto expected = static_cast<int64_t>(
+ crc32_z(0, reinterpret_cast<const Bytef*>(input.data()),
input.size()));
+ data_set.push_back({{input}, expected});
+ }
+ ASSERT_TRUE(
+ check_function<DataTypeInt64>("crc32",
{PrimitiveType::TYPE_VARCHAR}, data_set).ok());
Review Comment:
[P2] Make the NULL-containing CRC test expect a nullable result
The first dataset row expects `Null()`, but `check_function<DataTypeInt64>`
defaults `ResultNullable` to `false`. The helper therefore creates an expected
`ColumnInt64` and passes that first NULL to `insert_cell()`, whose NULL branch
`assert_cast`s it to `ColumnNullable` and throws even in release builds.
Running `crc32_binary_boundaries` will fail before it compares any checksum.
Use `check_function<DataTypeInt64, true>` and wrap the expression in extra
parentheses inside `ASSERT_TRUE` so the template comma is accepted by the macro.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]