fix: replace default-allow cast unwrap with closed-by-default allowlist#6
Open
discord9 wants to merge 22 commits into
Open
fix: replace default-allow cast unwrap with closed-by-default allowlist#6discord9 wants to merge 22 commits into
discord9 wants to merge 22 commits into
Conversation
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Replace default-allow cast unwrapping with an explicit allowlist in is_supported_comparison_unwrap_cast. Only verified-safe type pairs are allowed; the literal must also round-trip exactly. Allowed families: - Timestamp widening (same timezone, same-or-finer precision) - Integer widening (same-sign, unsigned->larger signed, identity) - Binary widening (FixedSizeBinary->Binary, identity) - Integer->String (Eq/NotEq/IsDistinctFrom only; string ordering differs from integer ordering for inequalities) - Dictionary/String family (any direction, round-trip catches truncation) - Decimal widening (int-digits not reduced, scale not reduced) - Integer->Decimal (when p-s >= integer digit count) - Date32<->Int32, Date64<->Int64 (same bit width) Explicitly blocked: - String->Integer (multiple strings map to same int) - Integer narrowing - Signed->unsigned - Timestamp cross-timezone - Decimal narrowing - Decimal->Integer (truncates fractional part) try_cast_string_literal renamed to try_cast_string_like_literal and uses ScalarValue::cast_to for int<->string consistency. is_integer_string_safe takes op for inequality gate. Tests updated in casts.rs, optimizer, physical simplifier, and SLT.
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports apache#21908 to GreptimeTeam/datafusion.\n\nSummary:\n- Replaces default-allow comparison cast unwrapping with a closed-by-default allowlist.\n- Requires literal round-trip safety before unwrapping.\n- Covers timestamp/integer/binary/string/dictionary/decimal allowlist behavior and updates logical/physical unwrap tests plus SLT expectations.\n\nValidation:\n- cargo fmt --all -- --check\n- cargo test -p datafusion-expr-common --lib test_comparison_unwrap\n- cargo test -p datafusion-optimizer --lib unwrap_cast\n- cargo test -p datafusion-physical-expr --lib unwrap_cast