2222import org .apache .doris .analysis .SlotRef ;
2323import org .apache .doris .analysis .TupleDescriptor ;
2424import org .apache .doris .analysis .TupleId ;
25- import org .apache .doris .catalog .AggregateType ;
2625import org .apache .doris .catalog .Column ;
27- import org .apache .doris .catalog .HashDistributionInfo ;
2826import org .apache .doris .catalog .KeysType ;
2927import org .apache .doris .catalog .OlapTable ;
30- import org .apache .doris .catalog .PartitionInfo ;
31- import org .apache .doris .catalog .Type ;
3228import org .apache .doris .common .UserException ;
3329import org .apache .doris .nereids .NereidsPlanner ;
3430import org .apache .doris .nereids .properties .DataTrait ;
4945import org .apache .doris .nereids .trees .plans .physical .PhysicalProject ;
5046import org .apache .doris .nereids .types .IntegerType ;
5147import org .apache .doris .nereids .util .PlanChecker ;
48+ import org .apache .doris .nereids .util .PlanConstructor ;
5249import org .apache .doris .planner .AggregationNode ;
5350import org .apache .doris .planner .OlapScanNode ;
5451import org .apache .doris .planner .PlanFragment ;
6158import org .apache .doris .thrift .TExplainLevel ;
6259import org .apache .doris .thrift .TPlanNode ;
6360import org .apache .doris .thrift .TScanRangeLocations ;
64- import org .apache .doris .thrift .TStorageType ;
6561import org .apache .doris .utframe .TestWithFeService ;
6662
6763import com .google .common .collect .ImmutableList ;
@@ -104,26 +100,14 @@ protected void runBeforeAll() throws Exception {
104100 @ Test
105101 public void testOlapPrune () throws Exception {
106102 LogicalProperties placeHolder = Mockito .mock (LogicalProperties .class );
107- List <Column > columns = ImmutableList .of (
108- new Column ("id" , Type .INT , true , AggregateType .NONE , "0" , "" ),
109- new Column ("name" , Type .STRING , true , AggregateType .NONE , "" , "" ),
110- new Column ("value" , Type .INT , false , AggregateType .SUM , "0" , "" ));
111- OlapTable t1 = new OlapTable (0 , "t1" , columns , KeysType .AGG_KEYS , new PartitionInfo (),
112- new HashDistributionInfo (3 , ImmutableList .of (columns .get (0 ))));
113- t1 .setIndexMeta (-1 , "t1" , t1 .getFullSchema (), 0 , 0 , (short ) 0 , TStorageType .COLUMN ,
114- KeysType .AGG_KEYS );
103+ OlapTable t1 = PlanConstructor .newOlapTable (0 , "t1" , 0 , KeysType .AGG_KEYS );
115104 List <String > qualifier = new ArrayList <>();
116105 qualifier .add ("test" );
117- List <Slot > t1Output = new ArrayList <>();
118106 SlotReference col1 = SlotReference .fromColumn (StatementScopeIdGenerator .newExprId (),
119107 t1 , t1 .getBaseSchema ().get (0 ), qualifier );
120108 SlotReference col2 = SlotReference .fromColumn (StatementScopeIdGenerator .newExprId (),
121109 t1 , t1 .getBaseSchema ().get (1 ), qualifier );
122- SlotReference col3 = SlotReference .fromColumn (StatementScopeIdGenerator .newExprId (),
123- t1 , t1 .getBaseSchema ().get (2 ), qualifier );
124- t1Output .add (col1 );
125- t1Output .add (col2 );
126- t1Output .add (col3 );
110+ List <Slot > t1Output = ImmutableList .of (col1 , col2 );
127111 LogicalProperties t1Properties = new LogicalProperties (new Supplier <List <Slot >>() {
128112 @ Override
129113 public List <Slot > get () {
@@ -135,22 +119,22 @@ public DataTrait get() {
135119 return DataTrait .EMPTY_TRAIT ;
136120 }
137121 });
138- PhysicalOlapScan scan = new PhysicalOlapScan (StatementScopeIdGenerator .newRelationId (), t1 , qualifier , t1 . getBaseIndexId (),
139- Collections .emptyList (), Collections .emptyList (), null , PreAggStatus .on (),
140- ImmutableList .of (), Optional .empty (), t1Properties , Optional .empty (),
141- ImmutableList .of (), ImmutableList .of (), ImmutableList . of (), Optional .empty (),
142- Optional .empty (), ImmutableList . of (), Optional . empty () );
122+ PhysicalOlapScan scan = new PhysicalOlapScan (StatementScopeIdGenerator .newRelationId (), t1 , qualifier ,
123+ t1 . getBaseIndexId (), Collections .emptyList (), Collections .emptyList (), null , PreAggStatus .on (),
124+ ImmutableList .of (), Optional .empty (), t1Properties , Optional .empty (), ImmutableList . of (),
125+ ImmutableList .of (), ImmutableList .of (), Optional . empty (), Optional .empty (), ImmutableList . of (),
126+ Optional .empty ());
143127 Literal t1FilterRight = new IntegerLiteral (1 );
144128 Expression t1FilterExpr = new GreaterThan (col1 , t1FilterRight );
145129 PhysicalFilter <PhysicalOlapScan > filter =
146130 new PhysicalFilter <>(ImmutableSet .of (t1FilterExpr ), placeHolder , scan );
147- List <NamedExpression > filterProjectList = new ArrayList <>();
148- filterProjectList .add (col2 );
149- PhysicalProject <PhysicalFilter <PhysicalOlapScan >> filterProject = new PhysicalProject <>(filterProjectList ,
131+ List <NamedExpression > projList = new ArrayList <>();
132+ projList .add (col2 );
133+ PhysicalProject <PhysicalFilter <PhysicalOlapScan >> project = new PhysicalProject <>(projList ,
150134 placeHolder , filter );
151135 PlanTranslatorContext planTranslatorContext = new PlanTranslatorContext ();
152136 PhysicalPlanTranslator translator = new PhysicalPlanTranslator (planTranslatorContext , null );
153- PlanFragment fragment = translator .visitPhysicalProject (filterProject , planTranslatorContext );
137+ PlanFragment fragment = translator .visitPhysicalProject (project , planTranslatorContext );
154138 PlanNode planNode = fragment .getPlanRoot ();
155139 List <OlapScanNode > scanNodeList = new ArrayList <>();
156140 planNode .collect (OlapScanNode .class , scanNodeList );
0 commit comments