blob: 3a0128d4e1a1d57e3679d5149b50f7dcd893f146 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>CalcRelSplitter (Apache Calcite API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CalcRelSplitter (Apache Calcite API)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":9,"i4":10,"i5":10,"i6":10,"i7":9,"i8":9,"i9":10,"i10":10,"i11":10,"i12":9,"i13":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CalcRelSplitter.html">Use</a></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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.calcite.rel.rules</a></div>
<h2 title="Class CalcRelSplitter" class="title">Class CalcRelSplitter</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.calcite.rel.rules.CalcRelSplitter</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="ProjectToWindowRule.WindowedAggRelSplitter.html" title="class in org.apache.calcite.rel.rules">ProjectToWindowRule.WindowedAggRelSplitter</a></code></dd>
</dl>
<hr>
<pre>public abstract class <span class="typeNameLabel">CalcRelSplitter</span>
extends java.lang.Object</pre>
<div class="block">CalcRelSplitter operates on a
<a href="../core/Calc.html" title="class in org.apache.calcite.rel.core"><code>Calc</code></a> with multiple <a href="../../rex/RexCall.html" title="class in org.apache.calcite.rex"><code>RexCall</code></a>
sub-expressions that cannot all be implemented by a single concrete
<a href="../RelNode.html" title="interface in org.apache.calcite.rel"><code>RelNode</code></a>.
<p>For example, the Java and Fennel calculator do not implement an identical
set of operators. The Calc can be used to split a single Calc with
mixed Java- and Fennel-only operators into a tree of Calc object that can
each be individually implemented by either Java or Fennel.and splits it into
several Calc instances.
<p>Currently the splitter is only capable of handling two "rel types". That
is, it can deal with Java vs. Fennel Calcs, but not Java vs. Fennel vs.
some other type of Calc.
<p>See <a href="ProjectToWindowRule.html" title="class in org.apache.calcite.rel.rules"><code>ProjectToWindowRule</code></a>
for an example of how this class is used.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CalcRelSplitter.CannotImplement.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.CannotImplement</a></span></code></th>
<td class="colLast">
<div class="block">Control exception for <a href="CalcRelSplitter.ImplementTester.html" title="class in org.apache.calcite.rel.rules"><code>CalcRelSplitter.ImplementTester</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CalcRelSplitter.HighestUsageFinder.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.HighestUsageFinder</a></span></code></th>
<td class="colLast">
<div class="block">Builds an array of the highest level which contains an expression which
uses each expression as an input.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CalcRelSplitter.ImplementTester.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.ImplementTester</a></span></code></th>
<td class="colLast">
<div class="block">Visitor which returns whether an expression can be implemented in a given
type of relational expression.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CalcRelSplitter.InputToCommonExprConverter.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.InputToCommonExprConverter</a></span></code></th>
<td class="colLast">
<div class="block">Shuttle which converts every reference to an input field in an expression
to a reference to a common sub-expression.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CalcRelSplitter.MaxInputFinder.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.MaxInputFinder</a></span></code></th>
<td class="colLast">
<div class="block">Finds the highest level used by any of the inputs of a given expression.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.RelType</a></span></code></th>
<td class="colLast">
<div class="block">Type of relational expression.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#child">child</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private <a href="../../plan/RelOptCluster.html" title="class in org.apache.calcite.plan">RelOptCluster</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#cluster">cluster</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../rex/RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#program">program</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#relBuilder">relBuilder</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.RelType</a>[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#relTypes">relTypes</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static org.slf4j.Logger</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#RULE_LOGGER">RULE_LOGGER</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="../../plan/RelTraitSet.html" title="class in org.apache.calcite.plan">RelTraitSet</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#traits">traits</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private <a href="../type/RelDataTypeFactory.html" title="interface in org.apache.calcite.rel.type">RelDataTypeFactory</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#typeFactory">typeFactory</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.calcite.rel.core.Calc,org.apache.calcite.tools.RelBuilder,org.apache.calcite.rel.rules.CalcRelSplitter.RelType%5B%5D)">CalcRelSplitter</a></span>&#8203;(<a href="../core/Calc.html" title="class in org.apache.calcite.rel.core">Calc</a>&nbsp;calc,
<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.RelType</a>[]&nbsp;relTypes)</code></th>
<td class="colLast">
<div class="block">Constructs a CalcRelSplitter.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#canImplement(org.apache.calcite.rel.logical.LogicalCalc,java.lang.String)">canImplement</a></span>&#8203;(<a href="../logical/LogicalCalc.html" title="class in org.apache.calcite.rel.logical">LogicalCalc</a>&nbsp;rel,
java.lang.String&nbsp;relTypeName)</code></th>
<td class="colLast">
<div class="block">Returns whether a relational expression can be implemented solely in a
given <a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules"><code>CalcRelSplitter.RelType</code></a>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>private int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#chooseLevels(org.apache.calcite.rex.RexNode%5B%5D,int,int%5B%5D,int%5B%5D)">chooseLevels</a></span>&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;exprs,
int&nbsp;conditionOrdinal,
int[]&nbsp;exprLevels,
int[]&nbsp;levelTypeOrdinals)</code></th>
<td class="colLast">
<div class="block">Figures out which expressions to calculate at which level.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>private java.util.List&lt;java.lang.Integer&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#computeTopologicalOrdering(org.apache.calcite.rex.RexNode%5B%5D,java.util.List)">computeTopologicalOrdering</a></span>&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;exprs,
java.util.List&lt;java.util.Set&lt;java.lang.Integer&gt;&gt;&nbsp;cohorts)</code></th>
<td class="colLast">
<div class="block">Computes the order in which to visit expressions, so that we decide the
level of an expression only after the levels of lower expressions have
been decided.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>private static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#count(boolean%5B%5D)">count</a></span>&#8203;(boolean[]&nbsp;booleans)</code></th>
<td class="colLast">
<div class="block">Returns the number of bits set in an array.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>private <a href="../../rex/RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createProgramForLevel(int,int,org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexNode%5B%5D,int%5B%5D,int%5B%5D,int%5B%5D,int,org.apache.calcite.rel.type.RelDataType)">createProgramForLevel</a></span>&#8203;(int&nbsp;level,
int&nbsp;levelCount,
<a href="../type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;allExprs,
int[]&nbsp;exprLevels,
int[]&nbsp;inputExprOrdinals,
int[]&nbsp;projectExprOrdinals,
int&nbsp;conditionExprOrdinal,
<a href="../type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType)</code></th>
<td class="colLast">
<div class="block">Creates a program containing the expressions for a given level.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>private java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#deriveFieldName(org.apache.calcite.rex.RexNode,int)">deriveFieldName</a></span>&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
int&nbsp;ordinal)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>(package private) <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#execute()">execute</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>private static java.util.Set&lt;java.lang.Integer&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findCohort(java.util.List,int)">findCohort</a></span>&#8203;(java.util.List&lt;java.util.Set&lt;java.lang.Integer&gt;&gt;&nbsp;cohorts,
int&nbsp;ordinal)</code></th>
<td class="colLast">
<div class="block">Finds the cohort that contains the given integer, or returns null.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>private static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#firstSet(boolean%5B%5D)">firstSet</a></span>&#8203;(boolean[]&nbsp;booleans)</code></th>
<td class="colLast">
<div class="block">Returns the index of the first set bit in an array.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>protected java.util.List&lt;java.util.Set&lt;java.lang.Integer&gt;&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getCohorts()">getCohorts</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns a list of sets of expressions that should be on the same level.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>protected <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#handle(org.apache.calcite.rel.RelNode)">handle</a></span>&#8203;(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;rel)</code></th>
<td class="colLast">
<div class="block">Opportunity to further refine the relational expression created for a
given level.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>private int[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#identityArray(int)">identityArray</a></span>&#8203;(int&nbsp;length)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>private static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#indexOf(int,int%5B%5D)">indexOf</a></span>&#8203;(int&nbsp;value,
int[]&nbsp;map)</code></th>
<td class="colLast">
<div class="block">Searches for a value in a map, and returns the position where it was
found, or -1.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>private void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#traceLevelExpressions(org.apache.calcite.rex.RexNode%5B%5D,int%5B%5D,int%5B%5D,int)">traceLevelExpressions</a></span>&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;exprs,
int[]&nbsp;exprLevels,
int[]&nbsp;levelTypeOrdinals,
int&nbsp;levelCount)</code></th>
<td class="colLast">
<div class="block">Traces the given array of level expression lists at the finer level.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="RULE_LOGGER">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>RULE_LOGGER</h4>
<pre>private static final&nbsp;org.slf4j.Logger RULE_LOGGER</pre>
</li>
</ul>
<a id="program">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>program</h4>
<pre>protected final&nbsp;<a href="../../rex/RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a> program</pre>
</li>
</ul>
<a id="typeFactory">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>typeFactory</h4>
<pre>private final&nbsp;<a href="../type/RelDataTypeFactory.html" title="interface in org.apache.calcite.rel.type">RelDataTypeFactory</a> typeFactory</pre>
</li>
</ul>
<a id="relTypes">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>relTypes</h4>
<pre>private final&nbsp;<a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.RelType</a>[] relTypes</pre>
</li>
</ul>
<a id="cluster">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cluster</h4>
<pre>private final&nbsp;<a href="../../plan/RelOptCluster.html" title="class in org.apache.calcite.plan">RelOptCluster</a> cluster</pre>
</li>
</ul>
<a id="traits">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>traits</h4>
<pre>private final&nbsp;<a href="../../plan/RelTraitSet.html" title="class in org.apache.calcite.plan">RelTraitSet</a> traits</pre>
</li>
</ul>
<a id="child">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>child</h4>
<pre>private final&nbsp;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a> child</pre>
</li>
</ul>
<a id="relBuilder">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>relBuilder</h4>
<pre>protected final&nbsp;<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a> relBuilder</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;(org.apache.calcite.rel.core.Calc,org.apache.calcite.tools.RelBuilder,org.apache.calcite.rel.rules.CalcRelSplitter.RelType[])">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CalcRelSplitter</h4>
<pre>CalcRelSplitter&#8203;(<a href="../core/Calc.html" title="class in org.apache.calcite.rel.core">Calc</a>&nbsp;calc,
<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules">CalcRelSplitter.RelType</a>[]&nbsp;relTypes)</pre>
<div class="block">Constructs a CalcRelSplitter.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>calc</code> - Calc to split</dd>
<dd><code>relTypes</code> - Array of rel types, e.g. {Java, Fennel}. Must be
distinct.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="execute()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>execute</h4>
<pre class="methodSignature"><a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;execute()</pre>
</li>
</ul>
<a id="handle(org.apache.calcite.rel.RelNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>handle</h4>
<pre class="methodSignature">protected&nbsp;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;handle&#8203;(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;rel)</pre>
<div class="block">Opportunity to further refine the relational expression created for a
given level. The default implementation returns the relational expression
unchanged.</div>
</li>
</ul>
<a id="chooseLevels(org.apache.calcite.rex.RexNode[],int,int[],int[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>chooseLevels</h4>
<pre class="methodSignature">private&nbsp;int&nbsp;chooseLevels&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;exprs,
int&nbsp;conditionOrdinal,
int[]&nbsp;exprLevels,
int[]&nbsp;levelTypeOrdinals)</pre>
<div class="block">Figures out which expressions to calculate at which level.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exprs</code> - Array of expressions</dd>
<dd><code>conditionOrdinal</code> - Ordinal of the condition expression, or -1 if no
condition</dd>
<dd><code>exprLevels</code> - Level ordinal for each expression (output)</dd>
<dd><code>levelTypeOrdinals</code> - The type of each level (output)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Number of levels required</dd>
</dl>
</li>
</ul>
<a id="computeTopologicalOrdering(org.apache.calcite.rex.RexNode[],java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeTopologicalOrdering</h4>
<pre class="methodSignature">private&nbsp;java.util.List&lt;java.lang.Integer&gt;&nbsp;computeTopologicalOrdering&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;exprs,
java.util.List&lt;java.util.Set&lt;java.lang.Integer&gt;&gt;&nbsp;cohorts)</pre>
<div class="block">Computes the order in which to visit expressions, so that we decide the
level of an expression only after the levels of lower expressions have
been decided.
<p>First, we need to ensure that an expression is visited after all of
its inputs.
<p>Further, if the expression is a member of a cohort, we need to visit
it after the inputs of all other expressions in that cohort. With this
condition, expressions in the same cohort will very likely end up in the
same level.
<p>Note that if there are no cohorts, the expressions from the
<a href="../../rex/RexProgram.html" title="class in org.apache.calcite.rex"><code>RexProgram</code></a> are already in a suitable order. We perform the
topological sort just to ensure that the code path is well-trodden.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exprs</code> - Expressions</dd>
<dd><code>cohorts</code> - List of cohorts, each of which is a set of expr ordinals</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Expression ordinals in topological order</dd>
</dl>
</li>
</ul>
<a id="findCohort(java.util.List,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>findCohort</h4>
<pre class="methodSignature">private static&nbsp;java.util.Set&lt;java.lang.Integer&gt;&nbsp;findCohort&#8203;(java.util.List&lt;java.util.Set&lt;java.lang.Integer&gt;&gt;&nbsp;cohorts,
int&nbsp;ordinal)</pre>
<div class="block">Finds the cohort that contains the given integer, or returns null.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cohorts</code> - List of cohorts, each a set of integers</dd>
<dd><code>ordinal</code> - Integer to search for</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Cohort that contains the integer, or null if not found</dd>
</dl>
</li>
</ul>
<a id="identityArray(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>identityArray</h4>
<pre class="methodSignature">private&nbsp;int[]&nbsp;identityArray&#8203;(int&nbsp;length)</pre>
</li>
</ul>
<a id="createProgramForLevel(int,int,org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexNode[],int[],int[],int[],int,org.apache.calcite.rel.type.RelDataType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createProgramForLevel</h4>
<pre class="methodSignature">private&nbsp;<a href="../../rex/RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;createProgramForLevel&#8203;(int&nbsp;level,
int&nbsp;levelCount,
<a href="../type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;allExprs,
int[]&nbsp;exprLevels,
int[]&nbsp;inputExprOrdinals,
int[]&nbsp;projectExprOrdinals,
int&nbsp;conditionExprOrdinal,
<a href="../type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType)</pre>
<div class="block">Creates a program containing the expressions for a given level.
<p>The expression list of the program will consist of all entries in the
expression list <code>allExprs[i]</code> for which the corresponding
level ordinal <code>exprLevels[i]</code> is equal to <code>level</code>.
Expressions are mapped according to <code>inputExprOrdinals</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>level</code> - Level ordinal</dd>
<dd><code>levelCount</code> - Number of levels</dd>
<dd><code>inputRowType</code> - Input row type</dd>
<dd><code>allExprs</code> - Array of all expressions</dd>
<dd><code>exprLevels</code> - Array of the level ordinal of each expression</dd>
<dd><code>inputExprOrdinals</code> - Ordinals in the expression list of input
expressions. Input expression <code>i</code>
will be found at position
<code>inputExprOrdinals[i]</code>.</dd>
<dd><code>projectExprOrdinals</code> - Ordinals of the expressions to be output this
level.</dd>
<dd><code>conditionExprOrdinal</code> - Ordinal of the expression to form the
condition for this level, or -1 if there is no
condition.</dd>
<dd><code>outputRowType</code> - Output row type</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Relational expression</dd>
</dl>
</li>
</ul>
<a id="deriveFieldName(org.apache.calcite.rex.RexNode,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>deriveFieldName</h4>
<pre class="methodSignature">private&nbsp;java.lang.String&nbsp;deriveFieldName&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
int&nbsp;ordinal)</pre>
</li>
</ul>
<a id="traceLevelExpressions(org.apache.calcite.rex.RexNode[],int[],int[],int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>traceLevelExpressions</h4>
<pre class="methodSignature">private&nbsp;void&nbsp;traceLevelExpressions&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>[]&nbsp;exprs,
int[]&nbsp;exprLevels,
int[]&nbsp;levelTypeOrdinals,
int&nbsp;levelCount)</pre>
<div class="block">Traces the given array of level expression lists at the finer level.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exprs</code> - Array expressions</dd>
<dd><code>exprLevels</code> - For each expression, the ordinal of its level</dd>
<dd><code>levelTypeOrdinals</code> - For each level, the ordinal of its type in
the <a href="#relTypes"><code>relTypes</code></a> array</dd>
<dd><code>levelCount</code> - The number of levels</dd>
</dl>
</li>
</ul>
<a id="count(boolean[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>count</h4>
<pre class="methodSignature">private static&nbsp;int&nbsp;count&#8203;(boolean[]&nbsp;booleans)</pre>
<div class="block">Returns the number of bits set in an array.</div>
</li>
</ul>
<a id="firstSet(boolean[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>firstSet</h4>
<pre class="methodSignature">private static&nbsp;int&nbsp;firstSet&#8203;(boolean[]&nbsp;booleans)</pre>
<div class="block">Returns the index of the first set bit in an array.</div>
</li>
</ul>
<a id="indexOf(int,int[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>indexOf</h4>
<pre class="methodSignature">private static&nbsp;int&nbsp;indexOf&#8203;(int&nbsp;value,
int[]&nbsp;map)</pre>
<div class="block">Searches for a value in a map, and returns the position where it was
found, or -1.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - Value to search for</dd>
<dd><code>map</code> - Map to search in</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Ordinal of value in map, or -1 if not found</dd>
</dl>
</li>
</ul>
<a id="canImplement(org.apache.calcite.rel.logical.LogicalCalc,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>canImplement</h4>
<pre class="methodSignature">protected&nbsp;boolean&nbsp;canImplement&#8203;(<a href="../logical/LogicalCalc.html" title="class in org.apache.calcite.rel.logical">LogicalCalc</a>&nbsp;rel,
java.lang.String&nbsp;relTypeName)</pre>
<div class="block">Returns whether a relational expression can be implemented solely in a
given <a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules"><code>CalcRelSplitter.RelType</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>rel</code> - Calculation relational expression</dd>
<dd><code>relTypeName</code> - Name of a <a href="CalcRelSplitter.RelType.html" title="class in org.apache.calcite.rel.rules"><code>CalcRelSplitter.RelType</code></a></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Whether relational expression can be implemented</dd>
</dl>
</li>
</ul>
<a id="getCohorts()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getCohorts</h4>
<pre class="methodSignature">protected&nbsp;java.util.List&lt;java.util.Set&lt;java.lang.Integer&gt;&gt;&nbsp;getCohorts()</pre>
<div class="block">Returns a list of sets of expressions that should be on the same level.
<p>For example, if this method returns { {3, 5}, {4, 7} }, it means that
expressions 3 and 5, should be on the same level, and expressions 4 and 7
should be on the same level. The two cohorts do not need to be on the
same level.
<p>The list is best effort. If it is not possible to arrange that the
expressions in a cohort are on the same level, the <a href="#execute()"><code>execute()</code></a>
method will still succeed.
<p>The default implementation of this method returns the empty list;
expressions will be put on the most suitable level. This is generally
the lowest possible level, except for literals, which are placed at the
level where they are used.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>List of cohorts, that is sets of expressions, that the splitting
algorithm should attempt to place on the same level</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CalcRelSplitter.html">Use</a></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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2012&#x2013;2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>