-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[fix](join) preserve decimal precision for string comparison #65693
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
base: master
Are you sure you want to change the base?
Changes from all commits
50454d1
3f84b6e
9e70032
cb59866
4b47820
18ad9eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,8 @@ class VCastExpr : public VExpr { | |
| #ifdef BE_TEST | ||
| VCastExpr() = default; | ||
| #endif | ||
| VCastExpr(const TExprNode& node) : VExpr(node) {} | ||
| VCastExpr(const TExprNode& node) | ||
| : VExpr(node), _lossless_decimal_cast(node.lossless_decimal_cast) {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [correctness] Preserve the lossless mode in prefilter clones. |
||
| ~VCastExpr() override = default; | ||
| Status execute_column_impl(VExprContext* context, const Block* block, const Selector* selector, | ||
| size_t count, ColumnPtr& result_column) const override; | ||
|
|
@@ -55,20 +56,24 @@ class VCastExpr : public VExpr { | |
| const std::string& expr_name() const override; | ||
| std::string debug_string() const override; | ||
| const DataTypePtr& get_target_type() const; | ||
| bool is_lossless_decimal_cast() const { return _lossless_decimal_cast; } | ||
| bool is_safe_to_execute_on_selected_rows() const override { return false; } | ||
|
|
||
| virtual std::string cast_name() const { return "CAST"; } | ||
| Status clone_node(VExprSPtr* cloned_expr) const override { | ||
| DORIS_CHECK(cloned_expr != nullptr); | ||
| *cloned_expr = VCastExpr::create_shared(clone_texpr_node()); | ||
| auto node = clone_texpr_node(); | ||
| node.__set_lossless_decimal_cast(_lossless_decimal_cast); | ||
| *cloned_expr = VCastExpr::create_shared(node); | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| uint64_t get_digest(uint64_t seed) const override { | ||
| auto res = VExpr::get_digest(seed); | ||
| if (res) { | ||
| return HashUtil::hash64(_target_data_type_name.data(), _target_data_type_name.size(), | ||
| res); | ||
| res = HashUtil::hash64(_target_data_type_name.data(), _target_data_type_name.size(), | ||
| res); | ||
| return HashUtil::hash64(&_lossless_decimal_cast, sizeof(_lossless_decimal_cast), res); | ||
| } | ||
| return 0; | ||
| } | ||
|
|
@@ -82,6 +87,7 @@ class VCastExpr : public VExpr { | |
| std::string _target_data_type_name; | ||
|
|
||
| DataTypePtr _cast_param_data_type; | ||
| bool _lossless_decimal_cast = false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [correctness] Include this mode in |
||
|
|
||
| static const constexpr char* function_name = "CAST"; | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Preserve strict-cast failures in lossless comparisons — Because this branch runs before
enable_strict_mode(), a marked comparison underenable_strict_cast=trueno longer usesfrom_string_strict_mode_batch: malformed text such as100abcand decimal overflow become NULL non-matches instead of failing the query. The new regression explicitly demonstrates that behavior, but it contradicts the existing session contract (“Use strict mode for cast”) and changes failure into silent success. Please keep strict lexical/overflow errors while separately rejecting well-formed but inexact comparison values, and add expected-error coverage.