Search in sources :

Example 1 with ColumnarSplitSizeEstimator

use of org.apache.hadoop.hive.ql.exec.tez.ColumnarSplitSizeEstimator in project hive by apache.

the class TestInputOutputFormat method testACIDSplitStrategy.

@Test
public void testACIDSplitStrategy() throws Exception {
    conf.set("bucket_count", "2");
    OrcInputFormat.Context context = new OrcInputFormat.Context(conf);
    MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/a/delta_000_001/part-00", 1000, new byte[1], new MockBlock("host1")), new MockFile("mock:/a/delta_000_001/part-01", 1000, new byte[1], new MockBlock("host1")), new MockFile("mock:/a/delta_001_002/part-02", 1000, new byte[1], new MockBlock("host1")), new MockFile("mock:/a/delta_001_002/part-03", 1000, new byte[1], new MockBlock("host1")));
    OrcInputFormat.FileGenerator gen = new OrcInputFormat.FileGenerator(context, fs, new MockPath(fs, "mock:/a"), false, null);
    List<OrcInputFormat.SplitStrategy<?>> splitStrategies = createSplitStrategies(context, gen);
    assertEquals(true, splitStrategies.get(0) instanceof OrcInputFormat.ACIDSplitStrategy);
    List<OrcSplit> splits = ((OrcInputFormat.ACIDSplitStrategy) splitStrategies.get(0)).getSplits();
    ColumnarSplitSizeEstimator splitSizeEstimator = new ColumnarSplitSizeEstimator();
    for (OrcSplit split : splits) {
        assertEquals(Integer.MAX_VALUE, splitSizeEstimator.getEstimatedSize(split));
    }
    assertEquals(2, splits.size());
}
Also used : Context(org.apache.hadoop.hive.ql.io.orc.OrcInputFormat.Context) Context(org.apache.hadoop.hive.ql.io.orc.OrcInputFormat.Context) SplitStrategy(org.apache.hadoop.hive.ql.io.orc.OrcInputFormat.SplitStrategy) ColumnarSplitSizeEstimator(org.apache.hadoop.hive.ql.exec.tez.ColumnarSplitSizeEstimator) Test(org.junit.Test)

Aggregations

ColumnarSplitSizeEstimator (org.apache.hadoop.hive.ql.exec.tez.ColumnarSplitSizeEstimator)1 Context (org.apache.hadoop.hive.ql.io.orc.OrcInputFormat.Context)1 SplitStrategy (org.apache.hadoop.hive.ql.io.orc.OrcInputFormat.SplitStrategy)1 Test (org.junit.Test)1