Reputation: 203
I am running this query:
Set hive.limit.query.max.table.partition=9000;select distinct ps169 as hotel_code,pd5 as city_code,datediff(to_date(pd32),to_date(FROM_UNIXTIME(UNIX_TIMESTAMP()))) as ap1,ps180 as los from camustest.a_1229 r join ht.ttl_values ttl on r.ps169=ttl.hotel_code and datediff(to_date(pd32),to_date(FROM_UNIXTIME(UNIX_TIMESTAMP())))=ttl.ap and year= 2016 and month=12 and day=30 where pd5 IS NOT NULL and trim(ttl.hotel_code)!='' and trim(ttl.hotel_code)!='null' and ttl.hotel_code IS NOT NULL and trim(ttl.city_code)!= '' and ttl.ttl > 0 and ttl.ttl <= 4 and hour >= 8 and hour <= 12 and date = '2016-06-01--2016-06-15' and ap<=90 and ps180<=7
I am able to run it on Hive Console. But when running from Java code, I am getting this error:
[2016-12-30 12:39:24,409] ERROR tomcat-pool-1 com.mmt.rateRefresh.hive.HiveManager - error[Cloudera]JDBC A ResultSet was expected but not generated from query
[2016-12-30 12:39:24,409] ERROR tomcat-pool-1 com.mmt.rateRefresh.hive.HiveManager - error in query
Upvotes: 2
Views: 3160
Reputation: 51
You can do it using beeline command line tool:
beeline -u "jdbc:hive2://HIVESERVER/default" << EOF >> /tmp/log.txt 2>&1
Set hive.limit.query.max.table.partition=9000;select distinct ps169 as ... ;
!quit;
EOF
Is SQL in file - execute it:
beeline -u "jdbc:hive2://HIVESERVER/default" << EOF >> /tmp/log.txt 2>&1
!run /tmp/script.sql
!quit;
EOF
Additional you can define file with request result:
...
!record /tmp/script-output.txt
!run /tmp/script.sql
!record
...
Upvotes: 1
Reputation: 4957
It is NOT possible to run two query in one execute statement .
The only way: Run them as separate queries.
The property you are setting "Set hive.limit.query.max.table.partition=9000" will be present in session.(Java api takes care)
Note Use same Connection to execute both the statement.
Upvotes: 3