[ https://issues.apache.org/jira/browse/SPARK-17820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15559565#comment-15559565 ]
Jiang Xingbo commented on SPARK-17820: -------------------------------------- [~kmbeyond]I tried on Spark 1.6.0 and was unable to repro the problem: {code:sql} spark-sql> create database sqoop_import; spark-sql> use sqoop_import; spark-sql> create table names_count1 (department_name String, count Int); spark-sql> create table names_count2 (department_name String, count Int); spark-sql> create table departments(department_name String, department_id Int); spark-sql> insert into departments select * from (select "dept2", 2) t; spark-sql> insert into departments select * from (select "dept4", 4) t; spark-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; spark-sql> select * from sqoop_import.names_count1; dept2 1 spark-sql> select * from sqoop_import.names_count2; dept4 1 {code} May I ask if your database contains rows which satisfies `department_id=4`? > 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: > {noformat} > 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") > {noformat} > Same query inserts into both destination tables on hive shell: > {noformat} > 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; > {noformat} > Both target table definitions are: > {noformat} > hive>use sqoop_import; > hive> create table names_count1 (department_name String, count Int); > hive> create table names_count2 (department_name String, count Int); > {noformat} > Not sure why it is skipping next one. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org