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

Kiran Miryala commented on SPARK-17820:
---------------------------------------

Yes, data exists in sqoop_import.departments table.

2,Fitness
3,Footwear
4,Apparel
5,Golf
6,Outdoors
7,Fan*Shop
8,Adventures
9,Recreation
10,Kids

I didn't understand how you are executing those queries. Please try using 
sqlContext.sql("from sqoop_import.departments ...") statement?


> 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

Reply via email to