blob: b100f5f72e65a21434c8c18db1d796ff6be4e7a7 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>PushProjector (Apache Calcite API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.calcite.rel.rules, class: PushProjector">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<div class="about-language"><b>Apache Calcite</b></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.calcite.rel.rules</a></div>
<h1 title="Class PushProjector" class="title">Class PushProjector</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">org.apache.calcite.rel.rules.PushProjector</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">PushProjector</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">PushProjector is a utility class used to perform operations used in push
projection rules.
<p>Pushing is particularly interesting in the case of join, because there
are multiple inputs. Generally an expression can be pushed down to a
particular input if it depends upon no other inputs. If it can be pushed
down to both sides, it is pushed down to the left.
<p>Sometimes an expression needs to be split before it can be pushed down.
To flag that an expression cannot be split, specify a rule that it must be
<dfn>preserved</dfn>. Such an expression will be pushed down intact to one
of the inputs, or not pushed down at all.</p></div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<li>
<section class="nested-class-summary" id="nested-class-summary">
<h2>Nested Class Summary</h2>
<div class="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static interface&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="PushProjector.ExprCondition.html" class="type-name-link" title="interface in org.apache.calcite.rel.rules">PushProjector.ExprCondition</a></code></div>
<div class="col-last even-row-color">
<div class="block">A functor that replies true or false for a given expression.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(org.apache.calcite.rel.core.Project,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.rules.PushProjector.ExprCondition,org.apache.calcite.tools.RelBuilder)" class="member-name-link">PushProjector</a><wbr>(@Nullable <a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;origProj,
@Nullable <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;origFilter,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;childRel,
<a href="PushProjector.ExprCondition.html" title="interface in org.apache.calcite.rel.rules">PushProjector.ExprCondition</a>&nbsp;preserveExprCondition,
<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder)</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a PushProjector object for pushing projects past a RelNode.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@Nullable <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#convertProject(org.apache.calcite.rex.RexNode)" class="member-name-link">convertProject</a><wbr>(@Nullable <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;defaultExpr)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Decomposes a projection to the input references referenced by a
projection and a filter, either of which is optional.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#convertRefsAndExprs(org.apache.calcite.rex.RexNode,java.util.List,int%5B%5D)" class="member-name-link">convertRefsAndExprs</a><wbr>(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;rex,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="../type/RelDataTypeField.html" title="interface in org.apache.calcite.rel.type">RelDataTypeField</a>&gt;&nbsp;destFields,
int[]&nbsp;adjustments)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Clones an expression tree and walks through it, adjusting each
RexInputRef index by some amount, and converting expressions that need to
be preserved to field references.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#createNewProject(org.apache.calcite.rel.RelNode,int%5B%5D)" class="member-name-link">createNewProject</a><wbr>(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;projChild,
int[]&nbsp;adjustments)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Creates a new projection based on the original projection, adjusting all
input refs using an adjustment array passed in.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#createProjectRefsAndExprs(org.apache.calcite.rel.RelNode,boolean,boolean)" class="member-name-link">createProjectRefsAndExprs</a><wbr>(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;projChild,
boolean&nbsp;adjust,
boolean&nbsp;rightSide)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Creates a projection based on the inputs specified in a bitmap and the
expressions that need to be preserved.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getAdjustments()" class="member-name-link">getAdjustments</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Determines how much each input reference needs to be adjusted as a result
of projection.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#locateAllRefs()" class="member-name-link">locateAllRefs</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Locates all references found in either the projection expressions a
filter, as well as references to expressions that should be preserved.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(org.apache.calcite.rel.core.Project,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.rules.PushProjector.ExprCondition,org.apache.calcite.tools.RelBuilder)">
<h3>PushProjector</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">PushProjector</span><wbr><span class="parameters">(@Nullable <a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;origProj,
@Nullable <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;origFilter,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;childRel,
<a href="PushProjector.ExprCondition.html" title="interface in org.apache.calcite.rel.rules">PushProjector.ExprCondition</a>&nbsp;preserveExprCondition,
<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder)</span></div>
<div class="block">Creates a PushProjector object for pushing projects past a RelNode.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>origProj</code> - the original projection that is being pushed;
may be null if the projection is implied as a
result of a projection having been trivially
removed</dd>
<dd><code>origFilter</code> - the filter that the projection must also be
pushed past, if applicable</dd>
<dd><code>childRel</code> - the RelNode that the projection is being
pushed past</dd>
<dd><code>preserveExprCondition</code> - condition for whether an expression should
be preserved in the projection</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="convertProject(org.apache.calcite.rex.RexNode)">
<h3>convertProject</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">@Nullable <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></span>&nbsp;<span class="element-name">convertProject</span><wbr><span class="parameters">(@Nullable <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;defaultExpr)</span></div>
<div class="block">Decomposes a projection to the input references referenced by a
projection and a filter, either of which is optional. If both are
provided, the filter is underneath the project.
<p>Creates a projection containing all input references as well as
preserving any special expressions. Converts the original projection
and/or filter to reference the new projection. Then, finally puts on top,
a final projection corresponding to the original projection.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>defaultExpr</code> - expression to be used in the projection if no fields
or special columns are selected</dd>
<dt>Returns:</dt>
<dd>the converted projection if it makes sense to push elements of
the projection; otherwise returns null</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="locateAllRefs()">
<h3>locateAllRefs</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">locateAllRefs</span>()</div>
<div class="block">Locates all references found in either the projection expressions a
filter, as well as references to expressions that should be preserved.
Based on that, determines whether pushing the projection makes sense.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>true if all inputs from the child that the projection is being
pushed past are referenced in the projection/filter and no special
preserve expressions are referenced; in that case, it does not make sense
to push the projection</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="createProjectRefsAndExprs(org.apache.calcite.rel.RelNode,boolean,boolean)">
<h3>createProjectRefsAndExprs</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a></span>&nbsp;<span class="element-name">createProjectRefsAndExprs</span><wbr><span class="parameters">(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;projChild,
boolean&nbsp;adjust,
boolean&nbsp;rightSide)</span></div>
<div class="block">Creates a projection based on the inputs specified in a bitmap and the
expressions that need to be preserved. The expressions are appended after
the input references.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>projChild</code> - child that the projection will be created on top of</dd>
<dd><code>adjust</code> - if true, need to create new projection expressions;
otherwise, the existing ones are reused</dd>
<dd><code>rightSide</code> - if true, creating a projection for the right hand side
of a join</dd>
<dt>Returns:</dt>
<dd>created projection</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getAdjustments()">
<h3>getAdjustments</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int[]</span>&nbsp;<span class="element-name">getAdjustments</span>()</div>
<div class="block">Determines how much each input reference needs to be adjusted as a result
of projection.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>array indicating how much each input needs to be adjusted by</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="convertRefsAndExprs(org.apache.calcite.rex.RexNode,java.util.List,int[])">
<h3>convertRefsAndExprs</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></span>&nbsp;<span class="element-name">convertRefsAndExprs</span><wbr><span class="parameters">(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;rex,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="../type/RelDataTypeField.html" title="interface in org.apache.calcite.rel.type">RelDataTypeField</a>&gt;&nbsp;destFields,
int[]&nbsp;adjustments)</span></div>
<div class="block">Clones an expression tree and walks through it, adjusting each
RexInputRef index by some amount, and converting expressions that need to
be preserved to field references.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>rex</code> - the expression</dd>
<dd><code>destFields</code> - fields that the new expressions will be referencing</dd>
<dd><code>adjustments</code> - the amount each input reference index needs to be
adjusted by</dd>
<dt>Returns:</dt>
<dd>modified expression tree</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="createNewProject(org.apache.calcite.rel.RelNode,int[])">
<h3>createNewProject</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></span>&nbsp;<span class="element-name">createNewProject</span><wbr><span class="parameters">(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;projChild,
int[]&nbsp;adjustments)</span></div>
<div class="block">Creates a new projection based on the original projection, adjusting all
input refs using an adjustment array passed in. If there was no original
projection, create a new one that selects every field from the underlying
rel.
<p>If the resulting projection would be trivial, return the child.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>projChild</code> - child of the new project</dd>
<dd><code>adjustments</code> - array indicating how much each input reference should
be adjusted by</dd>
<dt>Returns:</dt>
<dd>the created projection</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &copy; 2012-2023 Apache Software Foundation. All Rights Reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>