blob: 3f5c6dd2c43e16c555a3c40a53ef0262e715e88a [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>TypeCoercion (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="TypeCoercion (Apache Calcite API)";
}
}
catch(err) {
}
//-->
var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract 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/TypeCoercion.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>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&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.sql.validate.implicit</a></div>
<h2 title="Interface TypeCoercion" class="title">Interface TypeCoercion</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="AbstractTypeCoercion.html" title="class in org.apache.calcite.sql.validate.implicit">AbstractTypeCoercion</a></code>, <code><a href="TypeCoercionImpl.html" title="class in org.apache.calcite.sql.validate.implicit">TypeCoercionImpl</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">TypeCoercion</span></pre>
<div class="block">Default Strategies to coerce differing types that participate in
operations into compatible ones.
<p>Notes about type widening / tightest common types: Broadly, there are two cases that need
to widen data types (i.e. set operations, binary comparison):
<ul>
<li>Case1: Look for a common data type for two or more data types,
and no loss of precision is allowed. Including type inference for returned/operands
type (i.e. what's the column's common data type if one row is an integer while the
other row is a long?).</li>
<li>Case2: Look for a widen data type with some acceptable loss of precision
(i.e. there is no common type for double and decimal because double's range is larger than
decimal(with default max precision), and yet decimal is more precise than double,
but in union we would cast the decimal to double).</li>
</ul>
<p>REFERENCE: <a href="https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-type-conversion-database-engine?">SQL-SERVER</a>
<a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types">HIVE</a></p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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="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></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>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#binaryArithmeticCoercion(org.apache.calcite.sql.SqlCallBinding)">binaryArithmeticCoercion</a></span>&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding)</code></th>
<td class="colLast">
<div class="block">Coerce operand of binary arithmetic expressions to Numeric type.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#builtinFunctionCoercion(org.apache.calcite.sql.SqlCallBinding,java.util.List,java.util.List)">builtinFunctionCoercion</a></span>&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding,
java.util.List&lt;<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&gt;&nbsp;operandTypes,
java.util.List&lt;<a href="../../type/SqlTypeFamily.html" title="enum in org.apache.calcite.sql.type">SqlTypeFamily</a>&gt;&nbsp;expectedFamilies)</code></th>
<td class="colLast">
<div class="block">Type coercion with inferred type from passed in arguments and the
<a href="../../type/SqlTypeFamily.html" title="enum in org.apache.calcite.sql.type"><code>SqlTypeFamily</code></a> defined in the checkers, e.g.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#caseWhenCoercion(org.apache.calcite.sql.SqlCallBinding)">caseWhenCoercion</a></span>&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding)</code></th>
<td class="colLast">
<div class="block">Coerce CASE WHEN statement branches to one common type.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#commonTypeForBinaryComparison(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)">commonTypeForBinaryComparison</a></span>&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2)</code></th>
<td class="colLast">
<div class="block">Determines common type for a comparison operator whose operands are String
type and the other (non String) type.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTightestCommonType(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)">getTightestCommonType</a></span>&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2)</code></th>
<td class="colLast">
<div class="block">Case1: type widening with no precision loss.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getWiderTypeFor(java.util.List,boolean)">getWiderTypeFor</a></span>&#8203;(java.util.List&lt;<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&gt;&nbsp;typeList,
boolean&nbsp;stringPromotion)</code></th>
<td class="colLast">
<div class="block">Similar to <a href="#getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType,boolean)"><code>getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.rel.type.RelDataType, boolean)</code></a>, but can handle
sequence types.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getWiderTypeForDecimal(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)">getWiderTypeForDecimal</a></span>&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2)</code></th>
<td class="colLast">
<div class="block">Finds a wider type when one or both types are decimal type.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType,boolean)">getWiderTypeForTwo</a></span>&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2,
boolean&nbsp;stringPromotion)</code></th>
<td class="colLast">
<div class="block">Case2: type widening.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#inOperationCoercion(org.apache.calcite.sql.SqlCallBinding)">inOperationCoercion</a></span>&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding)</code></th>
<td class="colLast">
<div class="block">Handles type coercion for IN operation with or without sub-query.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rowTypeCoercion(org.apache.calcite.sql.validate.SqlValidatorScope,org.apache.calcite.sql.SqlNode,int,org.apache.calcite.rel.type.RelDataType)">rowTypeCoercion</a></span>&#8203;(<a href="../SqlValidatorScope.html" title="interface in org.apache.calcite.sql.validate">SqlValidatorScope</a>&nbsp;scope,
<a href="../../SqlNode.html" title="class in org.apache.calcite.sql">SqlNode</a>&nbsp;query,
int&nbsp;columnIndex,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;targetType)</code></th>
<td class="colLast">
<div class="block">Widen a SqlNode ith column type to target type, mainly used for set
operations like UNION, INTERSECT and EXCEPT.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#userDefinedFunctionCoercion(org.apache.calcite.sql.validate.SqlValidatorScope,org.apache.calcite.sql.SqlCall,org.apache.calcite.sql.SqlFunction)">userDefinedFunctionCoercion</a></span>&#8203;(<a href="../SqlValidatorScope.html" title="interface in org.apache.calcite.sql.validate">SqlValidatorScope</a>&nbsp;scope,
<a href="../../SqlCall.html" title="class in org.apache.calcite.sql">SqlCall</a>&nbsp;call,
<a href="../../SqlFunction.html" title="class in org.apache.calcite.sql">SqlFunction</a>&nbsp;function)</code></th>
<td class="colLast">
<div class="block">Non built-in functions (UDFs) type coercion, compare the types of arguments
with rules:
named param: find the desired type by the passed in operand's name
non-named param: find the desired type by formal parameter ordinal
</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getTightestCommonType(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTightestCommonType</h4>
<pre class="methodSignature"><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;getTightestCommonType&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2)</pre>
<div class="block">Case1: type widening with no precision loss.
Find the tightest common type of two types that might be used in binary expression.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>common type</dd>
</dl>
</li>
</ul>
<a id="getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWiderTypeForTwo</h4>
<pre class="methodSignature"><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;getWiderTypeForTwo&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2,
boolean&nbsp;stringPromotion)</pre>
<div class="block">Case2: type widening. The main difference with
<a href="#getTightestCommonType(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)"><code>getTightestCommonType(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.rel.type.RelDataType)</code></a> is that we allow
some precision loss when widening decimal to fractional, or promote to string type.</div>
</li>
</ul>
<a id="getWiderTypeFor(java.util.List,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWiderTypeFor</h4>
<pre class="methodSignature"><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;getWiderTypeFor&#8203;(java.util.List&lt;<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&gt;&nbsp;typeList,
boolean&nbsp;stringPromotion)</pre>
<div class="block">Similar to <a href="#getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType,boolean)"><code>getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.rel.type.RelDataType, boolean)</code></a>, but can handle
sequence types. <a href="#getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType,boolean)"><code>getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.rel.type.RelDataType, boolean)</code></a> doesn't satisfy the associative law,
i.e. (a op b) op c may not equal to a op (b op c). This is only a problem for StringType or
nested StringType in collection type like Array. Excluding these types,
<a href="#getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType,boolean)"><code>getWiderTypeForTwo(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.rel.type.RelDataType, boolean)</code></a> satisfies the associative law. For instance,
(DATE, INTEGER, VARCHAR) should have VARCHAR as the wider common type.</div>
</li>
</ul>
<a id="getWiderTypeForDecimal(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWiderTypeForDecimal</h4>
<pre class="methodSignature"><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;getWiderTypeForDecimal&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2)</pre>
<div class="block">Finds a wider type when one or both types are decimal type.
<p>If the wider decimal type's precision/scale exceeds system limitation,
this rule will truncate the decimal type to the max precision/scale.
For decimal and fractional types, returns a decimal type
which has the higher precision of the two.
<p>The default implementation depends on the max precision/scale of the type system,
you can override it based on the specific system requirement in
<a href="../../../rel/type/RelDataTypeSystem.html" title="interface in org.apache.calcite.rel.type"><code>RelDataTypeSystem</code></a>.</div>
</li>
</ul>
<a id="commonTypeForBinaryComparison(org.apache.calcite.rel.type.RelDataType,org.apache.calcite.rel.type.RelDataType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>commonTypeForBinaryComparison</h4>
<pre class="methodSignature"><a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;commonTypeForBinaryComparison&#8203;(<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type1,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;type2)</pre>
<div class="block">Determines common type for a comparison operator whose operands are String
type and the other (non String) type.</div>
</li>
</ul>
<a id="rowTypeCoercion(org.apache.calcite.sql.validate.SqlValidatorScope,org.apache.calcite.sql.SqlNode,int,org.apache.calcite.rel.type.RelDataType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rowTypeCoercion</h4>
<pre class="methodSignature">boolean&nbsp;rowTypeCoercion&#8203;(<a href="../SqlValidatorScope.html" title="interface in org.apache.calcite.sql.validate">SqlValidatorScope</a>&nbsp;scope,
<a href="../../SqlNode.html" title="class in org.apache.calcite.sql">SqlNode</a>&nbsp;query,
int&nbsp;columnIndex,
<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&nbsp;targetType)</pre>
<div class="block">Widen a SqlNode ith column type to target type, mainly used for set
operations like UNION, INTERSECT and EXCEPT.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>scope</code> - scope to query</dd>
<dd><code>query</code> - SqlNode which have children nodes as columns</dd>
<dd><code>columnIndex</code> - target column index</dd>
<dd><code>targetType</code> - target type to cast to</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if we add any cast in successfully.</dd>
</dl>
</li>
</ul>
<a id="inOperationCoercion(org.apache.calcite.sql.SqlCallBinding)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>inOperationCoercion</h4>
<pre class="methodSignature">boolean&nbsp;inOperationCoercion&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding)</pre>
<div class="block">Handles type coercion for IN operation with or without sub-query.
<p>See <a href="TypeCoercionImpl.html" title="class in org.apache.calcite.sql.validate.implicit"><code>TypeCoercionImpl</code></a> for default strategies.</div>
</li>
</ul>
<a id="binaryArithmeticCoercion(org.apache.calcite.sql.SqlCallBinding)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>binaryArithmeticCoercion</h4>
<pre class="methodSignature">boolean&nbsp;binaryArithmeticCoercion&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding)</pre>
<div class="block">Coerce operand of binary arithmetic expressions to Numeric type.</div>
</li>
</ul>
<a id="caseWhenCoercion(org.apache.calcite.sql.SqlCallBinding)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>caseWhenCoercion</h4>
<pre class="methodSignature">boolean&nbsp;caseWhenCoercion&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding)</pre>
<div class="block">Coerce CASE WHEN statement branches to one common type.
<p>Rules: Find common type for all the then operands and else operands,
then try to coerce the then/else operands to the type if needed.</div>
</li>
</ul>
<a id="builtinFunctionCoercion(org.apache.calcite.sql.SqlCallBinding,java.util.List,java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>builtinFunctionCoercion</h4>
<pre class="methodSignature">boolean&nbsp;builtinFunctionCoercion&#8203;(<a href="../../SqlCallBinding.html" title="class in org.apache.calcite.sql">SqlCallBinding</a>&nbsp;binding,
java.util.List&lt;<a href="../../../rel/type/RelDataType.html" title="interface in org.apache.calcite.rel.type">RelDataType</a>&gt;&nbsp;operandTypes,
java.util.List&lt;<a href="../../type/SqlTypeFamily.html" title="enum in org.apache.calcite.sql.type">SqlTypeFamily</a>&gt;&nbsp;expectedFamilies)</pre>
<div class="block">Type coercion with inferred type from passed in arguments and the
<a href="../../type/SqlTypeFamily.html" title="enum in org.apache.calcite.sql.type"><code>SqlTypeFamily</code></a> defined in the checkers, e.g. the
<a href="../../type/FamilyOperandTypeChecker.html" title="class in org.apache.calcite.sql.type"><code>FamilyOperandTypeChecker</code></a>.
<p>Caution that we do not cast from numeric if desired type family is also
<a href="../../type/SqlTypeFamily.html#NUMERIC"><code>SqlTypeFamily.NUMERIC</code></a>.
<p>If the <a href="../../type/FamilyOperandTypeChecker.html" title="class in org.apache.calcite.sql.type"><code>FamilyOperandTypeChecker</code></a>s are
subsumed in a
<a href="../../type/CompositeOperandTypeChecker.html" title="class in org.apache.calcite.sql.type"><code>CompositeOperandTypeChecker</code></a>, check them
based on their combination order. i.e. If we allows a (numeric, numeric) OR
(string, numeric) family but with arguments (op1, op2) of types
(varchar(20), boolean), try to coerce op1 to numeric and op2 to numeric if
the type coercion rules allow it, or else try to coerce op2 to numeric and
keep op1 the type as it is.
<p>This is also very interrelated to the composition predicate for the
checkers: if the predicate is AND, we would fail fast if the first family
type coercion fails.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>binding</code> - Call binding</dd>
<dd><code>operandTypes</code> - Types of the operands passed in</dd>
<dd><code>expectedFamilies</code> - Expected SqlTypeFamily list by user specified</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if we successfully do any implicit cast</dd>
</dl>
</li>
</ul>
<a id="userDefinedFunctionCoercion(org.apache.calcite.sql.validate.SqlValidatorScope,org.apache.calcite.sql.SqlCall,org.apache.calcite.sql.SqlFunction)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>userDefinedFunctionCoercion</h4>
<pre class="methodSignature">boolean&nbsp;userDefinedFunctionCoercion&#8203;(<a href="../SqlValidatorScope.html" title="interface in org.apache.calcite.sql.validate">SqlValidatorScope</a>&nbsp;scope,
<a href="../../SqlCall.html" title="class in org.apache.calcite.sql">SqlCall</a>&nbsp;call,
<a href="../../SqlFunction.html" title="class in org.apache.calcite.sql">SqlFunction</a>&nbsp;function)</pre>
<div class="block">Non built-in functions (UDFs) type coercion, compare the types of arguments
with rules:
<ol>
<li>named param: find the desired type by the passed in operand's name
<li>non-named param: find the desired type by formal parameter ordinal
</ol>
<p>Try to make type coercion only of the desired type is found.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if any operands is coerced</dd>
</dl>
</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/TypeCoercion.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>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&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>