Support Questions

Find answers, ask questions, and share your expertise

Impala JDBC driver: drop range partition doesn't work (Kudu)

avatar
Contributor

Hi

 

I can't remove the upper range partition of a kudu table and it seems to be because of the "greater than" sign... Can somebody tell me what I'm doing wrong?

 

Example Table "test_sql_drop":

 

HASH (flowEndDate, uniqueID) PARTITIONS 16,
RANGE (flowEndDate) (
    PARTITION VALUES < 1535102117,
    PARTITION 1535102117 <= VALUES < 1535188517,
    PARTITION 1536138917 <= VALUES < 1536225317,
    PARTITION 1536225317 <= VALUES < 1536311717,
    PARTITION VALUES >= 1536311717
)

The following query to remove the lower limit works like a charm:

ALTER TABLE test_sql_drop DROP RANGE PARTITION VALUES < 1535102117;

However, if I try the same with the upper limit, it doesn't work:

ALTER TABLE test_sql_drop DROP RANGE PARTITION VALUES >= 1536311717;

java.sql.SQLException: [Cloudera][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:AnalysisException: Syntax error in line 1:
...OP RANGE PARTITION VALUES >= 1536311717;
                             ^
Encountered: >
Expected: COMMA

CAUSED BY: Exception: Syntax error
), Query: ALTER TABLE test_sql_drop DROP RANGE PARTITION VALUES >= 1536311717;.
	at com.cloudera.impala.hivecommon.api.HS2Client.executeStatementInternal(Unknown Source)
	at com.cloudera.impala.hivecommon.api.HS2Client.executeStatement(Unknown Source)
....

Pretty simple question, but now we stuck because we can't extend the upper limit of our kudu tables (at least with JDBC Impala Driver).

 

Thanks in advance. Cheers

1 ACCEPTED SOLUTION

avatar
Contributor

Thanks to the getkudu Slack Channel I found a solution for my issue. Just in case someone else is facing this as well, just reorder the "VALUES" string and the "Number" in a way that you can use "<=" instead of ">="...

 

Original:

ALTER TABLE test_sql_drop DROP RANGE PARTITION VALUES >= 1536311717;

Workaround:

ALTER TABLE test_sql_drop DROP RANGE PARTITION 1536311717 <= VALUES;

Cheers

View solution in original post

2 REPLIES 2

avatar
Contributor

Thanks to the getkudu Slack Channel I found a solution for my issue. Just in case someone else is facing this as well, just reorder the "VALUES" string and the "Number" in a way that you can use "<=" instead of ">="...

 

Original:

ALTER TABLE test_sql_drop DROP RANGE PARTITION VALUES >= 1536311717;

Workaround:

ALTER TABLE test_sql_drop DROP RANGE PARTITION 1536311717 <= VALUES;

Cheers

avatar
Contributor

There is now a "Bugreport" for Impala: https://issues.apache.org/jira/browse/IMPALA-7618