orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dongjoon-hyun <...@git.apache.org>
Subject [GitHub] orc pull request #160: ORC-233 Allow `orc.include.columns` to be empty
Date Tue, 22 Aug 2017 07:04:12 GMT
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/orc/pull/160#discussion_r134399015
  
    --- Diff: java/mapreduce/src/test/org/apache/orc/mapreduce/TestMapreduceOrcOutputFormat.java
---
    @@ -153,11 +153,55 @@ public void testColumnSelection() throws Exception {
         assertEquals(false, reader.nextKeyValue());
       }
     
    +  @Test
    +  public void testColumnSelectionBlank() throws Exception {
    +    String typeStr = "struct<i:int,j:int,k:int>";
    +    OrcConf.MAPRED_OUTPUT_SCHEMA.setString(conf, typeStr);
    +    conf.set("mapreduce.output.fileoutputformat.outputdir", workDir.toString());
    +    conf.setInt(OrcConf.ROW_INDEX_STRIDE.getAttribute(), 1000);
    +    conf.setBoolean(OrcOutputFormat.SKIP_TEMP_DIRECTORY, true);
    +    TaskAttemptID id = new TaskAttemptID("jt", 0, TaskType.MAP, 0, 1);
    +    TaskAttemptContext attemptContext = new TaskAttemptContextImpl(conf, id);
    +    OutputFormat<NullWritable, OrcStruct> outputFormat =
    +            new OrcOutputFormat<OrcStruct>();
    +    RecordWriter<NullWritable, OrcStruct> writer =
    +            outputFormat.getRecordWriter(attemptContext);
     
    -  /**
    -   * Make sure that the writer ignores the OrcKey
    -   * @throws Exception
    -   */
    +    // write 4000 rows with the integer and the binary string
    +    TypeDescription type = TypeDescription.fromString(typeStr);
    +    OrcStruct row = (OrcStruct) OrcStruct.createValue(type);
    +    NullWritable nada = NullWritable.get();
    +    for (int r = 0; r < 3000; ++r) {
    +      row.setFieldValue(0, new IntWritable(r));
    +      row.setFieldValue(1, new IntWritable(r * 2));
    +      row.setFieldValue(2, new IntWritable(r * 3));
    +      writer.write(nada, row);
    +    }
    +    writer.close(attemptContext);
    +
    +    conf.set(OrcConf.INCLUDE_COLUMNS.getAttribute(), "");
    +    FileSplit split = new FileSplit(new Path(workDir, "part-m-00000.orc"),
    +            0, 1000000, new String[0]);
    +    RecordReader<NullWritable, OrcStruct> reader =
    +            new OrcInputFormat<OrcStruct>().createRecordReader(split,
    --- End diff --
    
    ditto.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message