Hi All,

So I have a table, say *test_table*. It has 3 columns, "a", "b", and "c".
For simplicity, let's say all are of type STRING. Say the table, when
created, was partitioned on fields "a" and "b".

Now, I have the following query:

*INSERT INTO TABLE* *test_table*
*PARTITION* (a="foo", b=NULL)
*SELECT* stack(1,
"this is a test string") *AS* (c)
*FROM* dual;

Here, dual is dummy table with one row and column, with value 1.

The problem is, the above query gives an error:

FAILED: ParseException line 2:22 cannot recognize input near 'NULL' ')'
'SELECT' in constant

Any idea why this is so? I'd like to insert a NULL in place of field "b",
so that my resulting row looks like:

"this is a test string"  "foo"  NULL

I tried the following query, however, and that seemed to run:
*INSERT INTO TABLE* test_table
*PARTITION* (a="foo", b)
*SELECT* stack(1,
"this is a test string",
*CAST*(NULL *AS* STRING)) *AS* (c, b)
*FROM* dual;

If I understand correctly, it is taking the last value in the resultant row
produced by the stack() UDTF, and assigning it's value to "b" (which is
NULL, which is what I want). But, I'm getting the following row when I do a
"SELECT * .." on test_table:

this is a test string foo *__HIVE_DEFAULT_PARTITION__*

What is this "__HIVE_DEFAULT_PARTITION__"? How can I change it to be NULL?

P.S. I'm new to partitioning in Hive.

Best Regards,

Nishant Kelkar

Reply via email to