Questions tagged [hiveql]
7 questions
1
vote
0 answers
How to pass multiple values into hive hql for the same hivevar
Requirement :
My Hql has below script in which I want to pass values into the where clause dynamically. How do I dynamically pass using hivevar in below specific scenario where multiple values are expected. Or how do I invoke the hql with hivevar…
RaCh
- 11
- 1
1
vote
1 answer
For each tuple, get the name of the first column which is non-zero
I have a table in Hive which looks like:
| Name | 1990 | 1991 | 1992 | 1993 | 1994 |
| Rex | 0 | 0 | 1 | 1 | 1 |
| Max | 0 | 0 | 0 | 0 | 1 |
| Phil | 1 | 1 | 1 | 1 | 1 |
I would like to get, for each…
user2891462
- 113
- 3
1
vote
0 answers
Container is running beyond physical memory and killed on request (code 143)
I ran a query which involved a JOIN and an AVG operation:
SELECT
AVG(user_amount) AS average_user_per_game
FROM
(
SELECT
start_time
,end_time
,COUNT(DISTINCT ID) AS user_amount
FROM
(
SELECT
…
Memphis Meng
- 111
- 2
1
vote
0 answers
Can I assign an index to an exploded array?
I'm doing a LATERAL EXPLODE on an array in Hive, is there a way of reliably assigning a row number based on the array element? It looks like calling row_number() on the results of the LATERAL EXPLODE works, but I don't know if that is dependable.
It…
PhilHibbs
- 539
- 1
- 7
- 22
1
vote
0 answers
Defining external table on JSON with an @ sign in an element
I need to define a Hive external table onto a JSON file that has @ signs in its elements, e.g.
{ "data": { "@type": "person", "name": "Phil", "job": "Programmer" } }
This works:
create external table sandbox.test_table
( data…
PhilHibbs
- 539
- 1
- 7
- 22
0
votes
0 answers
Field with Top Ranking Field Name
Let's imagine a table structured like this:
Bucket
Red
Blue
Green
First
1
3
4
Second
6
5
2
What I'm trying to achieve is based on the values within each bucket, I'd like to generate another set of fields with the highest ranking,…
0
votes
1 answer
Can I MERGE INTO ... INSERT with a column list in Hive?
Here's a good example of a MERGE statement:
MERGE INTO target AS T
USING source AS S
ON T.ID = S.ID and T.tran_time = S.tran_time
WHEN MATCHED UPDATE SET quantity = S.quantity
WHEN MATCHED AND S.quantity IS NULL THEN DELETE
WHEN NOT MATCHED THEN…
PhilHibbs
- 539
- 1
- 7
- 22