blob: 228fc921ca75a2b71833ef9d922801088c40dbe9 [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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
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 audience="hidden" id="date" rev="2.0.0">
<title>DATE Data Type (<keyword keyref="impala21"/> or higher only)</title>
<prolog>
<metadata>
<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="Dates and Times"/>
</metadata>
</prolog>
<conbody>
<p>
<indexterm audience="hidden">DATE data type</indexterm>
A type representing the date (year, month, and day) as a single numeric value. Used to represent a broader
date range than possible with the <codeph>TIMESTAMP</codeph> type, with fewer distinct values than
<codeph>TIMESTAMP</codeph>, and in a more compact and efficient form than using a <codeph>STRING</codeph>
such as <codeph>'2014-12-31'</codeph>.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>column_name</varname> DATE</codeblock>
<p>
<b>Range:</b> January 1, -4712 BC .. December 31, 9999 AD.
</p>
<p conref="../shared/impala_common.xml#common/hbase_ok"/>
<p conref="../shared/impala_common.xml#common/parquet_blurb"/>
<ul>
<li>
This type can be read from and written to Parquet files.
</li>
<li>
There is no requirement for a particular level of Parquet.
</li>
<li>
Parquet files generated by Impala and containing this type can be freely interchanged with other components
such as Hive and MapReduce.
</li>
</ul>
<p conref="../shared/impala_common.xml#common/hive_blurb"/>
<p>
TK.
</p>
<p conref="../shared/impala_common.xml#common/conversion_blurb"/>
<p>
TK.
</p>
<p conref="../shared/impala_common.xml#common/partitioning_blurb"/>
<p>
This type can be used for partition key columns. Because it has less granularity (and thus fewer distinct
values) than an equivalent <codeph>TIMESTAMP</codeph> column, and numeric columns are more efficient as
partition keys than strings, prefer to partition by a <codeph>DATE</codeph> column rather than a
<codeph>TIMESTAMP</codeph> column or a <codeph>STRING</codeph> representation of a date.
</p>
<p conref="../shared/impala_common.xml#common/compatibility_blurb"/>
<p>
This type is available on <keyword keyref="impala20_full"/> or higher.
</p>
<p conref="../shared/impala_common.xml#common/internals_2_bytes"/>
<p conref="../shared/impala_common.xml#common/added_in_20"/>
<p conref="../shared/impala_common.xml#common/column_stats_constant"/>
<p conref="../shared/impala_common.xml#common/restrictions_blurb"/>
<p>
Things happen when converting <codeph>TIMESTAMP</codeph> to <codeph>DATE</codeph> or <codeph>DATE</codeph> to
<codeph>TIMESTAMP</codeph>. TK.
</p>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p>
The <xref href="impala_timestamp.xml#timestamp">TIMESTAMP</xref> data type is closely related. Some functions
from <xref href="impala_datetime_functions.xml#datetime_functions"/> accept and return <codeph>DATE</codeph>
values.
</p>
</conbody>
</concept>