hubgeter opened a new pull request, #52128: URL: https://github.com/apache/doris/pull/52128
bp #47471 Related PR: #32873 Problem Summary: Explicitly defines the behavior of column type conversions. <img width="935" alt="image" src="https://github.com/user-attachments/assets/1e5afcf6-fbcf-4c36-b44e-82843feacb05" /> Special notes are as follows: `String => boolean`: In Parquet, only "false", "off", "no", "0", and an empty string ("") are considered false; otherwise, it is true. In Orc, a string can be parsed as a number, and if that number is 0, it is considered false; otherwise, it is true. If parsing the number fails, it results in null. Conversion between `Int/smallint/tinyint/bigint`: Unless the conversion can be perfectly represented, an error will be reported. For example: Bigint column => smallint column Reason: [INTERNAL_ERROR] Failed to cast value '9223372036854775807' to Nullable(Int16) column. Conversion between `Decimal`: Unless the conversion can be perfectly done, an error will be reported. `String => Int/smallint/tinyint/bigint`: It can be successfully converted to a number, and the number can be correctly stored. Otherwise, the result is null. `Int/smallint/tinyint/bigint => float`: The conversion is successful only if abs(number type) < 2^23. `Int/smallint/tinyint/bigint => double`: The conversion is successful only if abs(number type) < 2^52. `Decimal => Int/smallint/tinyint/bigint`: If the integer part of the decimal can be perfectly stored, only the integer part will be shown; otherwise, it will result in null. `Float => double`: Refer to the C++ static_cast<double>(float). `Decimal => float/double`: Attempt to store the approximate value. `Boolean => string`: The conversion will result in “TRUE” or “FALSE”. TODO: conversion to `char/varchar` type requires truncation. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> -- 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]
