Brad Ruderman created HIVE-5785:
-----------------------------------
Summary: Hive Metadata Thinks Table Partitions Are All Strings
Key: HIVE-5785
URL: https://issues.apache.org/jira/browse/HIVE-5785
Project: Hive
Issue Type: Bug
Components: Database/Schema
Reporter: Brad Ruderman
Priority: Minor
hive (bruderman)> CREATE TABLE test (a int, b int) partitioned by (dt int);
OK
Time taken: 0.101 seconds
hive (bruderman)> desc test;
OK
col_name data_type comment
a int
b int
dt int
Time taken: 0.093 seconds
hive (bruderman)> CREATE VIEW v_test AS SELECT * FROM test;
OK
a b dt
Time taken: 0.042 seconds
hive (bruderman)> desc v_test;
OK
col_name data_type comment
a int
b int
dt string
Time taken: 0.098 seconds
hive (bruderman)>
------------------------------------------------------------------------------
When I have a table which is partitioned by an int/bigint, and I go to import
that table into Tableau, Tableau detects the partition column as being a string
thus I cannot use it for incremental refreshes. I thought it was a tableau bug,
however when creating a view: select * from table, then describing the view, I
see that the partition column is a string, thus I think the issue is within
hive.
Finally the issue extends when interfacing through hive server 1/hive server 2:
(hs2)➜ pyhs2 git:(master) python test.py
None
[{'comment': None, 'columnName': 'a', 'type': 'INT_TYPE'}, {'comment': None,
'columnName': 'b', 'type': 'INT_TYPE'}, {'comment': None, 'columnName': 'dt',
'type': 'STRING_TYPE'}]
Where the column is detected a string.
The workaround is to create a view:
CREATE VIEW v_test AS
SELECT t.*, CAST(t.dt as INT) dt_part
FROM test
And using that. This issue extended beyond Tableau and affects anything using
the HiveServer1/2.
Thanks!
--
This message was sent by Atlassian JIRA
(v6.1#6144)