Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Creates a new table. 

Syntax

Code Block
languagesql
linenumberstrue
CREATE TABLE [schema_name.]table_name (
column_name data_type [PRIMARY KEY] [,...]
)
[ PARTITION BY RANGE(column_name) EVERY (part_interval) ]
Data_type 
INT | BIGINT | FLOAT | DOUBLE | STRING | TIMESTAMP
part_interval
n      |
VALUE  |
INTERVAL 'n' month | day | hour

Description

Table and column names must be a valid identifier. For details on Jethro data types attributes, see Data Types under the Installation Guide Glossary. A table can have one primary key column. Primary keys must contain unique values and cannot contain NULL values.

Parameter Details

ParameterMandatory?Details
 PARTITION BY

Status
colourGreen
titleoptional

The clause defines range partitioning. Unlike Hive and Impala, in Jethro the partition column name must be one of the columns previously defined in the table column list.

Partitioning interval specification depends on the data type of the partitioning column:

  • For numeric partition key - use EVERY (#n). For example: PARTITION BY RANGE(store_sk) EVERY (10)
  • For string partition key - you must specify EVERY (VALUE). Each distinct string will have its own partition. For example: PARTITION BY RANGE(store_name) EVERY (VALUE)
  • For timestamp partition key - use EVERY (INTERVAL ...) For example: PARTITION BY RANGE(sale_date) EVERY (INTERVAL '3' MONTH)

See Also

...

DROP TABLE