Support Questions

Find answers, ask questions, and share your expertise

Error during CREATE KUDU table using IMPALA

avatar
New Contributor

Hi All,

Can anybudy help me in the below.

While creating kudu table i am facing below syntax problem

i  am currently using impala version:impalad version 2.3.0-cdh5.5.1 RELEASE

> CREATE TABLE foo1 (
> id INT PRIMARY KEY,
> col1 STRING,
> col2 STRING
> )
> PARTITION BY HASH(id) PARTITIONS 3
> STORED AS KUDU;
Query: create TABLE foo1 (
id INT PRIMARY KEY,
col1 STRING,
col2 STRING
)
PARTITION BY HASH(id) PARTITIONS 3
STORED AS KUDU
ERROR: AnalysisException: Syntax error in line 2:
id INT PRIMARY KEY,
           ^
Encountered: IDENTIFIER
Expected: COMMENT, INTERMEDIATE, LOCATION, COMMA

CAUSED BY: Exception: Syntax error

5 REPLIES 5

avatar
Champion

@Saca

 

The following Impala keywords are not supported for Kudu tables:

  • PARTITIONED
  • STORED AS
  • LOCATION
  • ROWFORMAT

Pls refer the link

https://www.cloudera.com/documentation/kudu/0-5-0/topics/kudu_impala.html#concept_r3t_vtz_kt__sectio...

 

To create table from impala

https://www.cloudera.com/documentation/kudu/0-5-0/topics/kudu_impala.html#concept_g51_5vk_ft

 

Please make sure to meet the pre-request

avatar
New Contributor

thanks

avatar
Champion

were are you firing this query  ? beeline or impala shell . 

just dumb question but i am asking you anyways 

your syntax is correct could be some editor issue or space. 

 

try the below format 

 

CREATE TABLE foo1  (id INT PRIMARY KEY, col1 STRING ,col2 STRING )
PARTITION BY HASH(id) PARTITIONS 3  STORED AS KUDU;

avatar
New Contributor
yes, i am firing this query on impala shell.

avatar
Champion

below is the example let me know if that works for you. 

 

You can use Range or hash partition , also we can perform Range as well as hash partition together or just hash partition by using bucket . 

 

Below is the table that has primary key that coloum id we are using for partition (that is a good practice ) 

 

CREATE TABLE customersDetails (
  state STRING,
  PRIMARY KEY (state, name)
)
PARTITION BY RANGE (state)
(
  PARTITION VALUE = 'al',
  PARTITION VALUE = 'ak',
  PARTITION VALUE = 'wv',
  PARTITION VALUE = 'wy'
)
STORED AS KUDU;