blob: e5a91b12181ec82b505f7ed6dae808af25cef810 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>SubstitutionVisitor (Apache Calcite API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.calcite.plan, class: SubstitutionVisitor">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<div class="about-language"><b>Apache Calcite</b></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li><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="sub-nav-list">
<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>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.calcite.plan</a></div>
<h1 title="Class SubstitutionVisitor" class="title">Class SubstitutionVisitor</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">org.apache.calcite.plan.SubstitutionVisitor</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="MaterializedViewSubstitutionVisitor.html" title="class in org.apache.calcite.plan">MaterializedViewSubstitutionVisitor</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">SubstitutionVisitor</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">Substitutes part of a tree of relational expressions with another tree.
<p>The call <code>new SubstitutionVisitor(target, query).go(replacement))</code>
will return <code>query</code> with every occurrence of <code>target</code> replaced
by <code>replacement</code>.</p>
<p>The following example shows how <code>SubstitutionVisitor</code> can be used
for materialized view recognition.</p>
<ul>
<li>query = SELECT a, c FROM t WHERE x = 5 AND b = 4</li>
<li>target = SELECT a, b, c FROM t WHERE x = 5</li>
<li>replacement = SELECT * FROM mv</li>
<li>result = SELECT a, c FROM mv WHERE b = 4</li>
</ul>
<p>Note that <code>result</code> uses the materialized view table <code>mv</code> and a
simplified condition <code>b = 4</code>.</p>
<p>Uses a bottom-up matching algorithm. Nodes do not need to be identical.
At each level, returns the residue.</p>
<p>The inputs must only include the core relational operators:
<a href="../rel/core/TableScan.html" title="class in org.apache.calcite.rel.core"><code>TableScan</code></a>,
<a href="../rel/core/Filter.html" title="class in org.apache.calcite.rel.core"><code>Filter</code></a>,
<a href="../rel/core/Project.html" title="class in org.apache.calcite.rel.core"><code>Project</code></a>,
<a href="../rel/core/Calc.html" title="class in org.apache.calcite.rel.core"><code>Calc</code></a>,
<a href="../rel/core/Join.html" title="class in org.apache.calcite.rel.core"><code>Join</code></a>,
<a href="../rel/core/Union.html" title="class in org.apache.calcite.rel.core"><code>Union</code></a>,
<a href="../rel/core/Intersect.html" title="class in org.apache.calcite.rel.core"><code>Intersect</code></a>,
<a href="../rel/core/Aggregate.html" title="class in org.apache.calcite.rel.core"><code>Aggregate</code></a>.</p></div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<li>
<section class="nested-class-summary" id="nested-class-summary">
<h2>Nested Class Summary</h2>
<div class="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static class&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="SubstitutionVisitor.AbstractUnifyRule.html" class="type-name-link" title="class in org.apache.calcite.plan">SubstitutionVisitor.AbstractUnifyRule</a></code></div>
<div class="col-last even-row-color">
<div class="block">Abstract base class for implementing <a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan"><code>SubstitutionVisitor.UnifyRule</code></a>.</div>
</div>
<div class="col-first odd-row-color"><code>protected static class&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="SubstitutionVisitor.MatchFailed.html" class="type-name-link" title="class in org.apache.calcite.plan">SubstitutionVisitor.MatchFailed</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Exception thrown to exit a matcher.</div>
</div>
<div class="col-first even-row-color"><code>static class&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="SubstitutionVisitor.Operand.html" class="type-name-link" title="class in org.apache.calcite.plan">SubstitutionVisitor.Operand</a></code></div>
<div class="col-last even-row-color">
<div class="block">Operand to a <a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan"><code>SubstitutionVisitor.UnifyRule</code></a>.</div>
</div>
<div class="col-first odd-row-color"><code>static class&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="SubstitutionVisitor.UnifyResult.html" class="type-name-link" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyResult</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Result of an application of a <a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan"><code>SubstitutionVisitor.UnifyRule</code></a> indicating that the
rule successfully matched <code>query</code> against <code>target</code> and
generated a <code>result</code> that is equivalent to <code>query</code> and
contains <code>target</code>.</div>
</div>
<div class="col-first even-row-color"><code>static class&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="SubstitutionVisitor.UnifyRule.html" class="type-name-link" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a></code></div>
<div class="col-last even-row-color">
<div class="block">Rule that attempts to match a query relational expression
against a target relational expression.</div>
</div>
<div class="col-first odd-row-color"><code>class&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="SubstitutionVisitor.UnifyRuleCall.html" class="type-name-link" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRuleCall</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Arguments to an application of a <a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan"><code>SubstitutionVisitor.UnifyRule</code></a>.</div>
</div>
</div>
</section>
</li>
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static final com.google.common.collect.ImmutableList&lt;<a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#DEFAULT_RULES" class="member-name-link">DEFAULT_RULES</a></code></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><code>protected final <a href="../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a></code></div>
<div class="col-second odd-row-color"><code><a href="#relBuilder" class="member-name-link">relBuilder</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Factory for a builder for relational expressions.</div>
</div>
<div class="col-first even-row-color"><code>protected final <a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>[]</code></div>
<div class="col-second even-row-color"><code><a href="#slots" class="member-name-link">slots</a></code></div>
<div class="col-last even-row-color">
<div class="block">Workspace while rule is being matched.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode)" class="member-name-link">SubstitutionVisitor</a><wbr>(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;target_,
<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;query_)</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a SubstitutionVisitor with the default rule set.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,com.google.common.collect.ImmutableList)" class="member-name-link">SubstitutionVisitor</a><wbr>(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;target_,
<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;query_,
com.google.common.collect.ImmutableList&lt;<a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a>&gt;&nbsp;rules)</code></div>
<div class="col-last odd-row-color">
<div class="block">Creates a SubstitutionVisitor with the default logical builder.</div>
</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,com.google.common.collect.ImmutableList,org.apache.calcite.tools.RelBuilderFactory)" class="member-name-link">SubstitutionVisitor</a><wbr>(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;target_,
<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;query_,
com.google.common.collect.ImmutableList&lt;<a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a>&gt;&nbsp;rules,
<a href="../tools/RelBuilderFactory.html" title="interface in org.apache.calcite.tools">RelBuilderFactory</a>&nbsp;relBuilderFactory)</code></div>
<div class="col-last even-row-color">&nbsp;</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button><button id="method-summary-table-tab6" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab6', 3)" class="table-tab">Deprecated Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#equalType(java.lang.String,org.apache.calcite.rel.mutable.MutableRel,java.lang.String,org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.util.Litmus)" class="member-name-link">equalType</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;desc0,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel0,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;desc1,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel1,
<a href="../util/Litmus.html" title="interface in org.apache.calcite.util">Litmus</a>&nbsp;litmus)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Returns whether two relational expressions have the same row-type.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="../util/Pair.html" title="class in org.apache.calcite.util">Pair</a>&lt;<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#explainCalc(org.apache.calcite.rel.mutable.MutableCalc)" class="member-name-link">explainCalc</a><wbr>(<a href="../rel/mutable/MutableCalc.html" title="class in org.apache.calcite.rel.mutable">MutableCalc</a>&nbsp;calc)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Explain filtering condition and projections from MutableCalc.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4 method-summary-table-tab6"><code>static @Nullable <a href="../sql/SqlAggFunction.html" title="class in org.apache.calcite.sql">SqlAggFunction</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4 method-summary-table-tab6"><code><a href="#getRollup(org.apache.calcite.sql.SqlAggFunction)" class="member-name-link">getRollup</a><wbr>(<a href="../sql/SqlAggFunction.html" title="class in org.apache.calcite.sql">SqlAggFunction</a>&nbsp;aggregation)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4 method-summary-table-tab6">
<div class="block"><span class="deprecated-label">Deprecated.</span></div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#go(org.apache.calcite.rel.RelNode)" class="member-name-link">go</a><wbr>(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;replacement_)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a list of all possible rels that result from substituting the
matched RelNode with the replacement RelNode within the query.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@Nullable <a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#go0(org.apache.calcite.rel.RelNode)" class="member-name-link">go0</a><wbr>(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;replacement_)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>protected boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isWeaker(org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.rel.mutable.MutableRel)" class="member-name-link">isWeaker</a><wbr>(<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel0,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns if one rel is weaker than another.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#mayBeSatisfiable(org.apache.calcite.rex.RexNode)" class="member-name-link">mayBeSatisfiable</a><wbr>(<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;e)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Returns whether a boolean expression ever returns true.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#permute(org.apache.calcite.rel.mutable.MutableAggregate,org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.util.mapping.Mapping)" class="member-name-link">permute</a><wbr>(<a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a>&nbsp;aggregate,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;input,
<a href="../util/mapping/Mapping.html" title="interface in org.apache.calcite.util.mapping">Mapping</a>&nbsp;mapping)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static @Nullable org.apache.calcite.plan.SubstitutionVisitor.Replacement</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#replace(org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.rel.mutable.MutableRel)" class="member-name-link">replace</a><wbr>(<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;query,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;find,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;replace)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Within a relational expression <code>query</code>, replaces occurrences of
<code>find</code> with <code>replace</code>.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static @Nullable <a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#splitFilter(org.apache.calcite.rex.RexSimplify,org.apache.calcite.rex.RexNode,org.apache.calcite.rex.RexNode)" class="member-name-link">splitFilter</a><wbr>(<a href="../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;target)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Maps a condition onto a target.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static @Nullable <a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#unifyAggregates(org.apache.calcite.rel.mutable.MutableAggregate,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.mutable.MutableAggregate)" class="member-name-link">unifyAggregates</a><wbr>(<a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a>&nbsp;query,
@Nullable <a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;targetCond,
<a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a>&nbsp;target)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">&nbsp;</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="DEFAULT_RULES">
<h3>DEFAULT_RULES</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">com.google.common.collect.ImmutableList&lt;<a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a>&gt;</span>&nbsp;<span class="element-name">DEFAULT_RULES</span></div>
</section>
</li>
<li>
<section class="detail" id="relBuilder">
<h3>relBuilder</h3>
<div class="member-signature"><span class="modifiers">protected final</span>&nbsp;<span class="return-type"><a href="../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a></span>&nbsp;<span class="element-name">relBuilder</span></div>
<div class="block">Factory for a builder for relational expressions.</div>
</section>
</li>
<li>
<section class="detail" id="slots">
<h3>slots</h3>
<div class="member-signature"><span class="modifiers">protected final</span>&nbsp;<span class="return-type"><a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>[]</span>&nbsp;<span class="element-name">slots</span></div>
<div class="block">Workspace while rule is being matched.
Careful, re-entrant!
Assumes no rule needs more than 2 slots.</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode)">
<h3>SubstitutionVisitor</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">SubstitutionVisitor</span><wbr><span class="parameters">(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;target_,
<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;query_)</span></div>
<div class="block">Creates a SubstitutionVisitor with the default rule set.</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,com.google.common.collect.ImmutableList)">
<h3>SubstitutionVisitor</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">SubstitutionVisitor</span><wbr><span class="parameters">(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;target_,
<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;query_,
com.google.common.collect.ImmutableList&lt;<a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a>&gt;&nbsp;rules)</span></div>
<div class="block">Creates a SubstitutionVisitor with the default logical builder.</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,com.google.common.collect.ImmutableList,org.apache.calcite.tools.RelBuilderFactory)">
<h3>SubstitutionVisitor</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">SubstitutionVisitor</span><wbr><span class="parameters">(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;target_,
<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;query_,
com.google.common.collect.ImmutableList&lt;<a href="SubstitutionVisitor.UnifyRule.html" title="class in org.apache.calcite.plan">SubstitutionVisitor.UnifyRule</a>&gt;&nbsp;rules,
<a href="../tools/RelBuilderFactory.html" title="interface in org.apache.calcite.tools">RelBuilderFactory</a>&nbsp;relBuilderFactory)</span></div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="splitFilter(org.apache.calcite.rex.RexSimplify,org.apache.calcite.rex.RexNode,org.apache.calcite.rex.RexNode)">
<h3>splitFilter</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">@Nullable <a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></span>&nbsp;<span class="element-name">splitFilter</span><wbr><span class="parameters">(<a href="../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;condition,
<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;target)</span></div>
<div class="block">Maps a condition onto a target.
<p>If condition is stronger than target, returns the residue.
If it is equal to target, returns the expression that evaluates to
the constant <code>true</code>. If it is weaker than target, returns
<code>null</code>.</p>
<p>The terms satisfy the relation</p>
<blockquote>
<pre><code>condition = target AND residue</code></pre>
</blockquote>
<p>and <code>residue</code> must be as weak as possible.</p>
<p>Example #1: condition stronger than target</p>
<ul>
<li>condition: x = 1 AND y = 2</li>
<li>target: x = 1</li>
<li>residue: y = 2</li>
</ul>
<p>Note that residue <code>x &gt; 0 AND y = 2</code> would also satisfy the
relation <code>condition = target AND residue</code> but is stronger than
necessary, so we prefer <code>y = 2</code>.</p>
<p>Example #2: target weaker than condition (valid, but not currently
implemented)</p>
<ul>
<li>condition: x = 1</li>
<li>target: x = 1 OR z = 3</li>
<li>residue: x = 1</li>
</ul>
<p>Example #3: condition and target are equivalent</p>
<ul>
<li>condition: x = 1 AND y = 2</li>
<li>target: y = 2 AND x = 1</li>
<li>residue: TRUE</li>
</ul>
<p>Example #4: condition weaker than target</p>
<ul>
<li>condition: x = 1</li>
<li>target: x = 1 AND y = 2</li>
<li>residue: null (i.e. no match)</li>
</ul>
<p>There are many other possible examples. It amounts to solving
whether <code>condition AND NOT target</code> can ever evaluate to
true, and therefore is a form of the NP-complete
<a href="http://en.wikipedia.org/wiki/Satisfiability">Satisfiability</a>
problem.</p></div>
</section>
</li>
<li>
<section class="detail" id="mayBeSatisfiable(org.apache.calcite.rex.RexNode)">
<h3>mayBeSatisfiable</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">mayBeSatisfiable</span><wbr><span class="parameters">(<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;e)</span></div>
<div class="block">Returns whether a boolean expression ever returns true.
<p>This method may give false positives. For instance, it will say
that <code>x = 5 AND x &gt; 10</code> is satisfiable, because at present it
cannot prove that it is not.</p></div>
</section>
</li>
<li>
<section class="detail" id="go0(org.apache.calcite.rel.RelNode)">
<h3>go0</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">@Nullable <a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></span>&nbsp;<span class="element-name">go0</span><wbr><span class="parameters">(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;replacement_)</span></div>
</section>
</li>
<li>
<section class="detail" id="go(org.apache.calcite.rel.RelNode)">
<h3>go</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&gt;</span>&nbsp;<span class="element-name">go</span><wbr><span class="parameters">(<a href="../rel/RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;replacement_)</span></div>
<div class="block">Returns a list of all possible rels that result from substituting the
matched RelNode with the replacement RelNode within the query.
<p>For example, the substitution result of A join B, while A and B
are both a qualified match for replacement R, is R join B, R join R,
A join R.</div>
</section>
</li>
<li>
<section class="detail" id="replace(org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.rel.mutable.MutableRel)">
<h3>replace</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">@Nullable org.apache.calcite.plan.SubstitutionVisitor.Replacement</span>&nbsp;<span class="element-name">replace</span><wbr><span class="parameters">(<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;query,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;find,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;replace)</span></div>
<div class="block">Within a relational expression <code>query</code>, replaces occurrences of
<code>find</code> with <code>replace</code>.
<p>Assumes relational expressions (and their descendants) are not null.
Does not handle cycles.</div>
</section>
</li>
<li>
<section class="detail" id="explainCalc(org.apache.calcite.rel.mutable.MutableCalc)">
<h3>explainCalc</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="../util/Pair.html" title="class in org.apache.calcite.util">Pair</a>&lt;<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&gt;</span>&nbsp;<span class="element-name">explainCalc</span><wbr><span class="parameters">(<a href="../rel/mutable/MutableCalc.html" title="class in org.apache.calcite.rel.mutable">MutableCalc</a>&nbsp;calc)</span></div>
<div class="block">Explain filtering condition and projections from MutableCalc.</div>
</section>
</li>
<li>
<section class="detail" id="permute(org.apache.calcite.rel.mutable.MutableAggregate,org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.util.mapping.Mapping)">
<h3>permute</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a></span>&nbsp;<span class="element-name">permute</span><wbr><span class="parameters">(<a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a>&nbsp;aggregate,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;input,
<a href="../util/mapping/Mapping.html" title="interface in org.apache.calcite.util.mapping">Mapping</a>&nbsp;mapping)</span></div>
</section>
</li>
<li>
<section class="detail" id="unifyAggregates(org.apache.calcite.rel.mutable.MutableAggregate,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.mutable.MutableAggregate)">
<h3>unifyAggregates</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">@Nullable <a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a></span>&nbsp;<span class="element-name">unifyAggregates</span><wbr><span class="parameters">(<a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a>&nbsp;query,
@Nullable <a href="../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;targetCond,
<a href="../rel/mutable/MutableAggregate.html" title="class in org.apache.calcite.rel.mutable">MutableAggregate</a>&nbsp;target)</span></div>
</section>
</li>
<li>
<section class="detail" id="getRollup(org.apache.calcite.sql.SqlAggFunction)">
<h3>getRollup</h3>
<div class="member-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Deprecated.html" title="class or interface in java.lang" class="external-link">@Deprecated</a>
</span><span class="modifiers">public static</span>&nbsp;<span class="return-type">@Nullable <a href="../sql/SqlAggFunction.html" title="class in org.apache.calcite.sql">SqlAggFunction</a></span>&nbsp;<span class="element-name">getRollup</span><wbr><span class="parameters">(<a href="../sql/SqlAggFunction.html" title="class in org.apache.calcite.sql">SqlAggFunction</a>&nbsp;aggregation)</span></div>
<div class="deprecation-block"><span class="deprecated-label">Deprecated.</span></div>
</section>
</li>
<li>
<section class="detail" id="isWeaker(org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.rel.mutable.MutableRel)">
<h3>isWeaker</h3>
<div class="member-signature"><span class="modifiers">protected</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isWeaker</span><wbr><span class="parameters">(<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel0,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel)</span></div>
<div class="block">Returns if one rel is weaker than another.</div>
</section>
</li>
<li>
<section class="detail" id="equalType(java.lang.String,org.apache.calcite.rel.mutable.MutableRel,java.lang.String,org.apache.calcite.rel.mutable.MutableRel,org.apache.calcite.util.Litmus)">
<h3>equalType</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">equalType</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;desc0,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel0,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;desc1,
<a href="../rel/mutable/MutableRel.html" title="class in org.apache.calcite.rel.mutable">MutableRel</a>&nbsp;rel1,
<a href="../util/Litmus.html" title="interface in org.apache.calcite.util">Litmus</a>&nbsp;litmus)</span></div>
<div class="block">Returns whether two relational expressions have the same row-type.</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &copy; 2012-2023 Apache Software Foundation. All Rights Reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>