Create new PageProcessor for each TestColumnarPageProcessor test
@@ -20,7 +20,6 @@ import com.facebook.presto.spi.type.Type;
import com.facebook.presto.sql.gen.ExpressionCompiler;
import com.facebook.presto.sql.gen.PageFunctionCompiler;
import com.google.common.collect.ImmutableList;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.List;
@@ -42,18 +41,11 @@ public class TestColumnarPageProcessor
private static final int POSITIONS = 100;
private final List<Type> types = ImmutableList.of(BIGINT, VARCHAR);
private final MetadataManager metadata = createTestMetadataManager();
- private PageProcessor processor;
-
- @BeforeMethod
- public void setUp()
- {
- processor = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0))
- .compilePageProcessor(Optional.empty(), ImmutableList.of(field(0, types.get(0)), field(1, types.get(1))), MAX_BATCH_SIZE).get();
- }
@Test
public void testProcess()
{
+ PageProcessor processor = newPageProcessor();
Page page = createPage(types, false);
Page outputPage = getOnlyElement(processor.process(SESSION, new DriverYieldSignal(), page)).orElseThrow(() -> new AssertionError("page is not present"));
assertPageEquals(types, outputPage, page);
@@ -62,6 +54,7 @@ public class TestColumnarPageProcessor
@Test
public void testProcessWithDictionary()
{
+ PageProcessor processor = newPageProcessor();
Page page = createPage(types, true);
Page outputPage = getOnlyElement(processor.process(SESSION, new DriverYieldSignal(), page)).orElseThrow(() -> new AssertionError("page is not present"));
assertPageEquals(types, outputPage, page);
@@ -71,4 +64,10 @@ public class TestColumnarPageProcessor
{
return dictionary ? createSequencePageWithDictionaryBlocks(types, POSITIONS) : createSequencePage(types, POSITIONS);
}
+
+ private PageProcessor newPageProcessor()
+ {
+ return new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0))
+ .compilePageProcessor(Optional.empty(), ImmutableList.of(field(0, types.get(0)), field(1, types.get(1))), MAX_BATCH_SIZE).get();
+ }
}
