You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Petter von Dolwitz (Hem)" <pe...@gmail.com> on 2014/03/11 09:21:55 UTC
Views show different type for partition column compared to table
Hi,
I have a table partitioned where the partition column is of type INT. When
creating a view on this table the partition column shows up as STRING. I
can still however issue queries towards the view treating the partition
column as an INT, e.g. SELECT * from myview where partitionCol=1;
What is the reason for this behaviour? It does not seems to be correct. I
am on Hive 0.10.
CREATE EXTERNAL TABLE IF NOT EXISTS mytable (
col1 STRING)
PARTITIONED BY (partition_col INT)
ROW FORMAT SERDE 'mySerde'
STORED AS INPUTFORMAT 'myInputFormat' OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION 'myLocation';
CREATE VIEW IF NOT EXISTS myView
(col1, partition_col)
PARTITIONED ON (partition_col)
AS SELECT col1, partition_col
FROM mytable
WHERE col1='value1';
describe mytable;
OK
col1 string from deserializer
partition_col int None
# Partition Information
# col_name data_type comment
partition_col int None
describe myview;
OK
col1 string None
partition_col string None
# Partition Information
# col_name data_type comment
partition_col string None
Thanks,
Petter