2525import java .util .Set ;
2626import org .apache .hadoop .hbase .HRegionLocation ;
2727import org .apache .hadoop .hbase .client .Consistency ;
28+ import org .apache .phoenix .optimize .RejectedIndexEntry ;
2829import org .apache .phoenix .parse .HintNode ;
2930import org .apache .phoenix .parse .HintNode .Hint ;
3031import org .apache .phoenix .schema .PColumn ;
3536 * Strings containing entire plan.
3637 */
3738@ JsonPropertyOrder ({ "abstractExplainPlan" , "hint" , "explainScanType" , "consistency" , "tableName" ,
38- "keyRanges" , "indexName" , "indexKind" , "saltBuckets " , "regionsPlanned " , "scanTimeRangeMin " ,
39- "scanTimeRangeMax " , "splitsChunk " , "useRoundRobinIterator " , "samplingRate " , "hexStringRVCOffset " ,
40- "iteratorTypeAndScanSize " , "estimatedRows " , "estimatedSizeInBytes " , "serverWhereFilter " ,
41- "serverDistinctFilter " , "serverMergeColumns " , "serverArrayElementProjection " ,
42- "serverFirstKeyOnlyProjection " , "serverEmptyColumnOnlyProjection " , "serverAggregate " ,
43- "serverGroupByLimit " , "serverSortedBy " , "serverOffset " , "serverRowLimit " , "clientFilterBy " ,
44- "clientAggregate " , "clientDistinctFilter " , "clientAfterAggregate " , "clientSortAlgo " ,
45- "clientSortedBy " , "clientOffset " , "clientRowLimit " , "clientSequenceCount " , "clientCursorName " ,
46- "clientSteps " , "lhsJoinQueryExplainPlan " , "rhsJoinQueryExplainPlan " , "subPlans " ,
47- "dynamicServerFilter" , "afterJoinFilter" , "joinScannerLimit" , "sortMergeSkipMerge" ,
39+ "keyRanges" , "indexName" , "indexKind" , "indexRule " , "indexRejected " , "saltBuckets " ,
40+ "regionsPlanned " , "scanTimeRangeMin " , "scanTimeRangeMax " , "splitsChunk " , "useRoundRobinIterator " ,
41+ "samplingRate " , "hexStringRVCOffset " , "iteratorTypeAndScanSize " , "estimatedRows " ,
42+ "estimatedSizeInBytes " , "serverWhereFilter " , "serverDistinctFilter" , "serverMergeColumns " ,
43+ "serverArrayElementProjection " , "serverFirstKeyOnlyProjection " , "serverEmptyColumnOnlyProjection " ,
44+ "serverAggregate " , "serverGroupByLimit " , "serverSortedBy " , "serverOffset " , "serverRowLimit " ,
45+ "clientFilterBy " , "clientAggregate " , "clientDistinctFilter " , "clientAfterAggregate " ,
46+ "clientSortAlgo " , "clientSortedBy " , "clientOffset " , "clientRowLimit " , "clientSequenceCount " ,
47+ "clientCursorName " , "clientSteps " , "lhsJoinQueryExplainPlan " , "rhsJoinQueryExplainPlan " ,
48+ "subPlans" , " dynamicServerFilter" , "afterJoinFilter" , "joinScannerLimit" , "sortMergeSkipMerge" ,
4849 "regionLocations" , "regionLocationsTotalSize" , "numRegionLocationLookups" })
4950public class ExplainPlanAttributes {
5051
@@ -57,6 +58,8 @@ public class ExplainPlanAttributes {
5758 private final String keyRanges ;
5859 private final String indexName ;
5960 private final String indexKind ;
61+ private final String indexRule ;
62+ private final List <RejectedIndexEntry > indexRejected ;
6063 private final Integer saltBuckets ;
6164 private final Integer regionsPlanned ;
6265 private final Long scanTimeRangeMin ;
@@ -122,6 +125,8 @@ private ExplainPlanAttributes() {
122125 this .keyRanges = null ;
123126 this .indexName = null ;
124127 this .indexKind = null ;
128+ this .indexRule = null ;
129+ this .indexRejected = null ;
125130 this .saltBuckets = null ;
126131 this .regionsPlanned = null ;
127132 this .scanTimeRangeMin = null ;
@@ -169,20 +174,20 @@ private ExplainPlanAttributes() {
169174
170175 public ExplainPlanAttributes (String abstractExplainPlan , Hint hint , String explainScanType ,
171176 Consistency consistency , String tableName , String keyRanges , String indexName , String indexKind ,
172- Integer saltBuckets , Integer regionsPlanned , Long scanTimeRangeMin , Long scanTimeRangeMax ,
173- Integer splitsChunk , boolean useRoundRobinIterator , Double samplingRate ,
174- String hexStringRVCOffset , String iteratorTypeAndScanSize , Long estimatedRows ,
175- Long estimatedSizeInBytes , String serverWhereFilter , String serverDistinctFilter ,
176- Set <PColumn > serverMergeColumns , boolean serverArrayElementProjection ,
177- boolean serverFirstKeyOnlyProjection , boolean serverEmptyColumnOnlyProjection ,
178- String serverAggregate , Integer serverGroupByLimit , String serverSortedBy , Integer serverOffset ,
179- Long serverRowLimit , String clientFilterBy , String clientAggregate , String clientDistinctFilter ,
180- String clientAfterAggregate , String clientSortAlgo , String clientSortedBy , Integer clientOffset ,
181- Integer clientRowLimit , Integer clientSequenceCount , String clientCursorName ,
182- List <String > clientSteps , ExplainPlanAttributes lhsJoinQueryExplainPlan ,
183- ExplainPlanAttributes rhsJoinQueryExplainPlan , List < ExplainPlanAttributes > subPlans ,
184- String dynamicServerFilter , String afterJoinFilter , Long joinScannerLimit ,
185- boolean sortMergeSkipMerge , List <HRegionLocation > regionLocations ,
177+ String indexRule , List < RejectedIndexEntry > indexRejected , Integer saltBuckets ,
178+ Integer regionsPlanned , Long scanTimeRangeMin , Long scanTimeRangeMax , Integer splitsChunk ,
179+ boolean useRoundRobinIterator , Double samplingRate , String hexStringRVCOffset ,
180+ String iteratorTypeAndScanSize , Long estimatedRows , Long estimatedSizeInBytes ,
181+ String serverWhereFilter , String serverDistinctFilter , Set <PColumn > serverMergeColumns ,
182+ boolean serverArrayElementProjection , boolean serverFirstKeyOnlyProjection ,
183+ boolean serverEmptyColumnOnlyProjection , String serverAggregate , Integer serverGroupByLimit ,
184+ String serverSortedBy , Integer serverOffset , Long serverRowLimit , String clientFilterBy ,
185+ String clientAggregate , String clientDistinctFilter , String clientAfterAggregate ,
186+ String clientSortAlgo , String clientSortedBy , Integer clientOffset , Integer clientRowLimit ,
187+ Integer clientSequenceCount , String clientCursorName , List <String > clientSteps ,
188+ ExplainPlanAttributes lhsJoinQueryExplainPlan , ExplainPlanAttributes rhsJoinQueryExplainPlan ,
189+ List < ExplainPlanAttributes > subPlans , String dynamicServerFilter , String afterJoinFilter ,
190+ Long joinScannerLimit , boolean sortMergeSkipMerge , List <HRegionLocation > regionLocations ,
186191 Integer regionLocationsTotalSize , int numRegionLocationLookups ) {
187192 this .abstractExplainPlan = abstractExplainPlan ;
188193 this .hint = hint ;
@@ -192,6 +197,10 @@ public ExplainPlanAttributes(String abstractExplainPlan, Hint hint, String expla
192197 this .keyRanges = keyRanges ;
193198 this .indexName = indexName ;
194199 this .indexKind = indexKind ;
200+ this .indexRule = indexRule ;
201+ this .indexRejected = (indexRejected == null || indexRejected .isEmpty ())
202+ ? null
203+ : Collections .unmodifiableList (new ArrayList <>(indexRejected ));
195204 this .saltBuckets = saltBuckets ;
196205 this .regionsPlanned = regionsPlanned ;
197206 this .scanTimeRangeMin = scanTimeRangeMin ;
@@ -271,6 +280,14 @@ public String getIndexKind() {
271280 return indexKind ;
272281 }
273282
283+ public String getIndexRule () {
284+ return indexRule ;
285+ }
286+
287+ public List <RejectedIndexEntry > getIndexRejected () {
288+ return indexRejected ;
289+ }
290+
274291 public Integer getSaltBuckets () {
275292 return saltBuckets ;
276293 }
@@ -458,6 +475,8 @@ public static class ExplainPlanAttributesBuilder {
458475 private String keyRanges ;
459476 private String indexName ;
460477 private String indexKind ;
478+ private String indexRule ;
479+ private List <RejectedIndexEntry > indexRejected ;
461480 private Integer saltBuckets ;
462481 private Integer regionsPlanned ;
463482 private Long scanTimeRangeMin ;
@@ -515,6 +534,9 @@ public ExplainPlanAttributesBuilder(ExplainPlanAttributes explainPlanAttributes)
515534 this .keyRanges = explainPlanAttributes .getKeyRanges ();
516535 this .indexName = explainPlanAttributes .getIndexName ();
517536 this .indexKind = explainPlanAttributes .getIndexKind ();
537+ this .indexRule = explainPlanAttributes .getIndexRule ();
538+ List <RejectedIndexEntry > srcIndexRejected = explainPlanAttributes .getIndexRejected ();
539+ this .indexRejected = srcIndexRejected == null ? null : new ArrayList <>(srcIndexRejected );
518540 this .saltBuckets = explainPlanAttributes .getSaltBuckets ();
519541 this .regionsPlanned = explainPlanAttributes .getRegionsPlanned ();
520542 this .scanTimeRangeMin = explainPlanAttributes .getScanTimeRangeMin ();
@@ -602,6 +624,16 @@ public ExplainPlanAttributesBuilder setIndexKind(String indexKind) {
602624 return this ;
603625 }
604626
627+ public ExplainPlanAttributesBuilder setIndexRule (String indexRule ) {
628+ this .indexRule = indexRule ;
629+ return this ;
630+ }
631+
632+ public ExplainPlanAttributesBuilder setIndexRejected (List <RejectedIndexEntry > indexRejected ) {
633+ this .indexRejected = indexRejected == null ? null : new ArrayList <>(indexRejected );
634+ return this ;
635+ }
636+
605637 public ExplainPlanAttributesBuilder setSaltBuckets (Integer saltBuckets ) {
606638 this .saltBuckets = saltBuckets ;
607639 return this ;
@@ -833,16 +865,16 @@ public ExplainPlanAttributesBuilder setNumRegionLocationLookups(int numRegionLoc
833865
834866 public ExplainPlanAttributes build () {
835867 return new ExplainPlanAttributes (abstractExplainPlan , hint , explainScanType , consistency ,
836- tableName , keyRanges , indexName , indexKind , saltBuckets , regionsPlanned , scanTimeRangeMin ,
837- scanTimeRangeMax , splitsChunk , useRoundRobinIterator , samplingRate , hexStringRVCOffset ,
838- iteratorTypeAndScanSize , estimatedRows , estimatedSizeInBytes , serverWhereFilter ,
839- serverDistinctFilter , serverMergeColumns , serverArrayElementProjection ,
840- serverFirstKeyOnlyProjection , serverEmptyColumnOnlyProjection , serverAggregate ,
841- serverGroupByLimit , serverSortedBy , serverOffset , serverRowLimit , clientFilterBy ,
842- clientAggregate , clientDistinctFilter , clientAfterAggregate , clientSortAlgo , clientSortedBy ,
843- clientOffset , clientRowLimit , clientSequenceCount , clientCursorName , clientSteps ,
844- lhsJoinQueryExplainPlan , rhsJoinQueryExplainPlan , subPlans , dynamicServerFilter ,
845- afterJoinFilter , joinScannerLimit , sortMergeSkipMerge , regionLocations ,
868+ tableName , keyRanges , indexName , indexKind , indexRule , indexRejected , saltBuckets ,
869+ regionsPlanned , scanTimeRangeMin , scanTimeRangeMax , splitsChunk , useRoundRobinIterator ,
870+ samplingRate , hexStringRVCOffset , iteratorTypeAndScanSize , estimatedRows ,
871+ estimatedSizeInBytes , serverWhereFilter , serverDistinctFilter , serverMergeColumns ,
872+ serverArrayElementProjection , serverFirstKeyOnlyProjection , serverEmptyColumnOnlyProjection ,
873+ serverAggregate , serverGroupByLimit , serverSortedBy , serverOffset , serverRowLimit ,
874+ clientFilterBy , clientAggregate , clientDistinctFilter , clientAfterAggregate , clientSortAlgo ,
875+ clientSortedBy , clientOffset , clientRowLimit , clientSequenceCount , clientCursorName ,
876+ clientSteps , lhsJoinQueryExplainPlan , rhsJoinQueryExplainPlan , subPlans ,
877+ dynamicServerFilter , afterJoinFilter , joinScannerLimit , sortMergeSkipMerge , regionLocations ,
846878 regionLocationsTotalSize , numRegionLocationLookups );
847879 }
848880 }
0 commit comments