diff --git a/orc/src/java/org/apache/orc/OrcFile.java b/orc/src/java/org/apache/orc/OrcFile.java index 98226f90a84efec1a0f6a6a1592acf079f3ca37d..8061089f84392014b9e7b80144507079c00b7d41 100644 --- a/orc/src/java/org/apache/orc/OrcFile.java +++ b/orc/src/java/org/apache/orc/OrcFile.java @@ -255,7 +255,7 @@ protected WriterOptions(Properties tableProperties, Configuration conf) { OrcConf.BLOCK_PADDING.getBoolean(tableProperties, conf); compressValue = CompressionKind.valueOf(OrcConf.COMPRESS.getString(tableProperties, - conf)); + conf).toUpperCase()); String versionName = OrcConf.WRITE_FORMAT.getString(tableProperties, conf); versionValue = Version.byName(versionName); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/ReaderImpl.java b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/ReaderImpl.java index 3e031ed6abb24390019b774836e5a373c8060d0e..1299c9cf5bb107ead439fa06ca45f2f4e03c5136 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/ReaderImpl.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/ReaderImpl.java @@ -585,7 +585,7 @@ private static FileMetaInfo extractMetaInfoFromFooter(FileSystem fs, MetaInfoObjExtractor(String codecStr, int bufferSize, int metadataSize, ByteBuffer footerBuffer) throws IOException { - this.compressionKind = org.apache.orc.CompressionKind.valueOf(codecStr); + this.compressionKind = org.apache.orc.CompressionKind.valueOf(codecStr.toUpperCase()); this.bufferSize = bufferSize; this.codec = WriterImpl.createCodec(compressionKind); this.metadataSize = metadataSize; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index 7d2595d23813a04811dc141dbfa5151d610f4eef..3bc2fddb346e7251c8a78f167637a7593def4b40 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -12543,4 +12543,5 @@ private void warn(String msg) { SessionState.getConsole().printInfo( String.format("Warning: %s", msg)); } + } diff --git a/ql/src/test/queries/clientpositive/orc_create.q b/ql/src/test/queries/clientpositive/orc_create.q index 57912ef856d40bc7049e7c631b2c43d48312bd65..06472008ed1a7e7f662a5c91f8a58e56c23f8be9 100644 --- a/ql/src/test/queries/clientpositive/orc_create.q +++ b/ql/src/test/queries/clientpositive/orc_create.q @@ -6,6 +6,7 @@ DROP TABLE orc_create_complex; DROP TABLE orc_create_staging; DROP TABLE orc_create_people_staging; DROP TABLE orc_create_people; +DROP TABLE if exists orc_create_cprl; CREATE TABLE orc_create_staging ( str STRING, @@ -119,8 +120,19 @@ SELECT COUNT(*) FROM orc_create_people where salary = 200.00 and state = 'Ca'; SELECT id, first_name, last_name, address FROM orc_create_people WHERE id > 90; +-- test create with lower case compression method. +CREATE TABLE orc_create_cprl (id int) +PARTITIONED BY (cdate date) +STORED AS ORC +TBLPROPERTIES ( +'orc.compress'='snappy'); +INSERT OVERWRITE table orc_create_cprl PARTITION (cdate = '2015-02-03') +SELECT 1 from src limit 1; +SELECT * from orc_create_cprl; + DROP TABLE orc_create; DROP TABLE orc_create_complex; DROP TABLE orc_create_staging; DROP TABLE orc_create_people_staging; DROP TABLE orc_create_people; +DROP TABLE orc_create_cprl; diff --git a/ql/src/test/results/clientpositive/orc_create.q.out b/ql/src/test/results/clientpositive/orc_create.q.out index e294dec2414aa275a25ff76a1d85f14cb091c2d8..3013fda021ce8758bfefcb57a2092eb29d7daec9 100644 --- a/ql/src/test/results/clientpositive/orc_create.q.out +++ b/ql/src/test/results/clientpositive/orc_create.q.out @@ -22,6 +22,10 @@ PREHOOK: query: DROP TABLE orc_create_people PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE orc_create_people POSTHOOK: type: DROPTABLE +PREHOOK: query: DROP TABLE if exists orc_create_cprl +PREHOOK: type: DROPTABLE +POSTHOOK: query: DROP TABLE if exists orc_create_cprl +POSTHOOK: type: DROPTABLE PREHOOK: query: CREATE TABLE orc_create_staging ( str STRING, mp MAP, @@ -678,6 +682,46 @@ POSTHOOK: Input: default@orc_create_people@state=Or 97 Dana Carter 814-601 Purus. Av. 98 Juliet Battle Ap #535-1965 Cursus St. 99 Wynter Vincent 626-8492 Mollis Avenue +PREHOOK: query: -- test create with lower case compression method. +CREATE TABLE orc_create_cprl (id int) +PARTITIONED BY (cdate date) +STORED AS ORC +TBLPROPERTIES ( +'orc.compress'='snappy') +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@orc_create_cprl +POSTHOOK: query: -- test create with lower case compression method. +CREATE TABLE orc_create_cprl (id int) +PARTITIONED BY (cdate date) +STORED AS ORC +TBLPROPERTIES ( +'orc.compress'='snappy') +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@orc_create_cprl +PREHOOK: query: INSERT OVERWRITE table orc_create_cprl PARTITION (cdate = '2015-02-03') +SELECT 1 from src limit 1 +PREHOOK: type: QUERY +PREHOOK: Input: default@src +PREHOOK: Output: default@orc_create_cprl@cdate=2015-02-03 +POSTHOOK: query: INSERT OVERWRITE table orc_create_cprl PARTITION (cdate = '2015-02-03') +SELECT 1 from src limit 1 +POSTHOOK: type: QUERY +POSTHOOK: Input: default@src +POSTHOOK: Output: default@orc_create_cprl@cdate=2015-02-03 +POSTHOOK: Lineage: orc_create_cprl PARTITION(cdate=2015-02-03).id SIMPLE [] +PREHOOK: query: SELECT * from orc_create_cprl +PREHOOK: type: QUERY +PREHOOK: Input: default@orc_create_cprl +PREHOOK: Input: default@orc_create_cprl@cdate=2015-02-03 +#### A masked pattern was here #### +POSTHOOK: query: SELECT * from orc_create_cprl +POSTHOOK: type: QUERY +POSTHOOK: Input: default@orc_create_cprl +POSTHOOK: Input: default@orc_create_cprl@cdate=2015-02-03 +#### A masked pattern was here #### +1 2015-02-03 PREHOOK: query: DROP TABLE orc_create PREHOOK: type: DROPTABLE PREHOOK: Input: default@orc_create @@ -718,3 +762,11 @@ POSTHOOK: query: DROP TABLE orc_create_people POSTHOOK: type: DROPTABLE POSTHOOK: Input: default@orc_create_people POSTHOOK: Output: default@orc_create_people +PREHOOK: query: DROP TABLE orc_create_cprl +PREHOOK: type: DROPTABLE +PREHOOK: Input: default@orc_create_cprl +PREHOOK: Output: default@orc_create_cprl +POSTHOOK: query: DROP TABLE orc_create_cprl +POSTHOOK: type: DROPTABLE +POSTHOOK: Input: default@orc_create_cprl +POSTHOOK: Output: default@orc_create_cprl