[
https://issues.apache.org/jira/browse/IMPALA-10173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17748354#comment-17748354
]
ASF subversion and git services commented on IMPALA-10173:
----------------------------------------------------------
Commit a570ee866e78ebffd698cb05edd61cd706fb2ef9 in impala's branch
refs/heads/master from Peter Rozsa
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=a570ee866 ]
IMPALA-10173: (Addendum) Fix substitution for unsafe expressions, column-level
compatibility check
Expression substitution recreates cast expressions without considering
the compatibility level introduced by IMPALA-10173. In unsafe mode, the
recreation causes IllegalStateException. This change fixes this
behavior by storing the compatibility level in each CastExpr, and
reusing it when the expression substitution recreates the cast
expression.
For example: 'select "1", "1" union select 1, "1"'
Also, Set operation's common type calculations did not distinguish
compatibility levels for each column slot, if one column slot's common
type was considered unsafe, every other slot was treated as unsafe.
This change fixes this behavior by reinitializing the compatibility
level for every column slot, enabling cases where one column slot
contains unsafely casted constant values and another contains
non-constant expressions with regular casts.
These queries failed before this change with 'Unsafe implicit cast is
prohibited for non-const expression' error.
For example: 'select "1", 1 union select 1, int_col from unsafe_insert'
Tests:
- test cases added to insert-unsafe.test
Change-Id: I39d13f177482f74ec39570118adab609444c6929
Reviewed-on: http://gerrit.cloudera.org:8080/20184
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> Allow implicit casts between numeric and string types when inserting into
> table
> -------------------------------------------------------------------------------
>
> Key: IMPALA-10173
> URL: https://issues.apache.org/jira/browse/IMPALA-10173
> Project: IMPALA
> Issue Type: Improvement
> Components: Frontend
> Reporter: Tim Armstrong
> Assignee: Peter Rozsa
> Priority: Minor
> Labels: 2023Q1, ramp-up, sql-language, supportability
>
> Impala is somewhat stricter than other engines such as Hive when it comes
> into implicit casts. This avoids a lot of ambiguity and edge cases with
> complex SQL, but we could consider loosening it for simple cases like
> inserting into a table where the meaning/intent is pretty straightforward.
> Repro
> {code}
> CREATE TABLE iobt ( c0 FLOAT ) ;
> INSERT INTO iobt(c0) VALUES ('0'), (1562998803);
> {code}
> Error
> {code}
> AnalysisException: Incompatible return types 'STRING' and 'INT' of exprs
> ''0'' and '1562998803'.
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]