Github user aertoria commented on the issue:
https://github.com/apache/phoenix/pull/262
> See ExplainTable and let's figure out the best place to add this.
Purposing adding this logic at `BaseResultIterators`.`explain()` method.
Which is between **Line1080** and **Line1081** of `BaseResultIterators.java`
(link below)
https://github.com/apache/phoenix/blob/b9bb918610c04e21b27df8d3fe1c42df508a96f0/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
Reason for this location:
Currently, `BaseResultIterators` inherits abstract class `ExplainTable`.
The explaining string for the table part is essentially finished by these two
classes, one following another. Now, the information of tablesampling is stored
in `QueryPlan.Statement.fromtable` object, it resides in `BaseResultIterators`.
Its parent, the abstract class `ExplainTable` will not have this info (unless
we want to modify `PTable` interface and get it from `tableref`).
In addition, table sampling main logic resides in `BaseResultIterators`
when it does `getParallelScans()`. Now we are just making it to also explain
the plan when it overrides `explain()`. All thing considered I think
`BaseResultIterators` should be the best place to put it. Please let me know
your feedback!
After implemented, it looks like this on single select
```
CLIENT 3-CHUNK 30 ROWS 2370 BYTES PARALLEL 1-WAY ROUND ROBIN FULL SCAN OVER
PERSON
TABLESAMPING BY 0.19
```
On join select
```
CLIENT 9-CHUNK 30 ROWS 2370 BYTES PARALLEL 1-WAY ROUND ROBIN FULL SCAN OVER
PERSON
TABLESAMPING BY 0.65
PARALLEL INNER-JOIN TABLE 0
CLIENT 2-CHUNK 1 ROWS 32 BYTES PARALLEL 1-WAY ROUND ROBIN FULL SCAN
OVER US_POPULATION
TABLESAMPING BY 0.9504
AFTER-JOIN SERVER FILTER BY PERSON.ADDRESS > US_POPULATION.STATE
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---