use of io.prestosql.testing.TestingMetadata.TestingColumnHandle in project hetu-core by openlookeng.
the class TestLocalProperties method testJsonSerialization.
@Test
public void testJsonSerialization() throws Exception {
ObjectMapper mapper = new ObjectMapperProvider().get().registerModule(new SimpleModule().addDeserializer(ColumnHandle.class, new JsonDeserializer<ColumnHandle>() {
@Override
public ColumnHandle deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
return new ObjectMapperProvider().get().readValue(jsonParser, TestingColumnHandle.class);
}
}));
TestingColumnHandle columnHandle = new TestingColumnHandle("a");
LocalProperty<ColumnHandle> property1 = new ConstantProperty<>(columnHandle);
assertEquals(property1, mapper.readValue(mapper.writeValueAsString(property1), new TypeReference<LocalProperty<ColumnHandle>>() {
}));
LocalProperty<ColumnHandle> property2 = new SortingProperty<>(columnHandle, SortOrder.ASC_NULLS_FIRST);
assertEquals(property2, mapper.readValue(mapper.writeValueAsString(property2), new TypeReference<LocalProperty<ColumnHandle>>() {
}));
LocalProperty<ColumnHandle> property3 = new GroupingProperty<>(ImmutableList.of(columnHandle));
assertEquals(property3, mapper.readValue(mapper.writeValueAsString(property3), new TypeReference<LocalProperty<ColumnHandle>>() {
}));
}
use of io.prestosql.testing.TestingMetadata.TestingColumnHandle in project hetu-core by openlookeng.
the class TestTypeValidator method setUp.
@BeforeMethod
public void setUp() {
planSymbolAllocator = new PlanSymbolAllocator();
columnA = planSymbolAllocator.newSymbol("a", BIGINT);
columnB = planSymbolAllocator.newSymbol("b", INTEGER);
columnC = planSymbolAllocator.newSymbol("c", DOUBLE);
columnD = planSymbolAllocator.newSymbol("d", DATE);
// varchar(3), to test type only coercion
columnE = planSymbolAllocator.newSymbol("e", VarcharType.createVarcharType(3));
Map<Symbol, ColumnHandle> assignments = ImmutableMap.<Symbol, ColumnHandle>builder().put(columnA, new TestingColumnHandle("a")).put(columnB, new TestingColumnHandle("b")).put(columnC, new TestingColumnHandle("c")).put(columnD, new TestingColumnHandle("d")).put(columnE, new TestingColumnHandle("e")).build();
baseTableScan = new TableScanNode(newId(), TEST_TABLE_HANDLE, ImmutableList.copyOf(assignments.keySet()), assignments, TupleDomain.all(), Optional.empty(), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false);
}
use of io.prestosql.testing.TestingMetadata.TestingColumnHandle in project hetu-core by openlookeng.
the class TestEffectivePredicateExtractor method setUp.
@BeforeMethod
public void setUp() {
scanAssignments = ImmutableMap.<Symbol, ColumnHandle>builder().put(A, new TestingColumnHandle("a")).put(B, new TestingColumnHandle("b")).put(C, new TestingColumnHandle("c")).put(D, new TestingColumnHandle("d")).put(E, new TestingColumnHandle("e")).put(F, new TestingColumnHandle("f")).build();
Map<Symbol, ColumnHandle> assignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C, D, E, F)));
baseTableScan = TableScanNode.newInstance(newId(), makeTableHandle(TupleDomain.all()), ImmutableList.copyOf(assignments.keySet()), assignments, ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false);
expressionNormalizer = new ExpressionIdentityNormalizer();
}
use of io.prestosql.testing.TestingMetadata.TestingColumnHandle in project hetu-core by openlookeng.
the class TestPhasedExecutionSchedule method createTableScanPlanFragment.
public static PlanFragment createTableScanPlanFragment(String name, ReuseExchangeOperator.STRATEGY strategy, UUID reuseTableScanMappingId, Integer consumerTableScanNodeCount) {
Symbol symbol = new Symbol("column");
PlanNode planNode = TableScanNode.newInstance(new PlanNodeId(name), TEST_TABLE_HANDLE, ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), strategy, reuseTableScanMappingId, consumerTableScanNodeCount, false);
return createFragment(planNode);
}
use of io.prestosql.testing.TestingMetadata.TestingColumnHandle in project hetu-core by openlookeng.
the class TestPhasedExecutionSchedule method createBroadcastJoinPlanFragment.
private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) {
Symbol symbol = new Symbol("column");
PlanNode tableScan = TableScanNode.newInstance(new PlanNodeId(name), TEST_TABLE_HANDLE, ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false);
RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of(), Optional.empty(), REPLICATE);
PlanNode join = new JoinNode(new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder().addAll(tableScan.getOutputSymbols()).addAll(remote.getOutputSymbols()).build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED), Optional.empty(), ImmutableMap.of());
return createFragment(join);
}
Aggregations