calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: Calcite SQL Explain Plan
Date Sun, 05 Jul 2015 16:24:45 GMT
Yes, explain output can be in XML. Add the "AS XML" clause:

sqlline> !connect
jdbc:calcite:model=core/src/test/resources/hsqldb-model.json admin
admin
sqlline> !set outputformat csv
sqlline> explain plan as xml for select * from scott.emp where deptno = 10;
'PLAN'
'<RelNode type="JdbcToEnumerableConverter">
  <Inputs>
    <RelNode type="JdbcFilter">
      <Property name="condition">
        =(CAST($7):INTEGER, 10) </Property>
      <Inputs>
        <RelNode type="JdbcTableScan">
          <Property name="table">
            [SCOTT, EMP] </Property>
          <Inputs/>
        </RelNode>
      </Inputs>
    </RelNode>
  </Inputs>
</RelNode>
'
1 row selected (0.027 seconds)

Yes, Calcite can consider various strategies for distributed join,
including pushing filters to sources, pushing joins to one source (if
the source supports it), and exploiting sorted data. The strategy is a
matter of using the right rules, many of which are built in.

Currently on JDBC sources we would not push the join to either source
(because in general JDBC sources cannot talk to each other) nor would
we do an ORDER BY in the sources and use a merge join in the query
head node, but that could be changed.

Julian


On Fri, Jul 3, 2015 at 9:03 AM, Sathish Kumaran Vairavelu
<vsathishkumaran@gmail.com> wrote:
> Hello
>
> Does calcite provides explain plan in XML format like the one below ( from
> Teiid). If you look at the plan; Teiid provides queries for 2 different
> data sources/models(with both filter and join pushdown), join path and
> information on how to join them (inter database join). Does Calcite offer
> similar kind of feature?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <node name="ProjectNode">
>     <property name="Output Columns">
>         <value>e1 (string)</value>
>         <value>e2 (integer)</value>
>         <value>e3 (boolean)</value>
>     </property>
>     <property name="Cost Estimates">
>         <value>Estimated Node Cardinality: -1.0</value>
>     </property>
>     <property name="Child 0">
>         <node name="JoinNode">
>             <property name="Output Columns">
>                 <value>e1 (string)</value>
>                 <value>e2 (integer)</value>
>                 <value>e3 (boolean)</value>
>             </property>
>             <property name="Cost Estimates">
>                 <value>Estimated Node Cardinality: -1.0</value>
>             </property>
>             <property name="Child 0">
>                 <node name="JoinNode">
>                     <property name="Output Columns">
>                         <value>e1 (string)</value>
>                         <value>e1 (string)</value>
>                         <value>e3 (boolean)</value>
>                     </property>
>                     <property name="Cost Estimates">
>                         <value>Estimated Node Cardinality: -1.0</value>
>                     </property>
>                     <property name="Child 0">
>                         <node name="AccessNode">
>                             <property name="Output Columns">
>                                 <value>e1 (string)</value>
>                             </property>
>                             <property name="Cost Estimates">
>                                 <value>Estimated Node Cardinality: -1.0
> </value>
>                             </property>
>                             <property name="Query">
>                                 <value>SELECT g_0.e1 AS c_0 FROM pm1.g1 AS
> g_0 ORDER BY c_0</value>
>                             </property>
>                             <property name="Model Name">
>                                 <value>pm1</value>
>                             </property>
>                         </node>
>                     </property>
>                     <property name="Child 1">
>                         <node name="AccessNode">
>                             <property name="Output Columns">
>                                 <value>e1 (string)</value>
>                                 <value>e3 (boolean)</value>
>                             </property>
>                             <property name="Cost Estimates">
>                                 <value>Estimated Node Cardinality: -1.0
> </value>
>                             </property>
>                             <property name="Query">
>                                 <value>SELECT g_0.e1 AS c_0, g_0.e3 AS c_1
> FROM pm1.g3 AS g_0
>                                     ORDER BY c_0</value>
>                             </property>
>                             <property name="Model Name">
>                                 <value>pm1</value>
>                             </property>
>                         </node>
>                     </property>
>                     <property name="Join Strategy">
>                         <value>MERGE JOIN
> (ALREADY_SORTED/ALREADY_SORTED)</value>
>                     </property>
>                     <property name="Join Type">
>                         <value>INNER JOIN</value>
>                     </property>
>                     <property name="Join Criteria">
>                         <value>pm1.g1.e1=pm1.g3.e1</value>
>                     </property>
>                 </node>
>             </property>
>             <property name="Child 1">
>                 <node name="AccessNode">
>                     <property name="Output Columns">
>                         <value>e1 (string)</value>
>                         <value>e2 (integer)</value>
>                     </property>
>                     <property name="Cost Estimates">
>                         <value>Estimated Node Cardinality: -1.0</value>
>                     </property>
>                     <property name="Query">
>                         <value>SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM
> pm1.g2 AS g_0
>                             ORDER BY c_0</value>
>                     </property>
>                     <property name="Model Name">
>                         <value>pm1</value>
>                     </property>
>                 </node>
>             </property>
>             <property name="Join Strategy">
>                 <value>ENHANCED SORT JOIN (SORT/ALREADY_SORTED)</value>
>             </property>
>             <property name="Join Type">
>                 <value>INNER JOIN</value>
>             </property>
>             <property name="Join Criteria">
>                 <value>pm1.g3.e1=pm1.g2.e1</value>
>             </property>
>         </node>
>     </property>
>     <property name="Select Columns">
>         <value>pm1.g1.e1</value>
>         <value>pm1.g2.e2</value>
>         <value>pm1.g3.e3</value>
>     </property>
> </node>

Mime
View raw message