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

Reply via email to