use of org.apache.calcite.rel.logical.LogicalTableScan in project hive by apache.
the class TestHiveReduceExpressionsWithStatsRule method before.
@Before
public void before() {
HepProgramBuilder programBuilder = new HepProgramBuilder();
programBuilder.addRuleInstance(HiveReduceExpressionsWithStatsRule.INSTANCE);
planner = new HepPlanner(programBuilder.build());
JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl();
RexBuilder rexBuilder = new RexBuilder(typeFactory);
final RelOptCluster optCluster = RelOptCluster.create(planner, rexBuilder);
RelDataType rowTypeMock = typeFactory.createStructType(MyRecord.class);
Mockito.doReturn(rowTypeMock).when(tableMock).getRowType();
LogicalTableScan tableScan = LogicalTableScan.create(optCluster, tableMock, Collections.emptyList());
doReturn(tableScan).when(tableMock).toRel(ArgumentMatchers.any());
Mockito.doReturn(tableMock).when(schemaMock).getTableForMember(Matchers.any());
statObj = new ColStatistics("_int", "int");
Mockito.doReturn(Lists.newArrayList(statObj)).when(tableMock).getColStat(Matchers.anyListOf(Integer.class), Matchers.eq(false));
Mockito.doReturn(hiveTableMDMock).when(tableMock).getHiveTableMD();
Mockito.doReturn(tableParams).when(hiveTableMDMock).getParameters();
builder = HiveRelFactories.HIVE_BUILDER.create(optCluster, schemaMock);
StatsSetupConst.setStatsStateForCreateTable(tableParams, Lists.newArrayList("_int"), StatsSetupConst.TRUE);
tableParams.put(StatsSetupConst.ROW_COUNT, "3");
}
use of org.apache.calcite.rel.logical.LogicalTableScan in project hive by apache.
the class TestHivePointLookupOptimizerRule method before.
@Before
public void before() {
HepProgramBuilder programBuilder = new HepProgramBuilder();
programBuilder.addRuleInstance(new HivePointLookupOptimizerRule.FilterCondition(2));
planner = new HepPlanner(programBuilder.build());
JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl();
RexBuilder rexBuilder = new RexBuilder(typeFactory);
final RelOptCluster optCluster = RelOptCluster.create(planner, rexBuilder);
RelDataType rowTypeMock = typeFactory.createStructType(MyRecord.class);
doReturn(rowTypeMock).when(tableMock).getRowType();
LogicalTableScan tableScan = LogicalTableScan.create(optCluster, tableMock, Collections.emptyList());
doReturn(tableScan).when(tableMock).toRel(ArgumentMatchers.any());
doReturn(tableMock).when(schemaMock).getTableForMember(any());
lenient().doReturn(hiveTableMDMock).when(tableMock).getHiveTableMD();
builder = HiveRelFactories.HIVE_BUILDER.create(optCluster, schemaMock);
}
use of org.apache.calcite.rel.logical.LogicalTableScan in project hive by apache.
the class TestRelSignature method before.
@Before
public void before() {
HepProgramBuilder programBuilder = new HepProgramBuilder();
programBuilder.addRuleInstance(new HivePointLookupOptimizerRule.FilterCondition(2));
planner = new HepPlanner(programBuilder.build());
JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl();
RexBuilder rexBuilder = new RexBuilder(typeFactory);
final RelOptCluster optCluster = RelOptCluster.create(planner, rexBuilder);
RelDataType rowTypeMock = typeFactory.createStructType(MyRecord.class);
LogicalTableScan tableScan = LogicalTableScan.create(optCluster, tableMock, Collections.emptyList());
doReturn(tableScan).when(tableMock).toRel(ArgumentMatchers.any());
doReturn(rowTypeMock).when(tableMock).getRowType();
doReturn(tableMock).when(schemaMock).getTableForMember(Matchers.any());
lenient().doReturn(hiveTableMDMock).when(tableMock).getHiveTableMD();
builder = HiveRelFactories.HIVE_BUILDER.create(optCluster, schemaMock);
}
Aggregations