diff --git ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java index 70003ed..ccb39da 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java @@ -1162,7 +1162,9 @@ private AcidDirInfo callInternal() throws IOException { private List stripes; private List stripeStats; private List fileTypes; - private boolean[] readerIncluded; + private boolean[] included; // The included columns from the Hive configuration. + private boolean[] readerIncluded; // The included columns of the reader / file schema that + // include ACID columns if present. private final boolean isOriginal; private final List deltas; private final boolean hasBase; @@ -1357,7 +1359,7 @@ public String toString() { if ((deltas == null || deltas.isEmpty()) && context.sarg != null) { String[] colNames = extractNeededColNames((readerTypes == null ? fileTypes : readerTypes), - context.conf, readerIncluded, isOriginal); + context.conf, included, isOriginal); if (colNames == null) { LOG.warn("Skipping split elimination for {} as column names is null", file.getPath()); } else { @@ -1479,15 +1481,18 @@ private void populateAndCacheStripeDetails() throws IOException { fileTypes = orcTail.getTypes(); TypeDescription fileSchema = OrcUtils.convertTypeFromProtobuf(fileTypes, 0); if (readerTypes == null) { - readerIncluded = genIncludedColumns(fileTypes, context.conf, isOriginal); - evolution = new SchemaEvolution(fileSchema, readerIncluded); + included = genIncludedColumns(fileTypes, context.conf, isOriginal); + evolution = new SchemaEvolution(fileSchema, included); + readerIncluded = included; } else { - // The readerSchema always comes in without ACID columns. - readerIncluded = genIncludedColumns(readerTypes, context.conf, /* isOriginal */ true); - if (readerIncluded != null && !isOriginal) { + // The reader schema always comes in without ACID columns. + included = genIncludedColumns(readerTypes, context.conf, /* isOriginal */ true); + if (included != null && !isOriginal) { // We shift the include columns here because the SchemaEvolution constructor will // add the ACID event metadata the readerSchema... - readerIncluded = shiftReaderIncludedForAcid(readerIncluded); + readerIncluded = shiftReaderIncludedForAcid(included); + } else { + readerIncluded = included; } TypeDescription readerSchema = OrcUtils.convertTypeFromProtobuf(readerTypes, 0); evolution = new SchemaEvolution(fileSchema, readerSchema, readerIncluded); diff --git ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2WithSplitUpdate.java ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2WithSplitUpdate.java index becb22a..c2330cb 100644 --- ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2WithSplitUpdate.java +++ ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2WithSplitUpdate.java @@ -60,42 +60,6 @@ public void setUp() throws Exception { @Override @Test - public void testOrcPPD() throws Exception { - final String defaultUnset = "unset"; - String oldSplitStrategyValue = hiveConf.get(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname, defaultUnset); - // TODO: Setting split strategy as 'BI' is workaround for HIVE-14448 until it is resolved. - hiveConf.set(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname, "BI"); - - super.testOrcPPD(); - - // Restore the previous value for split strategy, or unset if not previously set. - if (oldSplitStrategyValue.equals(defaultUnset)) { - hiveConf.unset(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname); - } else { - hiveConf.set(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname, oldSplitStrategyValue); - } - } - - @Override - @Test - public void testOrcNoPPD() throws Exception { - final String defaultUnset = "unset"; - String oldSplitStrategyValue = hiveConf.get(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname, defaultUnset); - // TODO: Setting split strategy as 'BI' is workaround for HIVE-14448 until it is resolved. - hiveConf.set(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname, "BI"); - - super.testOrcNoPPD(); - - // Restore the previous value for split strategy, or unset if not previously set. - if (oldSplitStrategyValue.equals(defaultUnset)) { - hiveConf.unset(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname); - } else { - hiveConf.set(HiveConf.ConfVars.HIVE_ORC_SPLIT_STRATEGY.varname, oldSplitStrategyValue); - } - } - - @Override - @Test public void testInitiatorWithMultipleFailedCompactions() throws Exception { // Test with split-update turned on. testInitiatorWithMultipleFailedCompactionsForVariousTblProperties("'transactional'='true','transactional_properties'='default'");