blob: a1bfe186e134d276d078e2e00ea380c30a710c51 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="datatypes">
<title>Data Types</title>
<data name="Category" value="Impala"/>
<data name="Category" value="Impala Data Types"/>
<data name="Category" value="SQL"/>
<data name="Category" value="Data Analysts"/>
<data name="Category" value="Developers"/>
<data name="Category" value="SQL"/>
<data name="Category" value="Schemas"/>
<p>Impala supports a set of data types that you can use for table columns,
expression values, and function arguments and return values. </p>
<note> Currently, Impala supports only scalar types, not composite or nested
types. Accessing a table containing any columns with unsupported types
causes an error. </note>
<p outputclass="toc"/>
<p> For the notation to write literals of each of these data types, see
<xref href="impala_literals.xml#literals"/>. </p>
<p> Impala supports a limited set of implicit casts to avoid undesired
results from unexpected casting behavior. </p>
<li> Impala does not implicitly cast between string and numeric or Boolean
types. Always use <codeph>CAST()</codeph> for these conversions. </li>
<li> Impala does perform implicit casts among the numeric types, when
going from a smaller or less precise type to a larger or more precise
one. For example, Impala will implicitly convert a
<codeph>SMALLINT</codeph> to a <codeph>BIGINT</codeph> or
<codeph>FLOAT</codeph>, but to convert from <codeph>DOUBLE</codeph> to
<codeph>FLOAT</codeph> or <codeph>INT</codeph> to
<codeph>TINYINT</codeph> requires a call to <codeph>CAST()</codeph> in
the query. </li>
<li> Impala does perform implicit casts from <codeph>STRING</codeph> to
<codeph>TIMESTAMP</codeph>. Impala has a restricted set of literal
formats for the <codeph>TIMESTAMP</codeph> data type and the
<codeph>FROM_UNIXTIME()</codeph> format string; see <xref
href="impala_timestamp.xml#timestamp"/> for details. </li>
<p>See the topics under this section for full details on implicit and
explicit casting for each data type, and see <xref
href="impala_conversion_functions.xml#conversion_functions"/> for
details about the <codeph>CAST()</codeph> function.</p>