blob: 7a7f755186947328b167e4194813ddd878551ad0 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>DateRangeRules (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="DateRangeRules (Apache Calcite API)";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static 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/DateRangeRules.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 DateRangeRules" class="title">Class DateRangeRules</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.calcite.rel.rules.DateRangeRules</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public abstract class <span class="typeNameLabel">DateRangeRules</span>
extends java.lang.Object</pre>
<div class="block">Collection of planner rules that convert
<code>EXTRACT(timeUnit FROM dateTime) = constant</code>,
<code>FLOOR(dateTime to timeUnit</code> = constant} and
<code>CEIL(dateTime to timeUnit</code> = constant} to
<code>dateTime BETWEEN lower AND upper</code>.
<p>The rules allow conversion of queries on time dimension tables, such as
<blockquote>SELECT ... FROM sales JOIN time_by_day USING (time_id)
WHERE time_by_day.the_year = 1997
AND time_by_day.the_month IN (4, 5, 6)</blockquote>
<p>into
<blockquote>SELECT ... FROM sales JOIN time_by_day USING (time_id)
WHERE the_date BETWEEN DATE '2016-04-01' AND DATE '2016-06-30'</blockquote>
<p>and is especially useful for Druid, which has a single timestamp column.</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="DateRangeRules.ExtractFinder.html" title="class in org.apache.calcite.rel.rules">DateRangeRules.ExtractFinder</a></span></code></th>
<td class="colLast">
<div class="block">Visitor that searches for calls to <code>EXTRACT</code>, <code>FLOOR</code> or
<code>CEIL</code>, building a list of distinct time units.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="DateRangeRules.ExtractShuttle.html" title="class in org.apache.calcite.rel.rules">DateRangeRules.ExtractShuttle</a></span></code></th>
<td class="colLast">
<div class="block">Walks over an expression, replacing calls to
<code>EXTRACT</code>, <code>FLOOR</code> and <code>CEIL</code> with date ranges.</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="DateRangeRules.FilterDateRangeRule.html" title="class in org.apache.calcite.rel.rules">DateRangeRules.FilterDateRangeRule</a></span></code></th>
<td class="colLast">
<div class="block">Rule that converts EXTRACT, FLOOR and CEIL in a <a href="../core/Filter.html" title="class in org.apache.calcite.rel.core"><code>Filter</code></a> into a date
range.</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>static <a href="../../plan/RelOptRule.html" title="class in org.apache.calcite.plan">RelOptRule</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#FILTER_INSTANCE">FILTER_INSTANCE</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static java.util.function.Predicate&lt;<a href="../core/Filter.html" title="class in org.apache.calcite.rel.core">Filter</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#FILTER_PREDICATE">FILTER_PREDICATE</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static java.util.Map&lt;org.apache.calcite.avatica.util.TimeUnitRange,&#8203;java.lang.Integer&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#TIME_UNIT_CODES">TIME_UNIT_CODES</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static java.util.Map&lt;org.apache.calcite.avatica.util.TimeUnitRange,&#8203;org.apache.calcite.avatica.util.TimeUnitRange&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#TIME_UNIT_PARENTS">TIME_UNIT_PARENTS</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colSecond" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private </code></td>
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">DateRangeRules</a></span>()</code></th>
<td class="colLast">&nbsp;</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="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>(package private) static com.google.common.collect.ImmutableSortedSet&lt;org.apache.calcite.avatica.util.TimeUnitRange&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#extractTimeUnits(org.apache.calcite.rex.RexNode)">extractTimeUnits</a></span>&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;e)</code></th>
<td class="colLast">
<div class="block">Tests whether an expression contains one or more calls to the
<code>EXTRACT</code> function, and if so, returns the time units used.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>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="#replaceTimeUnits(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,java.lang.String)">replaceTimeUnits</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;e,
java.lang.String&nbsp;timeZone)</code></th>
<td class="colLast">
<div class="block">Replaces calls to EXTRACT, FLOOR and CEIL in an expression.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="FILTER_PREDICATE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>FILTER_PREDICATE</h4>
<pre>private static final&nbsp;java.util.function.Predicate&lt;<a href="../core/Filter.html" title="class in org.apache.calcite.rel.core">Filter</a>&gt; FILTER_PREDICATE</pre>
</li>
</ul>
<a id="FILTER_INSTANCE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>FILTER_INSTANCE</h4>
<pre>public static final&nbsp;<a href="../../plan/RelOptRule.html" title="class in org.apache.calcite.plan">RelOptRule</a> FILTER_INSTANCE</pre>
</li>
</ul>
<a id="TIME_UNIT_CODES">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>TIME_UNIT_CODES</h4>
<pre>private static final&nbsp;java.util.Map&lt;org.apache.calcite.avatica.util.TimeUnitRange,&#8203;java.lang.Integer&gt; TIME_UNIT_CODES</pre>
</li>
</ul>
<a id="TIME_UNIT_PARENTS">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>TIME_UNIT_PARENTS</h4>
<pre>private static final&nbsp;java.util.Map&lt;org.apache.calcite.avatica.util.TimeUnitRange,&#8203;org.apache.calcite.avatica.util.TimeUnitRange&gt; TIME_UNIT_PARENTS</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DateRangeRules</h4>
<pre>private&nbsp;DateRangeRules()</pre>
</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="extractTimeUnits(org.apache.calcite.rex.RexNode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>extractTimeUnits</h4>
<pre class="methodSignature">static&nbsp;com.google.common.collect.ImmutableSortedSet&lt;org.apache.calcite.avatica.util.TimeUnitRange&gt;&nbsp;extractTimeUnits&#8203;(<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;e)</pre>
<div class="block">Tests whether an expression contains one or more calls to the
<code>EXTRACT</code> function, and if so, returns the time units used.
<p>The result is an immutable set in natural order. This is important,
because code relies on the collection being sorted (so YEAR comes before
MONTH before HOUR) and unique. A predicate on MONTH is not useful if there
is no predicate on YEAR. Then when we apply the predicate on DAY it doesn't
generate hundreds of ranges we'll later throw away.</div>
</li>
</ul>
<a id="replaceTimeUnits(org.apache.calcite.rex.RexBuilder,org.apache.calcite.rex.RexNode,java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>replaceTimeUnits</h4>
<pre class="methodSignature">public static&nbsp;<a href="../../rex/RexNode.html" title="class in org.apache.calcite.rex">RexNode</a>&nbsp;replaceTimeUnits&#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;e,
java.lang.String&nbsp;timeZone)</pre>
<div class="block">Replaces calls to EXTRACT, FLOOR and CEIL in an expression.</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/DateRangeRules.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>