[
https://issues.apache.org/jira/browse/SPARK-17820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15557433#comment-15557433
]
Jiang Xingbo commented on SPARK-17820:
--------------------------------------
Looks we could support this by expanding `multiInsertQueryBody` rule, should we
do this?[~hvanhovell]
> Spark sqlContext.sql() performs only first insert for HiveQL "FROM target
> INSERT INTO dest" command to insert into multiple target tables from same
> source
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SPARK-17820
> URL: https://issues.apache.org/jira/browse/SPARK-17820
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.6.0
> Environment: Cloudera Quickstart VM 5.7
> Reporter: Kiran Miryala
>
> I am executing a HiveQL in spark-shell, I intend to insert a record into 2
> destination tables from the same source table using same statement. But it
> inserts in only first destination table. My statement:
> scala>val departmentsData = sqlContext.sql("from sqoop_import.departments
> insert into sqoop_import.names_count1 select department_name, count(1) where
> department_id=2 group by department_name insert into
> sqoop_import.names_count2 select department_name, count(1) where
> department_id=4 group by department_name")
> Same query inserts into both destination tables on hive shell:
> from sqoop_import.departments
> insert into sqoop_import.names_count1
> select department_name, count(1)
> where department_id=2 group by department_name
> insert into sqoop_import.names_count2
> select department_name, count(1)
> where department_id=4 group by department_name;
> Both target table definitions are:
> hive>use sqoop_import;
> hive> create table names_count1 (department_name String, count Int);
> hive> create table names_count2 (department_name String, count Int);
> Not sure why it is skipping next one.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]