[enchement](schema change)Standardize the behavior after a table schema change. (#47471) #52128
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.
bp #47471
Related PR: #32873
Problem Summary:
Explicitly defines the behavior of column type conversions.
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(float).
Decimal => float/double:Attempt to store the approximate value.
Boolean => string:The conversion will result in “TRUE” or “FALSE”.
TODO: conversion to
char/varchartype requires truncation.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)