blob: c60d726af75ae6cbb08ec35f08202b03f6582af7 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>AbstractMaterializedViewRule (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="AbstractMaterializedViewRule (Apache Calcite API)";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":6,"i2":9,"i3":6,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":6,"i11":9,"i12":10,"i13":6,"i14":9,"i15":9,"i16":9,"i17":6,"i18":6,"i19":9,"i20":9,"i21":9,"i22":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AbstractMaterializedViewRule.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.calcite.rel.rules</a></div>
<h2 title="Class AbstractMaterializedViewRule" class="title">Class AbstractMaterializedViewRule</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../plan/RelOptRule.html" title="class in org.apache.calcite.plan">org.apache.calcite.plan.RelOptRule</a></li>
<li>
<ul class="inheritance">
<li>org.apache.calcite.rel.rules.AbstractMaterializedViewRule</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="AbstractMaterializedViewRule.MaterializedViewAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewAggregateRule</a></code>, <code><a href="AbstractMaterializedViewRule.MaterializedViewJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewJoinRule</a></code></dd>
</dl>
<hr>
<pre>public abstract class <span class="typeNameLabel">AbstractMaterializedViewRule</span>
extends <a href="../../plan/RelOptRule.html" title="class in org.apache.calcite.plan">RelOptRule</a></pre>
<div class="block">Planner rule that converts a <a href="../core/Project.html" title="class in org.apache.calcite.rel.core"><code>Project</code></a>
followed by <a href="../core/Aggregate.html" title="class in org.apache.calcite.rel.core"><code>Aggregate</code></a> or an
<a href="../core/Aggregate.html" title="class in org.apache.calcite.rel.core"><code>Aggregate</code></a> to a scan (and possibly
other operations) over a materialized view.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.Edge.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.Edge</a></span></code></th>
<td class="colLast">
<div class="block">Edge for graph</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a></span></code></th>
<td class="colLast">
<div class="block">Class representing an equivalence class, i.e., a set of equivalent columns</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MatchModality.html" title="enum in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MatchModality</a></span></code></th>
<td class="colLast">
<div class="block">Complete, view partial, or query partial.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewAggregateRule</a></span></code></th>
<td class="colLast">
<div class="block">Materialized view rewriting for aggregate</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewJoinRule</a></span></code></th>
<td class="colLast">
<div class="block">Materialized view rewriting for join</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewOnlyAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyAggregateRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that matches Aggregate.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewOnlyFilterRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyFilterRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that matches Filter.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewOnlyJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyJoinRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that matches Join.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewProjectAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectAggregateRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that matches Project on Aggregate.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewProjectFilterRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectFilterRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that matches Project on Filter.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.MaterializedViewProjectJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectJoinRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that matches Project on Join.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a></span></code></th>
<td class="colLast">
<div class="block">Expression lineage details.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="AbstractMaterializedViewRule.ViewPartialRewriting.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.ViewPartialRewriting</a></span></code></th>
<td class="colLast">
<div class="block">View partitioning result</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>protected boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fastBailOut">fastBailOut</a></span></code></th>
<td class="colLast">
<div class="block">Whether we should create the rewriting in the minimal subtree of plan
operators.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateUnionRewriting">generateUnionRewriting</a></span></code></th>
<td class="colLast">
<div class="block">Whether to generate rewritings containing union if the query results
are contained within the view results.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="AbstractMaterializedViewRule.MaterializedViewOnlyAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyAggregateRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INSTANCE_AGGREGATE">INSTANCE_AGGREGATE</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="AbstractMaterializedViewRule.MaterializedViewOnlyFilterRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyFilterRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INSTANCE_FILTER">INSTANCE_FILTER</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="AbstractMaterializedViewRule.MaterializedViewOnlyJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyJoinRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INSTANCE_JOIN">INSTANCE_JOIN</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="AbstractMaterializedViewRule.MaterializedViewProjectAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectAggregateRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INSTANCE_PROJECT_AGGREGATE">INSTANCE_PROJECT_AGGREGATE</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="AbstractMaterializedViewRule.MaterializedViewProjectFilterRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectFilterRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INSTANCE_PROJECT_FILTER">INSTANCE_PROJECT_FILTER</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="AbstractMaterializedViewRule.MaterializedViewProjectJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectJoinRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INSTANCE_PROJECT_JOIN">INSTANCE_PROJECT_JOIN</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static <a href="../../util/trace/CalciteLogger.html" title="class in org.apache.calcite.util.trace">CalciteLogger</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#LOGGER">LOGGER</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../plan/hep/HepProgram.html" title="class in org.apache.calcite.plan.hep">HepProgram</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#unionRewritingPullProgram">unionRewritingPullProgram</a></span></code></th>
<td class="colLast">
<div class="block">If we generate union rewriting, we might want to pull up projections
from the query itself to maximize rewriting opportunities.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="fields.inherited.from.class.org.apache.calcite.plan.RelOptRule">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;org.apache.calcite.plan.<a href="../../plan/RelOptRule.html" title="class in org.apache.calcite.plan">RelOptRule</a></h3>
<code><a href="../../plan/RelOptRule.html#description">description</a>, <a href="../../plan/RelOptRule.html#operands">operands</a>, <a href="../../plan/RelOptRule.html#relBuilderFactory">relBuilderFactory</a></code></li>
</ul>
</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>protected </code></td>
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.calcite.plan.RelOptRuleOperand,org.apache.calcite.tools.RelBuilderFactory,java.lang.String,boolean,org.apache.calcite.plan.hep.HepProgram,boolean)">AbstractMaterializedViewRule</a></span>&#8203;(<a href="../../plan/RelOptRuleOperand.html" title="class in org.apache.calcite.plan">RelOptRuleOperand</a>&nbsp;operand,
<a href="../../tools/RelBuilderFactory.html" title="interface in org.apache.calcite.tools">RelBuilderFactory</a>&nbsp;relBuilderFactory,
java.lang.String&nbsp;description,
boolean&nbsp;generateUnionRewriting,
<a href="../../plan/hep/HepProgram.html" title="class in org.apache.calcite.plan.hep">HepProgram</a>&nbsp;unionRewritingPullProgram,
boolean&nbsp;fastBailOut)</code></th>
<td class="colLast">
<div class="block">Creates a AbstractMaterializedViewRule.</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="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>private static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#compensatePartial(java.util.Set,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,java.util.Set,com.google.common.collect.Multimap)">compensatePartial</a></span>&#8203;(java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;sourceTableRefs,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;sourceEC,
java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;targetTableRefs,
com.google.common.collect.Multimap&lt;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>,&#8203;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>&gt;&nbsp;compensationEquiColumns)</code></th>
<td class="colLast">
<div class="block">It checks whether the target can be rewritten using the source even though the
source uses additional tables.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected abstract <a href="AbstractMaterializedViewRule.ViewPartialRewriting.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.ViewPartialRewriting</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#compensateViewPartial(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,java.util.Set,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,java.util.Set)">compensateViewPartial</a></span>&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;input,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;queryTableRefs,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;queryEC,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topViewProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;viewNode,
java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;viewTableRefs)</code></th>
<td class="colLast">
<div class="block">It checks whether the query can be rewritten using the view even though the
query uses additional tables.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>private 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>,&#8203;<a href="../../rex/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="#computeCompensationPredicates(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.util.Pair,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.util.Pair,com.google.common.collect.BiMap)">computeCompensationPredicates</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;sourceEC,
<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>,&#8203;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;sourcePreds,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;targetEC,
<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>,&#8203;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;targetPreds,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;sourceToTargetTableMapping)</code></th>
<td class="colLast">
<div class="block">We check whether the predicates in the source are contained in the predicates
in the target.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected abstract <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createUnion(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode)">createUnion</a></span>&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;unionInputQuery,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;unionInputView)</code></th>
<td class="colLast">
<div class="block">If the view will be used in a union rewriting, this method is responsible for
generating the union and any other operator needed on top of it, e.g., a Project
operator.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>private static com.google.common.collect.Multimap&lt;java.lang.Integer,&#8203;java.lang.Integer&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#extractPossibleMapping(java.util.List,java.util.List)">extractPossibleMapping</a></span>&#8203;(java.util.List&lt;java.util.Set&lt;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>&gt;&gt;&nbsp;sourceEquivalenceClasses,
java.util.List&lt;java.util.Set&lt;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>&gt;&gt;&nbsp;targetEquivalenceClasses)</code></th>
<td class="colLast">
<div class="block">Given the source and target equivalence classes, it extracts the possible mappings
from each source equivalence class to each target equivalence class.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>private static java.util.List&lt;<a href="../../rex/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="#extractReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.RelNode)">extractReferences</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node)</code></th>
<td class="colLast">
<div class="block">If the node is an Aggregate, it returns a list of references to the grouping columns.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>private static <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateEquivalenceClasses(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses)">generateEquivalenceClasses</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;sourceEC,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;targetEC)</code></th>
<td class="colLast">
<div class="block">Given the equi-column predicates of the source and the target and the
computed equivalence classes, it extracts possible mappings between
the equivalence classes.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>private static <a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateSwapColumnTableReferencesLineage(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,java.util.List)">generateSwapColumnTableReferencesLineage</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs)</code></th>
<td class="colLast">
<div class="block">It swaps the column references and then the table references of the input
expressions using the equivalence classes and the table mapping.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>private static <a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateSwapTableColumnReferencesLineage(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,java.util.List)">generateSwapTableColumnReferencesLineage</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs)</code></th>
<td class="colLast">
<div class="block">It swaps the table references and then the column references of the input
expressions using the table mapping and the equivalence classes.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>private static java.util.List&lt;com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateTableMappings(com.google.common.collect.Multimap)">generateTableMappings</a></span>&#8203;(com.google.common.collect.Multimap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;multiMapTables)</code></th>
<td class="colLast">
<div class="block">It will flatten a multimap containing table references to table references,
producing all possible combinations of mappings.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>protected abstract boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isValidPlan(org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.metadata.RelMetadataQuery)">isValidPlan</a></span>&#8203;(<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>private static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isValidRelNodePlan(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.metadata.RelMetadataQuery)">isValidRelNodePlan</a></span>&#8203;(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq)</code></th>
<td class="colLast">
<div class="block">Currently we only support TableScan - Project - Filter - Inner Join</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#perform(org.apache.calcite.plan.RelOptRuleCall,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode)">perform</a></span>&#8203;(<a href="../../plan/RelOptRuleCall.html" title="class in org.apache.calcite.plan">RelOptRuleCall</a>&nbsp;call,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node)</code></th>
<td class="colLast">
<div class="block">Rewriting logic is based on "Optimizing Queries Using Materialized Views:
A Practical, Scalable Solution" by Goldstein and Larson.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>protected abstract <a href="../../util/Pair.html" title="class in org.apache.calcite.util">Pair</a>&lt;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>,&#8203;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#pushFilterToOriginalViewPlan(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,org.apache.calcite.rex.RexNode)">pushFilterToOriginalViewPlan</a></span>&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;builder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;topViewProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;viewNode,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;cond)</code></th>
<td class="colLast">
<div class="block">Once we create a compensation predicate, this method is responsible for pushing
the resulting filter through the view nodes.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>private static <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#replaceWithOriginalReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.NodeLineage,org.apache.calcite.rex.RexNode)">replaceWithOriginalReferences</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a>&nbsp;nodeLineage,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;exprToRewrite)</code></th>
<td class="colLast">
<div class="block">Given the input expression, it will replace (sub)expressions when possible
using the content of the mapping.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>private static <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rewriteExpression(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,java.util.List,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,boolean,org.apache.calcite.rex.RexNode)">rewriteExpression</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;targetNode,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
boolean&nbsp;swapTableColumn,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;exprToRewrite)</code></th>
<td class="colLast">
<div class="block">First, the method takes the node expressions <code>nodeExprs</code> and swaps the table
and column references using the table mapping and the equivalence classes.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>private static java.util.List&lt;<a href="../../rex/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="#rewriteExpressions(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,java.util.List,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,boolean,java.util.List)">rewriteExpressions</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;targetNode,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
boolean&nbsp;swapTableColumn,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprsToRewrite)</code></th>
<td class="colLast">
<div class="block">First, the method takes the node expressions <code>nodeExprs</code> and swaps the table
and column references using the table mapping and the equivalence classes.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>protected abstract <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rewriteQuery(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rex.RexNode,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses)">rewriteQuery</a></span>&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;compensationColumnsEquiPred,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;otherCompensationPred,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;viewToQueryTableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;viewEC,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;queryEC)</code></th>
<td class="colLast">
<div class="block">If the view will be used in a union rewriting, this method is responsible for
rewriting the query branch of the union using the given compensation predicate.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>protected abstract <a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rewriteView(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.MatchModality,boolean,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses)">rewriteView</a></span>&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="AbstractMaterializedViewRule.MatchModality.html" title="enum in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MatchModality</a>&nbsp;matchModality,
boolean&nbsp;unionRewriting,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;input,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topViewProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;viewNode,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;queryToViewTableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;queryEC)</code></th>
<td class="colLast">
<div class="block">Rewrites the query using the given view query.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>private static <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#shuttleReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,com.google.common.collect.Multimap)">shuttleReferences</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
com.google.common.collect.Multimap&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,&#8203;java.lang.Integer&gt;&nbsp;exprsLineage)</code></th>
<td class="colLast">
<div class="block">Replaces all the possible sub-expressions by input references
to the input node.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>private static <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#shuttleReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,com.google.common.collect.Multimap,org.apache.calcite.rel.RelNode,org.apache.calcite.util.mapping.Mapping)">shuttleReferences</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
com.google.common.collect.Multimap&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,&#8203;java.lang.Integer&gt;&nbsp;exprsLineage,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../../util/mapping/Mapping.html" title="interface in org.apache.calcite.util.mapping">Mapping</a>&nbsp;rewritingMapping)</code></th>
<td class="colLast">
<div class="block">Replaces all the possible sub-expressions by input references
to the input node.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>private static <a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#shuttleReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,org.apache.calcite.util.mapping.Mapping)">shuttleReferences</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;node,
<a href="../../util/mapping/Mapping.html" title="interface in org.apache.calcite.util.mapping">Mapping</a>&nbsp;mapping)</code></th>
<td class="colLast">
<div class="block">Replaces all the input references by the position in the
input column set.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>private 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>,&#8203;<a href="../../rex/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="#splitPredicates(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode)">splitPredicates</a></span>&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;pred)</code></th>
<td class="colLast">
<div class="block">Classifies each of the predicates in the list into one of these two
categories:
1-l) column equality predicates, or
2-r) residual predicates, all the rest
</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.calcite.plan.RelOptRule">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.calcite.plan.<a href="../../plan/RelOptRule.html" title="class in org.apache.calcite.plan">RelOptRule</a></h3>
<code><a href="../../plan/RelOptRule.html#any()">any</a>, <a href="../../plan/RelOptRule.html#convert(org.apache.calcite.rel.RelNode,org.apache.calcite.plan.RelTrait)">convert</a>, <a href="../../plan/RelOptRule.html#convert(org.apache.calcite.rel.RelNode,org.apache.calcite.plan.RelTraitSet)">convert</a>, <a href="../../plan/RelOptRule.html#convertList(java.util.List,org.apache.calcite.plan.RelTrait)">convertList</a>, <a href="../../plan/RelOptRule.html#convertOperand(java.lang.Class,com.google.common.base.Predicate,org.apache.calcite.plan.RelTrait)">convertOperand</a>, <a href="../../plan/RelOptRule.html#convertOperand(java.lang.Class,java.util.function.Predicate,org.apache.calcite.plan.RelTrait)">convertOperand</a>, <a href="../../plan/RelOptRule.html#equals(java.lang.Object)">equals</a>, <a href="../../plan/RelOptRule.html#equals(org.apache.calcite.plan.RelOptRule)">equals</a>, <a href="../../plan/RelOptRule.html#getOperand()">getOperand</a>, <a href="../../plan/RelOptRule.html#getOperands()">getOperands</a>, <a href="../../plan/RelOptRule.html#getOutConvention()">getOutConvention</a>, <a href="../../plan/RelOptRule.html#getOutTrait()">getOutTrait</a>, <a href="../../plan/RelOptRule.html#hashCode()">hashCode</a>, <a href="../../plan/RelOptRule.html#matches(org.apache.calcite.plan.RelOptRuleCall)">matches</a>, <a href="../../plan/RelOptRule.html#none()">none</a>, <a href="../../plan/RelOptRule.html#onMatch(org.apache.calcite.plan.RelOptRuleCall)">onMatch</a>, <a href="../../plan/RelOptRule.html#operand(java.lang.Class,org.apache.calcite.plan.RelOptRuleOperandChildren)">operand</a>, <a href="../../plan/RelOptRule.html#operand(java.lang.Class,org.apache.calcite.plan.RelOptRuleOperand,org.apache.calcite.plan.RelOptRuleOperand...)">operand</a>, <a href="../../plan/RelOptRule.html#operand(java.lang.Class,org.apache.calcite.plan.RelTrait,com.google.common.base.Predicate,org.apache.calcite.plan.RelOptRuleOperandChildren)">operand</a>, <a href="../../plan/RelOptRule.html#operand(java.lang.Class,org.apache.calcite.plan.RelTrait,com.google.common.base.Predicate,org.apache.calcite.plan.RelOptRuleOperand,org.apache.calcite.plan.RelOptRuleOperand...)">operand</a>, <a href="../../plan/RelOptRule.html#operand(java.lang.Class,org.apache.calcite.plan.RelTrait,org.apache.calcite.plan.RelOptRuleOperandChildren)">operand</a>, <a href="../../plan/RelOptRule.html#operandJ(java.lang.Class,org.apache.calcite.plan.RelTrait,java.util.function.Predicate,org.apache.calcite.plan.RelOptRuleOperandChildren)">operandJ</a>, <a href="../../plan/RelOptRule.html#operandJ(java.lang.Class,org.apache.calcite.plan.RelTrait,java.util.function.Predicate,org.apache.calcite.plan.RelOptRuleOperand,org.apache.calcite.plan.RelOptRuleOperand...)">operandJ</a>, <a href="../../plan/RelOptRule.html#some(org.apache.calcite.plan.RelOptRuleOperand,org.apache.calcite.plan.RelOptRuleOperand...)">some</a>, <a href="../../plan/RelOptRule.html#toString()">toString</a>, <a href="../../plan/RelOptRule.html#unordered(org.apache.calcite.plan.RelOptRuleOperand,org.apache.calcite.plan.RelOptRuleOperand...)">unordered</a></code></li>
</ul>
<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, finalize, getClass, notify, notifyAll, 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="LOGGER">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>LOGGER</h4>
<pre>private static final&nbsp;<a href="../../util/trace/CalciteLogger.html" title="class in org.apache.calcite.util.trace">CalciteLogger</a> LOGGER</pre>
</li>
</ul>
<a id="INSTANCE_PROJECT_FILTER">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INSTANCE_PROJECT_FILTER</h4>
<pre>public static final&nbsp;<a href="AbstractMaterializedViewRule.MaterializedViewProjectFilterRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectFilterRule</a> INSTANCE_PROJECT_FILTER</pre>
</li>
</ul>
<a id="INSTANCE_FILTER">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INSTANCE_FILTER</h4>
<pre>public static final&nbsp;<a href="AbstractMaterializedViewRule.MaterializedViewOnlyFilterRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyFilterRule</a> INSTANCE_FILTER</pre>
</li>
</ul>
<a id="INSTANCE_PROJECT_JOIN">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INSTANCE_PROJECT_JOIN</h4>
<pre>public static final&nbsp;<a href="AbstractMaterializedViewRule.MaterializedViewProjectJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectJoinRule</a> INSTANCE_PROJECT_JOIN</pre>
</li>
</ul>
<a id="INSTANCE_JOIN">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INSTANCE_JOIN</h4>
<pre>public static final&nbsp;<a href="AbstractMaterializedViewRule.MaterializedViewOnlyJoinRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyJoinRule</a> INSTANCE_JOIN</pre>
</li>
</ul>
<a id="INSTANCE_PROJECT_AGGREGATE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INSTANCE_PROJECT_AGGREGATE</h4>
<pre>public static final&nbsp;<a href="AbstractMaterializedViewRule.MaterializedViewProjectAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewProjectAggregateRule</a> INSTANCE_PROJECT_AGGREGATE</pre>
</li>
</ul>
<a id="INSTANCE_AGGREGATE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INSTANCE_AGGREGATE</h4>
<pre>public static final&nbsp;<a href="AbstractMaterializedViewRule.MaterializedViewOnlyAggregateRule.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MaterializedViewOnlyAggregateRule</a> INSTANCE_AGGREGATE</pre>
</li>
</ul>
<a id="generateUnionRewriting">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateUnionRewriting</h4>
<pre>protected final&nbsp;boolean generateUnionRewriting</pre>
<div class="block">Whether to generate rewritings containing union if the query results
are contained within the view results.</div>
</li>
</ul>
<a id="unionRewritingPullProgram">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unionRewritingPullProgram</h4>
<pre>protected final&nbsp;<a href="../../plan/hep/HepProgram.html" title="class in org.apache.calcite.plan.hep">HepProgram</a> unionRewritingPullProgram</pre>
<div class="block">If we generate union rewriting, we might want to pull up projections
from the query itself to maximize rewriting opportunities.</div>
</li>
</ul>
<a id="fastBailOut">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>fastBailOut</h4>
<pre>protected final&nbsp;boolean fastBailOut</pre>
<div class="block">Whether we should create the rewriting in the minimal subtree of plan
operators.</div>
</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.plan.RelOptRuleOperand,org.apache.calcite.tools.RelBuilderFactory,java.lang.String,boolean,org.apache.calcite.plan.hep.HepProgram,boolean)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AbstractMaterializedViewRule</h4>
<pre>protected&nbsp;AbstractMaterializedViewRule&#8203;(<a href="../../plan/RelOptRuleOperand.html" title="class in org.apache.calcite.plan">RelOptRuleOperand</a>&nbsp;operand,
<a href="../../tools/RelBuilderFactory.html" title="interface in org.apache.calcite.tools">RelBuilderFactory</a>&nbsp;relBuilderFactory,
java.lang.String&nbsp;description,
boolean&nbsp;generateUnionRewriting,
<a href="../../plan/hep/HepProgram.html" title="class in org.apache.calcite.plan.hep">HepProgram</a>&nbsp;unionRewritingPullProgram,
boolean&nbsp;fastBailOut)</pre>
<div class="block">Creates a AbstractMaterializedViewRule.</div>
</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="perform(org.apache.calcite.plan.RelOptRuleCall,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>perform</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;perform&#8203;(<a href="../../plan/RelOptRuleCall.html" title="class in org.apache.calcite.plan">RelOptRuleCall</a>&nbsp;call,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node)</pre>
<div class="block">Rewriting logic is based on "Optimizing Queries Using Materialized Views:
A Practical, Scalable Solution" by Goldstein and Larson.
<p>On the query side, rules matches a Project-node chain or node, where node
is either an Aggregate or a Join. Subplan rooted at the node operator must
be composed of one or more of the following operators: TableScan, Project,
Filter, and Join.
<p>For each join MV, we need to check the following:
<ol>
<li> The plan rooted at the Join operator in the view produces all rows
needed by the plan rooted at the Join operator in the query.</li>
<li> All columns required by compensating predicates, i.e., predicates that
need to be enforced over the view, are available at the view output.</li>
<li> All output expressions can be computed from the output of the view.</li>
<li> All output rows occur with the correct duplication factor. We might
rely on existing Unique-Key - Foreign-Key relationships to extract that
information.</li>
</ol>
<p>In turn, for each aggregate MV, we need to check the following:
<ol>
<li> The plan rooted at the Aggregate operator in the view produces all rows
needed by the plan rooted at the Aggregate operator in the query.</li>
<li> All columns required by compensating predicates, i.e., predicates that
need to be enforced over the view, are available at the view output.</li>
<li> The grouping columns in the query are a subset of the grouping columns
in the view.</li>
<li> All columns required to perform further grouping are available in the
view output.</li>
<li> All columns required to compute output expressions are available in the
view output.</li>
</ol>
<p>The rule contains multiple extensions compared to the original paper. One of
them is the possibility of creating rewritings using Union operators, e.g., if
the result of a query is partially contained in the materialized view.</div>
</li>
</ul>
<a id="isValidPlan(org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.metadata.RelMetadataQuery)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isValidPlan</h4>
<pre class="methodSignature">protected abstract&nbsp;boolean&nbsp;isValidPlan&#8203;(<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq)</pre>
</li>
</ul>
<a id="compensateViewPartial(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,java.util.Set,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,java.util.Set)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>compensateViewPartial</h4>
<pre class="methodSignature">protected abstract&nbsp;<a href="AbstractMaterializedViewRule.ViewPartialRewriting.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.ViewPartialRewriting</a>&nbsp;compensateViewPartial&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;input,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;queryTableRefs,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;queryEC,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topViewProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;viewNode,
java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;viewTableRefs)</pre>
<div class="block">It checks whether the query can be rewritten using the view even though the
query uses additional tables.
<p>Rules implementing the method should follow different approaches depending on the
operators they rewrite.</div>
</li>
</ul>
<a id="rewriteQuery(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rex.RexNode,org.apache.calcite.rex.RexNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rewriteQuery</h4>
<pre class="methodSignature">protected abstract&nbsp;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;rewriteQuery&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;compensationColumnsEquiPred,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;otherCompensationPred,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;viewToQueryTableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;viewEC,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;queryEC)</pre>
<div class="block">If the view will be used in a union rewriting, this method is responsible for
rewriting the query branch of the union using the given compensation predicate.
<p>If a rewriting can be produced, we return that rewriting. If it cannot
be produced, we will return null.</div>
</li>
</ul>
<a id="createUnion(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createUnion</h4>
<pre class="methodSignature">protected abstract&nbsp;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;createUnion&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;unionInputQuery,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;unionInputView)</pre>
<div class="block">If the view will be used in a union rewriting, this method is responsible for
generating the union and any other operator needed on top of it, e.g., a Project
operator.</div>
</li>
</ul>
<a id="rewriteView(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.MatchModality,boolean,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.core.Project,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rewriteView</h4>
<pre class="methodSignature">protected abstract&nbsp;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;rewriteView&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;relBuilder,
<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="AbstractMaterializedViewRule.MatchModality.html" title="enum in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.MatchModality</a>&nbsp;matchModality,
boolean&nbsp;unionRewriting,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;input,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../core/Project.html" title="class in org.apache.calcite.rel.core">Project</a>&nbsp;topViewProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;viewNode,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;queryToViewTableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;queryEC)</pre>
<div class="block">Rewrites the query using the given view query.
<p>The input node is a Scan on the view table and possibly a compensation Filter
on top. If a rewriting can be produced, we return that rewriting. If it cannot
be produced, we will return null.</div>
</li>
</ul>
<a id="pushFilterToOriginalViewPlan(org.apache.calcite.tools.RelBuilder,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pushFilterToOriginalViewPlan</h4>
<pre class="methodSignature">protected abstract&nbsp;<a href="../../util/Pair.html" title="class in org.apache.calcite.util">Pair</a>&lt;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>,&#8203;<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&gt;&nbsp;pushFilterToOriginalViewPlan&#8203;(<a href="../../tools/RelBuilder.html" title="class in org.apache.calcite.tools">RelBuilder</a>&nbsp;builder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;topViewProject,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;viewNode,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;cond)</pre>
<div class="block">Once we create a compensation predicate, this method is responsible for pushing
the resulting filter through the view nodes. This might be useful for rewritings
containing Aggregate operators, as some of the grouping columns might be removed,
which results in additional matching possibilities.
<p>The method will return a pair of nodes: the new top project on the left and
the new node on the right.</div>
</li>
</ul>
<a id="extractReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.RelNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>extractReferences</h4>
<pre class="methodSignature">private static&nbsp;java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;extractReferences&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node)</pre>
<div class="block">If the node is an Aggregate, it returns a list of references to the grouping columns.
Otherwise, it returns a list of references to all columns in the node.
The returned list is immutable.</div>
</li>
</ul>
<a id="generateTableMappings(com.google.common.collect.Multimap)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateTableMappings</h4>
<pre class="methodSignature">private static&nbsp;java.util.List&lt;com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&gt;&nbsp;generateTableMappings&#8203;(com.google.common.collect.Multimap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;multiMapTables)</pre>
<div class="block">It will flatten a multimap containing table references to table references,
producing all possible combinations of mappings. Each of the mappings will
be bi-directional.</div>
</li>
</ul>
<a id="isValidRelNodePlan(org.apache.calcite.rel.RelNode,org.apache.calcite.rel.metadata.RelMetadataQuery)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isValidRelNodePlan</h4>
<pre class="methodSignature">private static&nbsp;boolean&nbsp;isValidRelNodePlan&#8203;(<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq)</pre>
<div class="block">Currently we only support TableScan - Project - Filter - Inner Join</div>
</li>
</ul>
<a id="splitPredicates(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>splitPredicates</h4>
<pre class="methodSignature">private static&nbsp;<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>,&#8203;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;splitPredicates&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;pred)</pre>
<div class="block">Classifies each of the predicates in the list into one of these two
categories:
<ul>
<li> 1-l) column equality predicates, or
<li> 2-r) residual predicates, all the rest
</ul>
<p>For each category, it creates the conjunction of the predicates. The
result is an pair of RexNode objects corresponding to each category.</div>
</li>
</ul>
<a id="compensatePartial(java.util.Set,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,java.util.Set,com.google.common.collect.Multimap)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>compensatePartial</h4>
<pre class="methodSignature">private static&nbsp;boolean&nbsp;compensatePartial&#8203;(java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;sourceTableRefs,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;sourceEC,
java.util.Set&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;targetTableRefs,
com.google.common.collect.Multimap&lt;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>,&#8203;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>&gt;&nbsp;compensationEquiColumns)</pre>
<div class="block">It checks whether the target can be rewritten using the source even though the
source uses additional tables. In order to do that, we need to double-check
that every join that exists in the source and is not in the target is a
cardinality-preserving join, i.e., it only appends columns to the row
without changing its multiplicity. Thus, the join needs to be:
<ul>
<li> Equi-join </li>
<li> Between all columns in the keys </li>
<li> Foreign-key columns do not allow NULL values </li>
<li> Foreign-key </li>
<li> Unique-key </li>
</ul>
<p>If it can be rewritten, it returns true. Further, it inserts the missing equi-join
predicates in the input <code>compensationEquiColumns</code> multimap if it is provided.
If it cannot be rewritten, it returns false.</div>
</li>
</ul>
<a id="computeCompensationPredicates(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexSimplify,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.util.Pair,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.util.Pair,com.google.common.collect.BiMap)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeCompensationPredicates</h4>
<pre class="methodSignature">private static&nbsp;<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>,&#8203;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;computeCompensationPredicates&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexSimplify.html" title="class in org.apache.calcite.rex">RexSimplify</a>&nbsp;simplify,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;sourceEC,
<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>,&#8203;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;sourcePreds,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;targetEC,
<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>,&#8203;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;targetPreds,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;sourceToTargetTableMapping)</pre>
<div class="block">We check whether the predicates in the source are contained in the predicates
in the target. The method treats separately the equi-column predicates, the
range predicates, and the rest of predicates.
<p>If the containment is confirmed, we produce compensation predicates that
need to be added to the target to produce the results in the source. Thus,
if source and target expressions are equivalent, those predicates will be the
true constant.
<p>In turn, if containment cannot be confirmed, the method returns null.</div>
</li>
</ul>
<a id="generateEquivalenceClasses(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateEquivalenceClasses</h4>
<pre class="methodSignature">private static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;generateEquivalenceClasses&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;sourceEC,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;targetEC)</pre>
<div class="block">Given the equi-column predicates of the source and the target and the
computed equivalence classes, it extracts possible mappings between
the equivalence classes.
<p>If there is no mapping, it returns null. If there is a exact match,
it will return a compensation predicate that evaluates to true.
Finally, if a compensation predicate needs to be enforced on top of
the target to make the equivalences classes match, it returns that
compensation predicate.</div>
</li>
</ul>
<a id="extractPossibleMapping(java.util.List,java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>extractPossibleMapping</h4>
<pre class="methodSignature">private static&nbsp;com.google.common.collect.Multimap&lt;java.lang.Integer,&#8203;java.lang.Integer&gt;&nbsp;extractPossibleMapping&#8203;(java.util.List&lt;java.util.Set&lt;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>&gt;&gt;&nbsp;sourceEquivalenceClasses,
java.util.List&lt;java.util.Set&lt;<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex">RexTableInputRef</a>&gt;&gt;&nbsp;targetEquivalenceClasses)</pre>
<div class="block">Given the source and target equivalence classes, it extracts the possible mappings
from each source equivalence class to each target equivalence class.
<p>If any of the source equivalence classes cannot be mapped to a target equivalence
class, it returns null.</div>
</li>
</ul>
<a id="rewriteExpression(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,java.util.List,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,boolean,org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rewriteExpression</h4>
<pre class="methodSignature">private static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;rewriteExpression&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;targetNode,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
boolean&nbsp;swapTableColumn,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;exprToRewrite)</pre>
<div class="block">First, the method takes the node expressions <code>nodeExprs</code> and swaps the table
and column references using the table mapping and the equivalence classes.
If <code>swapTableColumn</code> is true, it swaps the table reference and then the column reference,
otherwise it swaps the column reference and then the table reference.
<p>Then, the method will rewrite the input expression <code>exprToRewrite</code>, replacing the
<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex"><code>RexTableInputRef</code></a> by references to the positions in <code>nodeExprs</code>.
<p>The method will return the rewritten expression. If any of the expressions in the input
expression cannot be mapped, it will return null.</div>
</li>
</ul>
<a id="rewriteExpressions(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode,java.util.List,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,boolean,java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rewriteExpressions</h4>
<pre class="methodSignature">private static&nbsp;java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;rewriteExpressions&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;targetNode,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
boolean&nbsp;swapTableColumn,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;exprsToRewrite)</pre>
<div class="block">First, the method takes the node expressions <code>nodeExprs</code> and swaps the table
and column references using the table mapping and the equivalence classes.
If <code>swapTableColumn</code> is true, it swaps the table reference and then the column reference,
otherwise it swaps the column reference and then the table reference.
<p>Then, the method will rewrite the input expressions <code>exprsToRewrite</code>, replacing the
<a href="../../rex/RexTableInputRef.html" title="class in org.apache.calcite.rex"><code>RexTableInputRef</code></a> by references to the positions in <code>nodeExprs</code>.
<p>The method will return the rewritten expressions. If any of the subexpressions in the input
expressions cannot be mapped, it will return null.</div>
</li>
</ul>
<a id="generateSwapTableColumnReferencesLineage(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateSwapTableColumnReferencesLineage</h4>
<pre class="methodSignature">private static&nbsp;<a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a>&nbsp;generateSwapTableColumnReferencesLineage&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs)</pre>
<div class="block">It swaps the table references and then the column references of the input
expressions using the table mapping and the equivalence classes.</div>
</li>
</ul>
<a id="generateSwapColumnTableReferencesLineage(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.metadata.RelMetadataQuery,org.apache.calcite.rel.RelNode,com.google.common.collect.BiMap,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.EquivalenceClasses,java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateSwapColumnTableReferencesLineage</h4>
<pre class="methodSignature">private static&nbsp;<a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a>&nbsp;generateSwapColumnTableReferencesLineage&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../metadata/RelMetadataQuery.html" title="class in org.apache.calcite.rel.metadata">RelMetadataQuery</a>&nbsp;mq,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
com.google.common.collect.BiMap&lt;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>,&#8203;<a href="../../rex/RexTableInputRef.RelTableRef.html" title="class in org.apache.calcite.rex">RexTableInputRef.RelTableRef</a>&gt;&nbsp;tableMapping,
<a href="AbstractMaterializedViewRule.EquivalenceClasses.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.EquivalenceClasses</a>&nbsp;ec,
java.util.List&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&gt;&nbsp;nodeExprs)</pre>
<div class="block">It swaps the column references and then the table references of the input
expressions using the equivalence classes and the table mapping.</div>
</li>
</ul>
<a id="replaceWithOriginalReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.rules.AbstractMaterializedViewRule.NodeLineage,org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>replaceWithOriginalReferences</h4>
<pre class="methodSignature">private static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;replaceWithOriginalReferences&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="AbstractMaterializedViewRule.NodeLineage.html" title="class in org.apache.calcite.rel.rules">AbstractMaterializedViewRule.NodeLineage</a>&nbsp;nodeLineage,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;exprToRewrite)</pre>
<div class="block">Given the input expression, it will replace (sub)expressions when possible
using the content of the mapping. In particular, the mapping contains the
digest of the expression and the index that the replacement input ref should
point to.</div>
</li>
</ul>
<a id="shuttleReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,org.apache.calcite.util.mapping.Mapping)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shuttleReferences</h4>
<pre class="methodSignature">private static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;shuttleReferences&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;node,
<a href="../../util/mapping/Mapping.html" title="interface in org.apache.calcite.util.mapping">Mapping</a>&nbsp;mapping)</pre>
<div class="block">Replaces all the input references by the position in the
input column set. If a reference index cannot be found in
the input set, then we return null.</div>
</li>
</ul>
<a id="shuttleReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,com.google.common.collect.Multimap)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shuttleReferences</h4>
<pre class="methodSignature">private static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;shuttleReferences&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
com.google.common.collect.Multimap&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,&#8203;java.lang.Integer&gt;&nbsp;exprsLineage)</pre>
<div class="block">Replaces all the possible sub-expressions by input references
to the input node.</div>
</li>
</ul>
<a id="shuttleReferences(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,com.google.common.collect.Multimap,org.apache.calcite.rel.RelNode,org.apache.calcite.util.mapping.Mapping)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>shuttleReferences</h4>
<pre class="methodSignature">private static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;shuttleReferences&#8203;(<a href="../../rex/RexBuilder.html" title="class in org.apache.calcite.rex">RexBuilder</a>&nbsp;rexBuilder,
<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;expr,
com.google.common.collect.Multimap&lt;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>,&#8203;java.lang.Integer&gt;&nbsp;exprsLineage,
<a href="../RelNode.html" title="interface in org.apache.calcite.rel">RelNode</a>&nbsp;node,
<a href="../../util/mapping/Mapping.html" title="interface in org.apache.calcite.util.mapping">Mapping</a>&nbsp;rewritingMapping)</pre>
<div class="block">Replaces all the possible sub-expressions by input references
to the input node. If available, it uses the rewriting mapping
to change the position to reference. Takes the reference type
from the input node.</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/AbstractMaterializedViewRule.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>