github-actions[bot] commented on code in PR #64357:
URL: https://github.com/apache/doris/pull/64357#discussion_r3388285896
##########
be/src/format_v2/column_mapper.cpp:
##########
@@ -344,6 +345,93 @@ static bool is_binary_comparison_predicate(const
VExprSPtr& expr) {
}
}
+static bool is_null_predicate_function(const VExprSPtr& expr, bool* is_null) {
+ DORIS_CHECK(is_null != nullptr);
+ if (expr == nullptr || expr->node_type() != TExprNodeType::FUNCTION_CALL ||
+ expr->get_num_children() != 1) {
+ return false;
+ }
+ if (expr->fn().name.function_name == "is_null_pred") {
+ *is_null = true;
+ return true;
+ }
+ if (expr->fn().name.function_name == "is_not_null_pred") {
+ *is_null = false;
+ return true;
+ }
+ return false;
+}
+
+static bool is_signed_integer_type(PrimitiveType type) {
+ switch (type) {
+ case TYPE_TINYINT:
+ case TYPE_SMALLINT:
+ case TYPE_INT:
+ case TYPE_BIGINT:
+ case TYPE_LARGEINT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static int primitive_integer_width(PrimitiveType type) {
+ switch (type) {
+ case TYPE_TINYINT:
+ return 1;
+ case TYPE_SMALLINT:
+ return 2;
+ case TYPE_INT:
+ return 4;
+ case TYPE_BIGINT:
+ return 8;
+ case TYPE_LARGEINT:
+ return 16;
+ default:
+ return 0;
+ }
+}
+
+static bool is_decimal_type(PrimitiveType type) {
+ switch (type) {
+ case TYPE_DECIMAL32:
+ case TYPE_DECIMAL64:
+ case TYPE_DECIMALV2:
+ case TYPE_DECIMAL128I:
+ case TYPE_DECIMAL256:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool is_order_preserving_safe_cast(const DataTypePtr& from_type,
+ const DataTypePtr& to_type) {
+ if (from_type == nullptr || to_type == nullptr) {
+ return false;
+ }
+ const auto from_nested_type = remove_nullable(from_type);
+ const auto to_nested_type = remove_nullable(to_type);
+ if (from_nested_type->equals(*to_nested_type)) {
+ return true;
+ }
+
+ const auto from_primitive_type = from_nested_type->get_primitive_type();
+ const auto to_primitive_type = to_nested_type->get_primitive_type();
+ if (is_signed_integer_type(from_primitive_type) &&
is_signed_integer_type(to_primitive_type)) {
+ return primitive_integer_width(to_primitive_type) >=
+ primitive_integer_width(from_primitive_type);
+ }
+ if (from_primitive_type == TYPE_FLOAT && to_primitive_type == TYPE_DOUBLE)
{
+ return true;
+ }
Review Comment:
This can incorrectly prune matching row groups for `FLOAT -> DOUBLE` nested
filters. After this branch lets `extract_nested_struct_path_for_pruning()`
strip the cast, `build_nested_comparison_predicate()` converts the double
literal back to `FLOAT` and keeps the same opcode. For example, with a float
leaf value equal to `float(0.1)`, `CAST(s.a AS DOUBLE) > 0.1` is true because
`double(float(0.1)) > 0.1`, but the generated file predicate becomes `s.a >
float(0.1)` and can reject a row group whose min/max are exactly that value.
`NE` has the same false-negative shape. Please avoid stats/page/dictionary
pruning for float-to-double casts unless the literal and comparison opcode are
adjusted with a bound-aware rule.
--
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]