[ 
https://issues.apache.org/jira/browse/PHOENIX-3822?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Samarth Jain updated PHOENIX-3822:
----------------------------------
    Attachment: PHOENIX-3822_v2.patch

Thanks for the review, [~jamestaylor]. Please see the updated patch. I have 
added columns BYTES and ROWS in the explain plan result set to provide the info.

ExplainPlanIT#getByteRowEstimates provides an example of how users can get hold 
of these values.

{code}
private static Pair<Long, Long> getByteRowEstimates(Connection conn, String 
sql, List<Object> bindValues) throws Exception {
        String explainSql = "EXPLAIN " + sql;
        Long estimatedBytes = null;
        Long estimatedRows = null;
        try (PreparedStatement statement = conn.prepareStatement(explainSql)) {
            for (Object bind : bindValues) {
                statement.setObject(1, bind);
            }
            ResultSet rs = statement.executeQuery(explainSql);
            rs.next();
            estimatedBytes = rs.getLong("BYTES");
            estimatedRows = rs.getLong("ROWS");
        }
        return new Pair<>(estimatedRows, estimatedBytes);
    }
{code}

> Surface byte and row estimates in a machine readable way when doing EXPLAIN 
> PLAN
> --------------------------------------------------------------------------------
>
>                 Key: PHOENIX-3822
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3822
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>         Attachments: PHOENIX-3822.patch, PHOENIX-3822_v2.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to