blob: 23239ff0aa9acf1f76c7127c7e727d21cec4fecb [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>RexProgramBuilder (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="RexProgramBuilder (Apache Calcite API)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":9,"i9":10,"i10":10,"i11":10,"i12":41,"i13":41,"i14":9,"i15":9,"i16":9,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":9,"i24":9,"i25":41,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated 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/RexProgramBuilder.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.rex</a></div>
<h2 title="Class RexProgramBuilder" class="title">Class RexProgramBuilder</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.calcite.rex.RexProgramBuilder</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public class <span class="typeNameLabel">RexProgramBuilder</span>
extends java.lang.Object</pre>
<div class="block">Workspace for constructing a <a href="RexProgram.html" title="class in org.apache.calcite.rex"><code>RexProgram</code></a>.
<p>RexProgramBuilder is necessary because a <a href="RexProgram.html" title="class in org.apache.calcite.rex"><code>RexProgram</code></a> is immutable.
(The <code>String</code> class has the same problem: it is immutable, so they
introduced <code>StringBuilder</code>.)</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 class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="RexProgramBuilder.RegisterInputShuttle.html" title="class in org.apache.calcite.rex">RexProgramBuilder.RegisterInputShuttle</a></span></code></th>
<td class="colLast">
<div class="block">Shuttle which walks over an expression, registering each sub-expression.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="RexProgramBuilder.RegisterMidputShuttle.html" title="class in org.apache.calcite.rex">RexProgramBuilder.RegisterMidputShuttle</a></span></code></th>
<td class="colLast">
<div class="block">Extension to <a href="RexProgramBuilder.RegisterInputShuttle.html" title="class in org.apache.calcite.rex"><code>RexProgramBuilder.RegisterInputShuttle</code></a> which allows expressions to be
in terms of inputs or previous common sub-expressions.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="RexProgramBuilder.RegisterOutputShuttle.html" title="class in org.apache.calcite.rex">RexProgramBuilder.RegisterOutputShuttle</a></span></code></th>
<td class="colLast">
<div class="block">Shuttle which walks over an expression, registering each sub-expression.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="RexProgramBuilder.RegisterShuttle.html" title="class in org.apache.calcite.rex">RexProgramBuilder.RegisterShuttle</a></span></code></th>
<td class="colLast">
<div class="block">Shuttle that visits a tree of <a href="RexNode.html" title="class in org.apache.calcite.rex"><code>RexNode</code></a> and registers them
in a program.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="RexProgramBuilder.UpdateRefShuttle.html" title="class in org.apache.calcite.rex">RexProgramBuilder.UpdateRefShuttle</a></span></code></th>
<td class="colLast">
<div class="block">Shuttle which rewires <a href="RexLocalRef.html" title="class in org.apache.calcite.rex"><code>RexLocalRef</code></a> using a list of updated
references</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="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#conditionRef">conditionRef</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#exprList">exprList</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private java.util.Map&lt;<a href="../util/Pair.html" title="class in org.apache.calcite.util">Pair</a>&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,&#8203;java.lang.String&gt;,&#8203;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#exprMap">exprMap</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private <a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#inputRowType">inputRowType</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#localRefList">localRefList</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private java.util.List&lt;java.lang.String&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#projectNameList">projectNameList</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#projectRefList">projectRefList</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private <a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rexBuilder">rexBuilder</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#simplify">simplify</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#validating">validating</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">Modifier</th>
<th class="colSecond" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>&nbsp;</code></td>
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexBuilder)">RexProgramBuilder</a></span>&#8203;(<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder)</code></th>
<td class="colLast">
<div class="block">Creates a program-builder that will not simplify.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private </code></td>
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify)">RexProgramBuilder</a></span>&#8203;(<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify)</code></th>
<td class="colLast">
<div class="block">Creates a program-builder.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private </code></td>
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.lang.Iterable,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean,org.apache.calcite.rex.RexSimplify)">RexProgramBuilder</a></span>&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.lang.Iterable&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize,
<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify)</code></th>
<td class="colLast">
<div class="block">Creates a program builder with the same contents as a program.</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><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated 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>private void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#add(java.util.List,java.util.List,org.apache.calcite.rex.RexLocalRef,org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexShuttle,boolean)">add</a></span>&#8203;(java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;&nbsp;projectRefList,
<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;conditionRef,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
<a href="RexShuttle.html" title="class in org.apache.calcite.rex">RexShuttle</a>&nbsp;shuttle,
boolean&nbsp;updateRefs)</code></th>
<td class="colLast">
<div class="block">Adds a set of expressions, projections and filters, applying a shuttle
first.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addCondition(org.apache.calcite.rex.RexNode)">addCondition</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</code></th>
<td class="colLast">
<div class="block">Sets the condition of the program.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addExpr(org.apache.calcite.rex.RexNode)">addExpr</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</code></th>
<td class="colLast">
<div class="block">Adds an expression to the list of common expressions, and returns a
reference to the expression.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addIdentity()">addIdentity</a></span>()</code></th>
<td class="colLast">
<div class="block">Adds a project item for every input field.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addProject(int,int,java.lang.String)">addProject</a></span>&#8203;(int&nbsp;at,
int&nbsp;ordinal,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Adds a projection based upon the <code>index</code>th expression at a
given position.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addProject(int,java.lang.String)">addProject</a></span>&#8203;(int&nbsp;ordinal,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Adds a projection based upon the <code>index</code>th expression.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addProject(int,org.apache.calcite.rex.RexNode,java.lang.String)">addProject</a></span>&#8203;(int&nbsp;at,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Adds a project expression to the program at a given position.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addProject(org.apache.calcite.rex.RexNode,java.lang.String)">addProject</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Adds a project expression to the program.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>private static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#assertionsAreEnabled()">assertionsAreEnabled</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns whether assertions are enabled in this class.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#clearCondition()">clearCondition</a></span>()</code></th>
<td class="colLast">
<div class="block">Clears the condition.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#clearProjects()">clearProjects</a></span>()</code></th>
<td class="colLast">
<div class="block">Removes all project items.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>private <a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#computeOutputRowType()">computeOutputRowType</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static <a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean)">create</a></span>&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static <a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean,boolean)">create</a></span>&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize,
boolean&nbsp;simplify_)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static <a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean,org.apache.calcite.rex.RexSimplify)">create</a></span>&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize,
<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify)</code></th>
<td class="colLast">
<div class="block">Creates a program builder with the same contents as a program.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static <a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexLocalRef,org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexShuttle,boolean)">create</a></span>&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;&nbsp;projectRefList,
<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;conditionRef,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
<a href="RexShuttle.html" title="class in org.apache.calcite.rex">RexShuttle</a>&nbsp;shuttle,
boolean&nbsp;updateRefs)</code></th>
<td class="colLast">
<div class="block">Creates a program builder with the same contents as a program, applying a
shuttle first.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static <a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#forProgram(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder,boolean)">forProgram</a></span>&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;program,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
boolean&nbsp;normalize)</code></th>
<td class="colLast">
<div class="block">Creates a program builder and initializes it from an existing program.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>private void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateMissingNames()">generateMissingNames</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInputRowType()">getInputRowType</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the rowtype of the input to the program</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code><a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getProgram()">getProgram</a></span>()</code></th>
<td class="colLast">
<div class="block">Converts the state of the program builder to an immutable program,
normalizing in the process.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code><a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getProgram(boolean)">getProgram</a></span>&#8203;(boolean&nbsp;normalize)</code></th>
<td class="colLast">
<div class="block">Converts the state of the program builder to an immutable program.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getProjectList()">getProjectList</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the list of project expressions.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#makeInputRef(int)">makeInputRef</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Creates a reference to a given input field.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>static <a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#mergePrograms(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder)">mergePrograms</a></span>&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;topProgram,
<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;bottomProgram,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder)</code></th>
<td class="colLast">
<div class="block">Merges two programs together, and normalizes the result.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>static <a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#mergePrograms(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder,boolean)">mergePrograms</a></span>&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;topProgram,
<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;bottomProgram,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
boolean&nbsp;normalize)</code></th>
<td class="colLast">
<div class="block">Merges two programs together.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>static <a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#normalize(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexProgram)">normalize</a></span>&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;program)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#registerInput(org.apache.calcite.rex.RexNode)">registerInput</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</code></th>
<td class="colLast">
<div class="block">Registers an expression in the list of common sub-expressions, and
returns a reference to that expression.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>private <a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#registerInternal(org.apache.calcite.rex.RexNode,boolean)">registerInternal</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
boolean&nbsp;force)</code></th>
<td class="colLast">
<div class="block">Registers an expression in the list of common sub-expressions, and
returns a reference to that expression.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code><a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#registerOutput(org.apache.calcite.rex.RexNode)">registerOutput</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</code></th>
<td class="colLast">
<div class="block">Converts an expression expressed in terms of the <em>outputs</em> of this
program into an expression expressed in terms of the <em>inputs</em>,
registers it in the list of common sub-expressions, and returns a
reference to that expression.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>private java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#registerProjectsAndCondition(org.apache.calcite.rex.RexProgram)">registerProjectsAndCondition</a></span>&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;program)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>private void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#validate(org.apache.calcite.rex.RexNode,int)">validate</a></span>&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
int&nbsp;fieldOrdinal)</code></th>
<td class="colLast">&nbsp;</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="rexBuilder">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rexBuilder</h4>
<pre>private final&nbsp;<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a> rexBuilder</pre>
</li>
</ul>
<a id="inputRowType">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>inputRowType</h4>
<pre>private final&nbsp;<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a> inputRowType</pre>
</li>
</ul>
<a id="exprList">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>exprList</h4>
<pre>private final&nbsp;java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt; exprList</pre>
</li>
</ul>
<a id="exprMap">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>exprMap</h4>
<pre>private final&nbsp;java.util.Map&lt;<a href="../util/Pair.html" title="class in org.apache.calcite.util">Pair</a>&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,&#8203;java.lang.String&gt;,&#8203;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt; exprMap</pre>
</li>
</ul>
<a id="localRefList">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>localRefList</h4>
<pre>private final&nbsp;java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt; localRefList</pre>
</li>
</ul>
<a id="projectRefList">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>projectRefList</h4>
<pre>private final&nbsp;java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt; projectRefList</pre>
</li>
</ul>
<a id="projectNameList">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>projectNameList</h4>
<pre>private final&nbsp;java.util.List&lt;java.lang.String&gt; projectNameList</pre>
</li>
</ul>
<a id="simplify">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>simplify</h4>
<pre>private final&nbsp;<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a> simplify</pre>
</li>
</ul>
<a id="conditionRef">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>conditionRef</h4>
<pre>private&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a> conditionRef</pre>
</li>
</ul>
<a id="validating">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>validating</h4>
<pre>private&nbsp;boolean validating</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.type.RelDataType,org.apache.calcite.rex.RexBuilder)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>RexProgramBuilder</h4>
<pre>public&nbsp;RexProgramBuilder&#8203;(<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder)</pre>
<div class="block">Creates a program-builder that will not simplify.</div>
</li>
</ul>
<a id="&lt;init&gt;(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>RexProgramBuilder</h4>
<pre>private&nbsp;RexProgramBuilder&#8203;(<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify)</pre>
<div class="block">Creates a program-builder.</div>
</li>
</ul>
<a id="&lt;init&gt;(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.lang.Iterable,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean,org.apache.calcite.rex.RexSimplify)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>RexProgramBuilder</h4>
<pre>private&nbsp;RexProgramBuilder&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.lang.Iterable&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize,
<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify)</pre>
<div class="block">Creates a program builder with the same contents as a program.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>rexBuilder</code> - Rex builder</dd>
<dd><code>inputRowType</code> - Input row type</dd>
<dd><code>exprList</code> - Common expressions</dd>
<dd><code>projectList</code> - Projections</dd>
<dd><code>condition</code> - Condition, or null</dd>
<dd><code>outputRowType</code> - Output row type</dd>
<dd><code>normalize</code> - Whether to normalize</dd>
<dd><code>simplify</code> - Simplifier, or null to not simplify</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="assertionsAreEnabled()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>assertionsAreEnabled</h4>
<pre class="methodSignature">private static&nbsp;boolean&nbsp;assertionsAreEnabled()</pre>
<div class="block">Returns whether assertions are enabled in this class.</div>
</li>
</ul>
<a id="validate(org.apache.calcite.rex.RexNode,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validate</h4>
<pre class="methodSignature">private&nbsp;void&nbsp;validate&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
int&nbsp;fieldOrdinal)</pre>
</li>
</ul>
<a id="addProject(org.apache.calcite.rex.RexNode,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addProject</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;addProject&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
java.lang.String&nbsp;name)</pre>
<div class="block">Adds a project expression to the program.
<p>The expression specified in terms of the input fields. If not, call
<a href="#registerOutput(org.apache.calcite.rex.RexNode)"><code>registerOutput(RexNode)</code></a> first.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>expr</code> - Expression to add</dd>
<dd><code>name</code> - Name of field in output row type; if null, a unique name will
be generated when the program is created</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ref created</dd>
</dl>
</li>
</ul>
<a id="addProject(int,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addProject</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;addProject&#8203;(int&nbsp;ordinal,
java.lang.String&nbsp;name)</pre>
<div class="block">Adds a projection based upon the <code>index</code>th expression.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>ordinal</code> - Index of expression to project</dd>
<dd><code>name</code> - Name of field in output row type; if null, a unique name
will be generated when the program is created</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ref created</dd>
</dl>
</li>
</ul>
<a id="addProject(int,org.apache.calcite.rex.RexNode,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addProject</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;addProject&#8203;(int&nbsp;at,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
java.lang.String&nbsp;name)</pre>
<div class="block">Adds a project expression to the program at a given position.
<p>The expression specified in terms of the input fields. If not, call
<a href="#registerOutput(org.apache.calcite.rex.RexNode)"><code>registerOutput(RexNode)</code></a> first.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>at</code> - Position in project list to add expression</dd>
<dd><code>expr</code> - Expression to add</dd>
<dd><code>name</code> - Name of field in output row type; if null, a unique name will
be generated when the program is created</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ref created</dd>
</dl>
</li>
</ul>
<a id="addProject(int,int,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addProject</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;addProject&#8203;(int&nbsp;at,
int&nbsp;ordinal,
java.lang.String&nbsp;name)</pre>
<div class="block">Adds a projection based upon the <code>index</code>th expression at a
given position.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>at</code> - Position in project list to add expression</dd>
<dd><code>ordinal</code> - Index of expression to project</dd>
<dd><code>name</code> - Name of field in output row type; if null, a unique name
will be generated when the program is created</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ref created</dd>
</dl>
</li>
</ul>
<a id="addCondition(org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addCondition</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;addCondition&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</pre>
<div class="block">Sets the condition of the program.
<p>The expression must be specified in terms of the input fields. If
not, call <a href="#registerOutput(org.apache.calcite.rex.RexNode)"><code>registerOutput(RexNode)</code></a> first.</p></div>
</li>
</ul>
<a id="registerInput(org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerInput</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;registerInput&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</pre>
<div class="block">Registers an expression in the list of common sub-expressions, and
returns a reference to that expression.
<p>The expression must be expressed in terms of the <em>inputs</em> of
this program.</p></div>
</li>
</ul>
<a id="registerOutput(org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerOutput</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;registerOutput&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</pre>
<div class="block">Converts an expression expressed in terms of the <em>outputs</em> of this
program into an expression expressed in terms of the <em>inputs</em>,
registers it in the list of common sub-expressions, and returns a
reference to that expression.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>expr</code> - Expression to register</dd>
</dl>
</li>
</ul>
<a id="registerInternal(org.apache.calcite.rex.RexNode,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerInternal</h4>
<pre class="methodSignature">private&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;registerInternal&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
boolean&nbsp;force)</pre>
<div class="block">Registers an expression in the list of common sub-expressions, and
returns a reference to that expression.
<p>If an equivalent sub-expression already exists, creates another
expression only if <code>force</code> is true.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>expr</code> - Expression to register</dd>
<dd><code>force</code> - Whether to create a new sub-expression if an equivalent
sub-expression exists.</dd>
</dl>
</li>
</ul>
<a id="addExpr(org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addExpr</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;addExpr&#8203;(<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr)</pre>
<div class="block">Adds an expression to the list of common expressions, and returns a
reference to the expression. <b>DOES NOT CHECK WHETHER THE EXPRESSION
ALREADY EXISTS</b>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>expr</code> - Expression</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Reference to expression</dd>
</dl>
</li>
</ul>
<a id="getProgram()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProgram</h4>
<pre class="methodSignature">public&nbsp;<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;getProgram()</pre>
<div class="block">Converts the state of the program builder to an immutable program,
normalizing in the process.
<p>It is OK to call this method, modify the program specification (by
adding projections, and so forth), and call this method again.</div>
</li>
</ul>
<a id="getProgram(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProgram</h4>
<pre class="methodSignature">public&nbsp;<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;getProgram&#8203;(boolean&nbsp;normalize)</pre>
<div class="block">Converts the state of the program builder to an immutable program.
<p>It is OK to call this method, modify the program specification (by
adding projections, and so forth), and call this method again.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>normalize</code> - Whether to normalize</dd>
</dl>
</li>
</ul>
<a id="computeOutputRowType()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeOutputRowType</h4>
<pre class="methodSignature">private&nbsp;<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;computeOutputRowType()</pre>
</li>
</ul>
<a id="generateMissingNames()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateMissingNames</h4>
<pre class="methodSignature">private&nbsp;void&nbsp;generateMissingNames()</pre>
</li>
</ul>
<a id="forProgram(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>forProgram</h4>
<pre class="methodSignature">public static&nbsp;<a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a>&nbsp;forProgram&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;program,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
boolean&nbsp;normalize)</pre>
<div class="block">Creates a program builder and initializes it from an existing program.
<p>Calling <a href="#getProgram()"><code>getProgram()</code></a> immediately after creation will return a
program equivalent (in terms of external behavior) to the existing
program.
<p>The existing program will not be changed. (It cannot: programs are
immutable.)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>program</code> - Existing program</dd>
<dd><code>rexBuilder</code> - Rex builder</dd>
<dd><code>normalize</code> - Whether to normalize</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A program builder initialized with an equivalent program</dd>
</dl>
</li>
</ul>
<a id="create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean,org.apache.calcite.rex.RexSimplify)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre class="methodSignature">public static&nbsp;<a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a>&nbsp;create&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize,
<a href="RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify)</pre>
<div class="block">Creates a program builder with the same contents as a program.
<p>If <code>normalize</code>, converts the program to canonical form. In
canonical form, in addition to the usual constraints:
<ul>
<li>The first N internal expressions are <a href="RexInputRef.html" title="class in org.apache.calcite.rex"><code>RexInputRef</code></a>s to the N
input fields;
<li>Subsequent internal expressions reference only preceding expressions;
<li>Arguments to <a href="RexCall.html" title="class in org.apache.calcite.rex"><code>RexCall</code></a>s must be <a href="RexLocalRef.html" title="class in org.apache.calcite.rex"><code>RexLocalRef</code></a>s (that is,
expressions must have maximum depth 1)
</ul>
<p>there are additional constraints:
<ul>
<li>Expressions appear in the left-deep order they are needed by
the projections and (if present) the condition. Thus, expression N+1
is the leftmost argument (literal or or call) in the expansion of
projection #0.
<li>There are no duplicate expressions
<li>There are no unused expressions
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>rexBuilder</code> - Rex builder</dd>
<dd><code>inputRowType</code> - Input row type</dd>
<dd><code>exprList</code> - Common expressions</dd>
<dd><code>projectList</code> - Projections</dd>
<dd><code>condition</code> - Condition, or null</dd>
<dd><code>outputRowType</code> - Output row type</dd>
<dd><code>normalize</code> - Whether to normalize</dd>
<dd><code>simplify</code> - Whether to simplify expressions</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A program builder</dd>
</dl>
</li>
</ul>
<a id="create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre class="methodSignature">@Deprecated
public static&nbsp;<a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a>&nbsp;create&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize,
boolean&nbsp;simplify_)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
</li>
</ul>
<a id="create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.type.RelDataType,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre class="methodSignature">@Deprecated
public static&nbsp;<a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a>&nbsp;create&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;? extends <a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;projectList,
<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
boolean&nbsp;normalize)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
</li>
</ul>
<a id="create(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.type.RelDataType,java.util.List,java.util.List,org.apache.calcite.rex.RexLocalRef,org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexShuttle,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre class="methodSignature">public static&nbsp;<a href="RexProgramBuilder.html" title="class in org.apache.calcite.rex">RexProgramBuilder</a>&nbsp;create&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;inputRowType,
java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;&nbsp;projectRefList,
<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;conditionRef,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
<a href="RexShuttle.html" title="class in org.apache.calcite.rex">RexShuttle</a>&nbsp;shuttle,
boolean&nbsp;updateRefs)</pre>
<div class="block">Creates a program builder with the same contents as a program, applying a
shuttle first.
<p>TODO: Refactor the above create method in terms of this one.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>rexBuilder</code> - Rex builder</dd>
<dd><code>inputRowType</code> - Input row type</dd>
<dd><code>exprList</code> - Common expressions</dd>
<dd><code>projectRefList</code> - Projections</dd>
<dd><code>conditionRef</code> - Condition, or null</dd>
<dd><code>outputRowType</code> - Output row type</dd>
<dd><code>shuttle</code> - Shuttle to apply to each expression before adding it
to the program builder</dd>
<dd><code>updateRefs</code> - Whether to update references that changes as a result
of rewrites made by the shuttle</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A program builder</dd>
</dl>
</li>
</ul>
<a id="normalize(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexProgram)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>normalize</h4>
<pre class="methodSignature">@Deprecated
public static&nbsp;<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;normalize&#8203;(<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;program)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
</li>
</ul>
<a id="add(java.util.List,java.util.List,org.apache.calcite.rex.RexLocalRef,org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rex.RexShuttle,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre class="methodSignature">private&nbsp;void&nbsp;add&#8203;(java.util.List&lt;<a href="RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprList,
java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;&nbsp;projectRefList,
<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;conditionRef,
<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;outputRowType,
<a href="RexShuttle.html" title="class in org.apache.calcite.rex">RexShuttle</a>&nbsp;shuttle,
boolean&nbsp;updateRefs)</pre>
<div class="block">Adds a set of expressions, projections and filters, applying a shuttle
first.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exprList</code> - Common expressions</dd>
<dd><code>projectRefList</code> - Projections</dd>
<dd><code>conditionRef</code> - Condition, or null</dd>
<dd><code>outputRowType</code> - Output row type</dd>
<dd><code>shuttle</code> - Shuttle to apply to each expression before adding it
to the program builder</dd>
<dd><code>updateRefs</code> - Whether to update references that changes as a result
of rewrites made by the shuttle</dd>
</dl>
</li>
</ul>
<a id="mergePrograms(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mergePrograms</h4>
<pre class="methodSignature">public static&nbsp;<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;mergePrograms&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;topProgram,
<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;bottomProgram,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder)</pre>
<div class="block">Merges two programs together, and normalizes the result.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topProgram</code> - Top program. Its expressions are in terms of the
outputs of the bottom program.</dd>
<dd><code>bottomProgram</code> - Bottom program. Its expressions are in terms of the
result fields of the relational expression's input</dd>
<dd><code>rexBuilder</code> - Rex builder</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Merged program</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#mergePrograms(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder,boolean)"><code>mergePrograms(RexProgram, RexProgram, RexBuilder, boolean)</code></a></dd>
</dl>
</li>
</ul>
<a id="mergePrograms(org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexProgram,org.apache.calcite.rex.RexBuilder,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mergePrograms</h4>
<pre class="methodSignature">public static&nbsp;<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;mergePrograms&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;topProgram,
<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;bottomProgram,
<a href="RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
boolean&nbsp;normalize)</pre>
<div class="block">Merges two programs together.
<p>All expressions become common sub-expressions. For example, the query
<blockquote><pre>SELECT x + 1 AS p, x + y AS q FROM (
SELECT a + b AS x, c AS y
FROM t
WHERE c = 6)}</pre></blockquote>
<p>would be represented as the programs
<blockquote><pre>
Calc:
Projects={$2, $3},
Condition=null,
Exprs={$0, $1, $0 + 1, $0 + $1})
Calc(
Projects={$3, $2},
Condition={$4}
Exprs={$0, $1, $2, $0 + $1, $2 = 6}
</pre></blockquote>
<p>The merged program is
<blockquote><pre>
Calc(
Projects={$4, $5}
Condition=$6
Exprs={0: $0 // a
1: $1 // b
2: $2 // c
3: ($0 + $1) // x = a + b
4: ($3 + 1) // p = x + 1
5: ($3 + $2) // q = x + y
6: ($2 = 6) // c = 6
</pre></blockquote>
<p>Another example:</p>
<blockquote>
<pre>SELECT *
FROM (
SELECT a + b AS x, c AS y
FROM t
WHERE c = 6)
WHERE x = 5</pre>
</blockquote>
<p>becomes
<blockquote>
<pre>SELECT a + b AS x, c AS y
FROM t
WHERE c = 6 AND (a + b) = 5</pre>
</blockquote></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topProgram</code> - Top program. Its expressions are in terms of the
outputs of the bottom program.</dd>
<dd><code>bottomProgram</code> - Bottom program. Its expressions are in terms of the
result fields of the relational expression's input</dd>
<dd><code>rexBuilder</code> - Rex builder</dd>
<dd><code>normalize</code> - Whether to convert program to canonical form</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Merged program</dd>
</dl>
</li>
</ul>
<a id="registerProjectsAndCondition(org.apache.calcite.rex.RexProgram)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerProjectsAndCondition</h4>
<pre class="methodSignature">private&nbsp;java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;&nbsp;registerProjectsAndCondition&#8203;(<a href="RexProgram.html" title="class in org.apache.calcite.rex">RexProgram</a>&nbsp;program)</pre>
</li>
</ul>
<a id="clearProjects()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearProjects</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;clearProjects()</pre>
<div class="block">Removes all project items.
<p>After calling this method, you may need to re-normalize.</p></div>
</li>
</ul>
<a id="clearCondition()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearCondition</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;clearCondition()</pre>
<div class="block">Clears the condition.
<p>After calling this method, you may need to re-normalize.</p></div>
</li>
</ul>
<a id="addIdentity()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addIdentity</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;addIdentity()</pre>
<div class="block">Adds a project item for every input field.
<p>You cannot call this method if there are other project items.</div>
</li>
</ul>
<a id="makeInputRef(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeInputRef</h4>
<pre class="methodSignature">public&nbsp;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&nbsp;makeInputRef&#8203;(int&nbsp;index)</pre>
<div class="block">Creates a reference to a given input field.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - Ordinal of input field, must be less than the number of
fields in the input type</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Reference to input field</dd>
</dl>
</li>
</ul>
<a id="getInputRowType()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInputRowType</h4>
<pre class="methodSignature">public&nbsp;<a href="../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;getInputRowType()</pre>
<div class="block">Returns the rowtype of the input to the program</div>
</li>
</ul>
<a id="getProjectList()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getProjectList</h4>
<pre class="methodSignature">public&nbsp;java.util.List&lt;<a href="RexLocalRef.html" title="class in org.apache.calcite.rex">RexLocalRef</a>&gt;&nbsp;getProjectList()</pre>
<div class="block">Returns the list of project expressions.</div>
</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/RexProgramBuilder.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>