Impala Data Types: Usage, Syntax and Examples
Don't become Obsolete & get a Pink Slip
Follow DataFlair on Google News & Stay ahead of the game
1. Impala Data Types: Objective
There is a huge set of data types available in Impala. Basically, those Impala Data Types we use for table columns, expression values, and function arguments and return values. Each Impala Data Types serves a specific purpose. So, in this article, “Impala Data Types”, we will learn each Impala Data Types in detail. Also, we will cover their syntax, in order to use them.
So, let’s start Impala Data Types.
2. Introduction to Impala Data Types
So, let’s discuss each Impala Data Types one by one, along with their syntax.
While it comes to store numerical values, we use BIGINT data type. The range of this data type is -9223372036854775808 to 9223372036854775807. In addition, we use it in create table and alter table statements.
Let’s See Impala UDF (User-Defined Functions) – How to Write UDFs
This data type stores only true or false values and it is used in the column definition of create table statement.
CHAR data type fixed length storage which is also padded with spaces. Basically, it stores up to the maximum length of 255.
To store decimal values, we use DECIMAL Data Type. In addition, we use it in create table and alter table statements.
In order to store the floating point values, we use DOUBLE Data Type. It has some specific range of positive or negative 4.94065645841246544e-324d -1.79769313486231570e+308
Let’s See Impala Shell and Impala command
This data type is used to store single precision floating value datatypes in the range of positive or negative 1.40129846432481707e-45 .. 3.40282346638528860e+38.
To store 4-byte integer up to the range of -2147483648 to 2147483647, we use INT Data Type.
While it comes to store the 2-byte integer, we use SMALLINT data type. It has the specific range between -32768 to 32767.
According to its name, STRING Data Type stores string values.
Do you know Impala Use Cases and Applications
To represent a point in a time, we use TIMESTAMP.
While it comes to store the 1-byte integer, we use TINYINT. However, it stores value up to the range of -128 to 127.
To store variable-length character up to the maximum length 65,535, we use VARCHAR Type.
column_name ARRAY < type > type ::= primitive_type | complex_type
ARRAY Data Type is generally considered as a complex data type. Basically, we use it to store the variable number of ordered elements.
column_name MAP < primitive_type, type > type ::= primitive_type | complex_type
As same as ARRAY, Map is also considered as a complex data type. However, we use it to store the variable number of key-value pairs.
Let’s Read Impala Architecture – components of Impala
column_name STRUCT < name : type [COMMENT 'comment_string'], ... > type ::= primitive_type | complex_type
In order to represent multiple fields of a single item, we use STRUCT Data Type. This is also a complex data type.