Kiran Miryala created SPARK-17820:
-------------------------------------

             Summary: 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: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to