Impala Data Types: Usage, Syntax and Examples

Boost your career with Free Big Data Courses!!

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.

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.

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

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.

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.

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.

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.

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

follow dataflair on YouTube

Leave a Reply

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