You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Alexey Serbin (Jira)" <ji...@apache.org> on 2022/04/20 14:31:00 UTC

[jira] [Comment Edited] (IMPALA-11254) Create Kudu table with hash + range partitions fails

    [ https://issues.apache.org/jira/browse/IMPALA-11254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17524759#comment-17524759 ] 

Alexey Serbin edited comment on IMPALA-11254 at 4/20/22 2:30 PM:
-----------------------------------------------------------------

To me it looks like a minor issue/feature of syntax parsing in Impala.   Kudu client API doesn't have any notion of the sequencing what comes first: range or hash partitioning.  Since that's just some sort of logical product range x hash, there isn't any difference in result for the created ranges.

If in doubt, take a look at the usage of the Kudu client API when creating a table:
{noformat}
unique_ptr<KuduTableCreator> table_creator(client->NewTableCreator());
table_creator->table_name("table")
    .schema(&schema)
    .set_range_partition_columns({ kKeyColumn });
...
unique_ptr<KuduPartialRow> lower(schema_.NewRow());
RETURN_NOT_OK(lower->SetInt32(kKeyColumn, INT32_MIN));
unique_ptr<KuduPartialRow> upper(schema_.NewRow());
RETURN_NOT_OK(upper->SetInt32(kKeyColumn, 111));
table_creator->add_range_partition(lower.release(), upper.release());
...
table_creator->add_hash_partitions({ kKeyColumn }, 2);
...
RETURN_NOT_OK(table_creator->Create());
{noformat}

In the example above, it's possible to swap {{KuduTableCreator::add_hash_partitions()}} and {{uduTableCreator::add_range_partition()}} calls, and the end result is the same.


was (Author: aserbin):
To me it looks like a minor syntax parsing in impala.   Kudu client API doesn't have any notion of the sequencing what comes first: range or hash partitioning.  Since that's just some sort of logical product range x hash, there isn't any difference in result for the created ranges.

If in doubt, take a look at the usage of the Kudu client API when creating a table:
{noformat}
unique_ptr<KuduTableCreator> table_creator(client->NewTableCreator());
table_creator->table_name("table")
    .schema(&schema)
    .set_range_partition_columns({ kKeyColumn });
...
unique_ptr<KuduPartialRow> lower(schema_.NewRow());
RETURN_NOT_OK(lower->SetInt32(kKeyColumn, INT32_MIN));
unique_ptr<KuduPartialRow> upper(schema_.NewRow());
RETURN_NOT_OK(upper->SetInt32(kKeyColumn, 111));
table_creator->add_range_partition(lower.release(), upper.release());
...
table_creator->add_hash_partitions({ kKeyColumn }, 2);
...
RETURN_NOT_OK(table_creator->Create());
{noformat}

In the example above, it's possible to swap {{KuduTableCreator::add_hash_partitions()}} and {{uduTableCreator::add_range_partition()}} calls, and the end result is the same.

> Create Kudu table with hash + range partitions fails
> ----------------------------------------------------
>
>                 Key: IMPALA-11254
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11254
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 4.0.0
>            Reporter: Manish Maheshwari
>            Priority: Critical
>
> The below query fails -
> {code:java}
> CREATE TABLE lsr (
> end_time TIMESTAMP,
> uuid String,
> start_m_tmsi bigint,
> start_time TIMESTAMP,
> duration TIMESTAMP,
> partition_date date,
> PRIMARY KEY(end_time, uuid) 
> ) 
> PARTITION BY RANGE (end_time)
> (
> PARTITION VALUES < '2011-09-01',
> PARTITION '2011-09-01' <= VALUES < '2011-10-01',
> PARTITION '2011-10-01' <= VALUES < '2011-11-01',
> PARTITION '2011-11-01' <= VALUES
> ), 
> HASH (uuid) PARTITIONS 5
> STORED AS KUDU ;
>  {code}
> If you swap the order of range and hash partitions, it works.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org