Impala Data Types: Usage, Syntax and Examples

Stay updated with the latest technology trends while you're on the move - Join DataFlair's Telegram Channel

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.

Impala Data Types: Usage, Syntax and Examples

Impala Data Types: Usage, Syntax and Examples

Hadoop Quiz

2. Introduction to Impala Data Types

So, let’s discuss each Impala Data Types one by one, along with their syntax.

a. BIGINT

  • Syntax
column_name BIGINT

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

b. BOOLEAN

  • Syntax
column_name BOOLEAN

This data type stores only true or false values and it is used in the column definition of create table statement.

c. CHAR

  • Syntax
column_name CHAR(length)

CHAR data type fixed length storage which is also padded with spaces. Basically, it stores up to the maximum length of 255.

d. DECIMAL

  • Syntax
column_name DECIMAL[(precision[,scale])]

To store decimal values, we use DECIMAL Data Type. In addition, we use it in create table and alter table statements.

e. DOUBLE

  • Syntax
column_name DOUBLE

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

f. FLOAT

  • Syntax
column_name FLOAT

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.

g. INT

  • Syntax
column_name INT

To store 4-byte integer up to the range of -2147483648 to 2147483647, we use INT Data Type.

h. SMALLINT

  • Syntax
column_name SMALLINT

While it comes to store the 2-byte integer, we use SMALLINT  data type. It has the specific range between -32768 to 32767.

i. STRING

  • Syntax
column_name STRING

According to its name, STRING Data Type stores string values.
Do you know Impala Use Cases and Applications

j. TIMESTAMP

  • Syntax
column_name TIMESTAMP

To represent a point in a time, we use TIMESTAMP.

k. TINYINT

  • Syntax
column_name TINYINT

While it comes to store the 1-byte integer, we use TINYINT. However, it stores value up to the range of -128 to 127.

l. VARCHAR

  • Syntax
column_name VARCHAR(max_length)

To store variable-length character up to the maximum length 65,535, we use VARCHAR Type.

m. ARRAY

  • Syntax
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.

n. MAP

  • Syntax
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

o. STRUCT

  • Syntax
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.

If these professionals can make a switch to Big Data, so can you:
Rahul Doddamani Story - DataFlair
Rahul Doddamani
Java → Big Data Consultant, JDA
Follow on
Mritunjay Singh Success Story - DataFlair
Mritunjay Singh
PeopleSoft → Big Data Architect, Hexaware
Follow on
Rahul Doddamani Success Story - DataFlair
Rahul Doddamani
Big Data Consultant, JDA
Follow on
I got placed, scored 100% hike, and transformed my career with DataFlair
Enroll now
Deepika Khadri Success Story - DataFlair
Deepika Khadri
SQL → Big Data Engineer, IBM
Follow on
DataFlair Web Services
You could be next!
Enroll now

3. Conclusion

As a result, we have seen all Impala Data Types, in detail. However, if any doubt occurs, feel free to ask in the comment section.
See Also- Impala Books
For reference

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.