You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Raghuraman Murugaiyan (JIRA)" <ji...@apache.org> on 2017/08/31 03:01:00 UTC

[jira] [Created] (HIVE-17418) Hive Query fails with ClassCast Exception when Table and partitions are having different fileformat

Raghuraman Murugaiyan created HIVE-17418:
--------------------------------------------

             Summary: Hive Query fails with ClassCast Exception when Table and partitions are having different fileformat
                 Key: HIVE-17418
                 URL: https://issues.apache.org/jira/browse/HIVE-17418
             Project: Hive
          Issue Type: Bug
          Components: Hive
    Affects Versions: 2.2.0, 2.1.1
            Reporter: Raghuraman Murugaiyan


We have a partitioned table in RCFILE format, and it has a partition in ORC format. When we query the data from that partition, it gives the following runtime error:


2017-08-30 20:16:41,035 FATAL [IPC Server handler 3 on 39129] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Task: attempt_1503513879002_0178_m_000000_0 - exited : java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row [Error getting row data with exception java.lang.ClassCastException: org.apache.hadoop.hive.ql.io.orc.OrcStruct cannot be cast to org.apache.hadoop.hive.serde2.columnar.ColumnarStructBase
	at org.apache.hadoop.hive.serde2.objectinspector.ColumnarStructObjectInspector.getStructFieldData(ColumnarStructObjectInspector.java:61)
	at org.apache.hadoop.hive.serde2.objectinspector.UnionStructObjectInspector.getStructFieldData(UnionStructObjectInspector.java:157)
	at org.apache.hadoop.hive.serde2.SerDeUtils.buildJSONString(SerDeUtils.java:364)
	at org.apache.hadoop.hive.serde2.SerDeUtils.getJSONString(SerDeUtils.java:200)


How to reproduce:

Queries to generate related tables:
CREATE EXTERNAL TABLE test_table (
key INT,
value STRING
)
PARTITIONED BY (
data_date STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS RCFILE;

CREATE TABLE data_table (
key INT,
value STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS ORC;

2. Queries to generate partition:
ALTER TABLE test_table ADD PARTITION (data_date=20170829);
ALTER TABLE test_table PARTITION (data_date=20170829) SET FILEFORMAT ORC;

3. Query to load data:
INSERT INTO TABLE test_table PARTITION (data_date=20170829)
SELECT key, value FROM data_table
WHERE data_date=20170829;

4. Query to reproduce the error:
SELECT key, value FROM test_table
WHERE data_date=20170829;


I have run this query in Hive 2.1.1 and Hive 2.2.1 where it got failed and ran fine in the Hive 1.2.1 built. Please advise us, whether we can create a Table in one file format and the new partitions in a different file format? 




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)