You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "zengxl (Jira)" <ji...@apache.org> on 2024/01/31 01:13:00 UTC

[jira] [Commented] (SPARK-46192) failed to insert the table using the default value of union

    [ https://issues.apache.org/jira/browse/SPARK-46192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17812518#comment-17812518 ] 

zengxl commented on SPARK-46192:
--------------------------------

This patch solves all of these problems

https://issues.apache.org/jira/browse/SPARK-43742

> failed to insert the table using the default value of union
> -----------------------------------------------------------
>
>                 Key: SPARK-46192
>                 URL: https://issues.apache.org/jira/browse/SPARK-46192
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.4.0, 3.4.1
>            Reporter: zengxl
>            Priority: Major
>
>  
> Obtain the following tables and data
> {code:java}
> create table test_spark(k string default null,v int default null) stored as orc;
> create table test_spark_1(k string default null,v int default null) stored as orc;
> insert into table test_spark_1 values('k1',1),('k2',2),('k3',3);
> create table test_spark_2(k string default null,v int default null) stored as orc; 
> insert into table test_spark_2 values('k3',3),('k4',4),('k5',5);
> {code}
> Execute the following SQL
> {code:java}
> insert into table test_spark (k) 
> select k from test_spark_1
> union
> select k from test_spark_2 
> {code}
> exception:
> {code:java}
> 23/12/01 10:44:25 INFO HiveSessionStateBuilder$$anon$1: here is CatalogAndIdentifier
> 23/12/01 10:44:25 INFO HiveSessionStateBuilder$$anon$1: here is CatalogAndIdentifier
> 23/12/01 10:44:25 INFO HiveSessionStateBuilder$$anon$1: here is CatalogAndIdentifier
> 23/12/01 10:44:26 INFO Analyzer$ResolveUserSpecifiedColumns: i.userSpecifiedCols.size is 1
> 23/12/01 10:44:26 INFO Analyzer$ResolveUserSpecifiedColumns: i.userSpecifiedCols.size is 1
> 23/12/01 10:44:26 INFO Analyzer$ResolveUserSpecifiedColumns: i.table.output 2 ,resolved :1 , i.query 1
> 23/12/01 10:44:26 INFO Analyzer$ResolveUserSpecifiedColumns: here is ResolveUserSpecifiedColumns tableOutoyt: 2---nameToQueryExpr : 1Error in query: `default`.`test_spark` requires that the data to be inserted have the same number of columns as the target table: target table has 2 column(s) but the inserted data has 1 column(s), including 0 partition column(s) having constant value(s). {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org