Questions tagged [hive-query]

82 questions
1
vote
1 answer

FETCH the latest partition from HIVE table

Hi I am very much new to this. I have three columns YEAR, MONTH,DAY in INTEGER format. I want to load the script and combine YEAR,MONTH,DAY as single column and fetch the maximum. I tried like, Load year,month,date from HIVE.`abc`.`abc1'; SELECT…
jai chu
  • 45
  • 1
  • 7
1
vote
2 answers

How to find the length of hive json array field using hive query

"keys": [ "2324", "abc"] This is one of the key of hive JSON. I want to find the length of the "keys" field. i am reading the JSON using get_json_object() method. This is the way I am doing but getting error: select count(*) from table_name where…
Aditya
  • 25
  • 1
  • 5
1
vote
1 answer

Insert into hive using QL not running

I want to insert simple query into hive table; I create table using following code create table t(id int, f1 String, f2 int); and try to insert insert into t values (1, '123', 1); A task is created, but not executed. Query ID =…
1
vote
1 answer

Hive throwing ParseException while exporting a csv

hive -e 'SELECT *, MIN(HIGH) OVER(PARTITION BY SYMBOL ORDER BY TIMESTAMP) AS MIN_YEARLY, MAX(HIGH) OVER(PARTITION BY SYMBOL ORDER BY TIMESTAMP) AS MAX_YEARLY, AVG(HIGH) OVER(PARTITION BY SYMBOL ORDER BY TIMESTAMP) AS AVG_YEARLY, STDDEV(HIGH)…
1
vote
1 answer

Find missing number from a sequence for each value in hive

I have a table like below- User-id | sequence 1 0 1 1 1 2 2 1 3 2 here 0 1 and 2 are fixed sequence which a user can at max have, now i want a flag as N where any sequence is missing for a user else flag should be Y.I can say output…
1
vote
1 answer

Hive Query: How to use group by with rank?

I have a table like below year int month int …
tuk
  • 5,941
  • 14
  • 79
  • 162
1
vote
0 answers

How to set mapreduce job name for hive query child jobs?

our hive query creates 9 map-reduce jobs and 17 stages(when I ran EXPLAIN command, output showed 17 STAGES and STAGE DEPENDENCIES). Every child job has the same mapreduce.job.name To distinguish these child jobs, is there any way I can set the…
1
vote
1 answer

Primary keys and indexes in Hive query language is poosible or not?

We are trying to migrate oracle tables to hive and process them. Currently the tables in oracle has primary key,foreign key and unique key constraints. Can we replicate the same in hive? We are doing some analysis on how to implement it.
Sowmya
  • 11
  • 1
  • 2
1
vote
1 answer

Spark SQL Performance Tuning

I work in an ETL development team where we use Spark-SQL to transform the data by creating and progressing with several intermediate temporary views in sequence and finally ending up with another temp view whose data is then copied into the target…
1
vote
2 answers

ID field to be prefixed with AB_ (Example: AB_00yyhhgdbdbd)

I'm trying to select specific fields in a hive table and save the result in a text file. The main problem is that, for one of the fields in the table, I want to add prefix in all the rows of a particular column. Currently, all rows of that column in…
Oye
  • 57
  • 2
  • 7
1
vote
2 answers

Hive: No results are displayed from the query

I am writing a query on this table to get the sum of size for all the directories, group by directory where date is yesterday. I am getting no output from the below query. test.id test.path test.size test.date 1 …
Incognito
  • 135
  • 4
  • 14
1
vote
1 answer

Divide each value of a column by the total count of records in a table

A query that is capable of dividing each value of a column by the total number of records in the table I tried the following query select ( (p.rank/count(*)) * 100 ) as rankratio from RankTable p; I see an error and not able to execute the…
sridhar
  • 329
  • 4
  • 16
1
vote
0 answers

Double quotes in output file when running intellij jar in oozie workflow

I have created an oozie XML workflow to fetch data from a hive database table and export to CSV file. Oozie workflow has three actions as below Executing Jar file created from intelliJ Success email Failure email Jar file is generated from…
1
vote
0 answers

Why cannot Hive Map key (i16) cast upside when search by key?

There is Hive table that is defined by thrift. struct A { 1: optional map myMap; } I have tried a few queries to search through this table. // this one gets an error: select myMap[10] from A where myMap[10] is not null Line 1:74…
Hao Tan
  • 1,530
  • 2
  • 13
  • 20
1
vote
1 answer

UNION ALL doesn't generate any data in Hive

I am trying to do UNION ALL for three different tables with same DDL structure but the final output is generating zero rows. I have no clue with what's happening in the underlying execution. Could anybody share your thoughts on this? My sample Hive…
Teja
  • 13,214
  • 36
  • 93
  • 155