blob: 7edb0e84bb8597edca977b47b8b80cd1f1e5704d [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>TableCharacteristic (Apache Calcite API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.calcite.sql, class: TableCharacteristic">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<div class="about-language"><b>Apache Calcite</b></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field-summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li><a href="#field-detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.calcite.sql</a></div>
<h1 title="Class TableCharacteristic" class="title">Class TableCharacteristic</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">org.apache.calcite.sql.TableCharacteristic</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">TableCharacteristic</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">A table-valued input parameter of a table function is classified by three
characteristics.
<p>The first characteristic is semantics. The table has either
row semantics or set semantics.
<p>Row semantics means that the result of the table function is decided
on a row-by-row basis.
<p>Example of a table function with row semantics input table parameter:
We often need to read a CSV file, generally, the first line of the file
contains a list of column names, and subsequent lines of the file contain
data. The data in general can be treated as a large VARCHAR.
However, some of the fields may be numeric or datetime.
<p>A table function named CSVReader is designed to read a file of
comma-separated values and interpret this file as a table.
The function has three parameters:
<ul>
<li>The first parameter, File, is the name of a file on the query author's
system. This file must contain the comma-separated values that are to be
converted to a table. The first line of the file contains the names of
the resulting columns. Succeeding lines contain the data. Each line after
the first will result in one row of output, with column names as determined
by the first line of the input.
<li>Floats is a descriptor area, which should provide a list of the
column names that are to be interpreted numerically.
These columns will be output with the data type FLOAT.
<li>Dates is a descriptor area, which provides a list of the column
names that are to be interpreted as datetimes.
These columns will be output with the data type DATE.
</ul>
<p>How to use this table function in query?
<p>For a csv file which contents are:
<blockquote><pre>
docno,name,due_date,principle,interest
123,Mary,01/01/2014,234.56,345.67
234,Edgar,01/01/2014,654.32,543.21
</pre></blockquote>
<p>The query author may write a query such as the following:
<blockquote><pre><code>
SELECT *
FROM TABLE (
CSVreader (
'abc.csv',
DESCRIPTOR ("principle", "interest")
DESCRIPTOR ("due_date")))
</code></pre></blockquote>
<table>
<caption>Results of the query</caption>
<tr>
<th>docno</th>
<th>name</th>
<th>due_date</th>
<th>principle</th>
<th>interest</th>
</tr>
<tr>
<th>123</th>
<th>Mary</th>
<th>01/01/2014</th>
<th>234.56</th>
<th>345.67</th>
</tr>
<tr>
<th>234</th>
<th>Edgar</th>
<th>01/01/2014</th>
<th>654.32</th>
<th>543.21</th>
</tr>
</table>
<p>Set semantics means that the outcome of the function depends on how
the data is partitioned. Set semantics is useful to implement user-defined
analytics like aggregation or window functions.
They operate on an entire table or a logical partition of it.
<p>Example of a table function with set semantics input table parameter:
TopN takes an input table that has been sorted on a numeric column.
It copies the first n rows through to the output table. Any additional
rows are summarized in a single output row in which the sort column has
been summed and all other columns are null.
TopN function has two parameters:
<ul>
<li>The first parameter, Input, is the input table. This table has set
semantics, meaning that the result depends on the set of data (since the
last row is a summary row). In addition, the table is marked as PRUNE WHEN
EMPTY, meaning that the result is necessarily empty if the input is empty.
The query author must order this input table on a single numeric column
(syntax below).
<li>The second parameter, Howmany, specifies how many input rows that the
user wants to be copied into the output table; all rows after this will
contribute to the final summary row in the output.
</ul>
<p>How to use this table function in query?
<table>
<caption>Original records of table orders</caption>
<tr>
<th>region</th>
<th>product</th>
<th>sales</th>
</tr>
<tr>
<th>East</th>
<th>A</th>
<th>1234.56</th>
</tr>
<tr>
<th>East</th>
<th>B</th>
<th>987.65</th>
</tr>
<tr>
<th>East</th>
<th>C</th>
<th>876.54</th>
</tr>
<tr>
<th>East</th>
<th>D</th>
<th>765.43</th>
</tr>
<tr>
<th>East</th>
<th>E</th>
<th>654.32</th>
</tr>
<tr>
<th>West</th>
<th>E</th>
<th>2345.67</th>
</tr>
<tr>
<th>West</th>
<th>D</th>
<th>2001.33</th>
</tr>
<tr>
<th>West</th>
<th>C</th>
<th>1357.99</th>
</tr>
<tr>
<th>West</th>
<th>B</th>
<th>975.35</th>
</tr>
<tr>
<th>West</th>
<th>A</th>
<th>864,22</th>
</tr>
</table>
<p>The query author may write a query such as the following:
<blockquote><pre><code>
SELECT *
FROM TABLE(
Topn(
TABLE orders PARTITION BY region ORDER BY sales desc,
3))
</code></pre></blockquote>
<p>The result will be:
<table>
<caption>Original records of table orders</caption>
<tr>
<th>region</th>
<th>product</th>
<th>sales</th>
</tr>
<tr>
<th>East</th>
<th>A</th>
<th>1234.56</th>
</tr>
<tr>
<th>East</th>
<th>B</th>
<th>987.65</th>
</tr>
<tr>
<th>East</th>
<th>C</th>
<th>876.54</th>
</tr>
<tr>
<th>West</th>
<th>E</th>
<th>2345.67</th>
</tr>
<tr>
<th>West</th>
<th>D</th>
<th>2001.33</th>
</tr>
<tr>
<th>West</th>
<th>C</th>
<th>1357.99</th>
</tr>
</table>
<p>The second characteristic of input table parameter only applies to input
table with set semantics. It specifies whether the table function can
generate a result row even if the input table is empty.
<p>The third characteristic is whether the input table supports
pass-through columns or not.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<li>
<section class="nested-class-summary" id="nested-class-summary">
<h2>Nested Class Summary</h2>
<div class="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static class&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="TableCharacteristic.Builder.html" class="type-name-link" title="class in org.apache.calcite.sql">TableCharacteristic.Builder</a></code></div>
<div class="col-last even-row-color">
<div class="block">Builder for <a href="TableCharacteristic.html" title="class in org.apache.calcite.sql"><code>TableCharacteristic</code></a>.</div>
</div>
<div class="col-first odd-row-color"><code>static enum&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="TableCharacteristic.Semantics.html" class="type-name-link" title="enum in org.apache.calcite.sql">TableCharacteristic.Semantics</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Input table has either row semantics or set semantics.</div>
</div>
</div>
</section>
</li>
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>final boolean</code></div>
<div class="col-second even-row-color"><code><a href="#passColumnsThrough" class="member-name-link">passColumnsThrough</a></code></div>
<div class="col-last even-row-color">
<div class="block">If the value is true, for each input row, the table function makes the
entire input row available in the output, qualified by a range variable
associated with the input table.</div>
</div>
<div class="col-first odd-row-color"><code>final boolean</code></div>
<div class="col-second odd-row-color"><code><a href="#pruneIfEmpty" class="member-name-link">pruneIfEmpty</a></code></div>
<div class="col-last odd-row-color">
<div class="block">If the value is true, meaning that the DBMS can prune virtual processors
from the query plan if the input table is empty.</div>
</div>
<div class="col-first even-row-color"><code>final <a href="TableCharacteristic.Semantics.html" title="enum in org.apache.calcite.sql">TableCharacteristic.Semantics</a></code></div>
<div class="col-second even-row-color"><code><a href="#semantics" class="member-name-link">semantics</a></code></div>
<div class="col-last even-row-color">
<div class="block">Input table has either row semantics or set semantics.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="TableCharacteristic.Builder.html" title="class in org.apache.calcite.sql">TableCharacteristic.Builder</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#builder(org.apache.calcite.sql.TableCharacteristic.Semantics)" class="member-name-link">builder</a><wbr>(<a href="TableCharacteristic.Semantics.html" title="enum in org.apache.calcite.sql">TableCharacteristic.Semantics</a>&nbsp;semantics)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Creates a builder.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#equals(java.lang.Object)" class="member-name-link">equals</a><wbr>(@Nullable <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;o)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#hashCode()" class="member-name-link">hashCode</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toString()" class="member-name-link">toString</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="semantics">
<h3>semantics</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type"><a href="TableCharacteristic.Semantics.html" title="enum in org.apache.calcite.sql">TableCharacteristic.Semantics</a></span>&nbsp;<span class="element-name">semantics</span></div>
<div class="block">Input table has either row semantics or set semantics.</div>
</section>
</li>
<li>
<section class="detail" id="pruneIfEmpty">
<h3>pruneIfEmpty</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">pruneIfEmpty</span></div>
<div class="block">If the value is true, meaning that the DBMS can prune virtual processors
from the query plan if the input table is empty.
If the value is false, meaning that the DBMS must actually instantiate
a virtual processor (or more than one virtual processor in the presence
of other input tables).</div>
</section>
</li>
<li>
<section class="detail" id="passColumnsThrough">
<h3>passColumnsThrough</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">passColumnsThrough</span></div>
<div class="block">If the value is true, for each input row, the table function makes the
entire input row available in the output, qualified by a range variable
associated with the input table. Otherwise the value is false.</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="builder(org.apache.calcite.sql.TableCharacteristic.Semantics)">
<h3>builder</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="TableCharacteristic.Builder.html" title="class in org.apache.calcite.sql">TableCharacteristic.Builder</a></span>&nbsp;<span class="element-name">builder</span><wbr><span class="parameters">(<a href="TableCharacteristic.Semantics.html" title="enum in org.apache.calcite.sql">TableCharacteristic.Semantics</a>&nbsp;semantics)</span></div>
<div class="block">Creates a builder.</div>
</section>
</li>
<li>
<section class="detail" id="equals(java.lang.Object)">
<h3>equals</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">equals</span><wbr><span class="parameters">(@Nullable <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;o)</span></div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="hashCode()">
<h3>hashCode</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">hashCode</span>()</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="toString()">
<h3>toString</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">toString</span>()</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &copy; 2012-2023 Apache Software Foundation. All Rights Reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>