You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Naveen Gangam (Jira)" <ji...@apache.org> on 2019/10/26 09:14:00 UTC

[jira] [Commented] (HIVE-22406) TRUNCATE TABLE fails due MySQL limitations on limit value

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

Naveen Gangam commented on HIVE-22406:
--------------------------------------

In case of truncate table, the code specified Integer.MAX_VALUE for the limit, but its real intention is to get all the partitions for the table. In this case, using {{-1}} instead of MAX_VALUE is to be used as it returns all the partitions. Prior behavior was to convert this value to short, which would have secretly used {{-1 //nolimit}} under the covers as well. But I think this is more appropriate semantically.

> TRUNCATE TABLE fails due MySQL limitations on limit value
> ---------------------------------------------------------
>
>                 Key: HIVE-22406
>                 URL: https://issues.apache.org/jira/browse/HIVE-22406
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Naveen Gangam
>            Assignee: Naveen Gangam
>            Priority: Major
>         Attachments: HIVE-22406.patch
>
>
> HMS currently has some APIs that accepts an integer limit value. Prior to the change in HIVE-21734, HMS was silently converting this int to short and thus we havent seen this issue. But semantically, its incorrect to do so quietly.
> {noformat}
> at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
> Caused by: java.sql.SQLException: setMaxRows() out of range. 2147483647 > 50000000.
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-
> connector-java.jar:5.1.33]
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) ~[mysql-
> connector-java.jar:5.1.33]
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924) ~[mysql-
> connector-java.jar:5.1.33]
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870) ~[mysql-
> connector-java.jar:5.1.33]
> at com.mysql.jdbc.StatementImpl.setMaxRows(StatementImpl.java:2525) ~[mysql-
> connector-java.jar:5.1.33]
> at 
> com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setMaxRows(HikariProxyPreparedS
> tatement.java) ~[HikariCP-2.6.1.jar:?]
> {noformat}
> We cannot change the RawStore api to accept shorts instead of ints. 
> So we have to fix the caller to use a lower limit instead of Integer.MAX_VALUE.
> {noformat}
> Caused by: org.apache.hadoop.hive.metastore.api.MetaException: Exception thrown when executing query : SELECT DISTINCT 'org.apache.hadoop.hive.metastore.model.MPartition' AS `NUCLEUS_TYPE`,`A0`.`CREATE_TIME`,`A0`.`LAST_ACCESS_TIME`,`A0`.`PART_NAME`,`A0`.`WRITE_ID`,`A0`.`PART_ID`,`A0`.`PART_NAME` AS `NUCORDER0` FROM `PARTITIONS` `A0` LEFT OUTER JOIN `TBLS` `B0` ON `A0`.`TBL_ID` = `B0`.`TBL_ID` LEFT OUTER JOIN `DBS` `C0` ON `B0`.`DB_ID` = `C0`.`DB_ID` WHERE `B0`.`TBL_NAME` = ? AND `C0`.`NAME` = ? AND `C0`.`CTLG_NAME` = ? ORDER BY `NUCORDER0` LIMIT 0,2147483647
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$truncate_table_req_result$truncate_table_req_resultStandardScheme.read(ThriftHiveMetastore.java) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$truncate_table_req_result$truncate_table_req_resultStandardScheme.read(ThriftHiveMetastore.java) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$truncate_table_req_result.read(ThriftHiveMetastore.java) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:86) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_truncate_table_req(ThriftHiveMetastore.java:1999) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.truncate_table_req(ThriftHiveMetastore.java:1986) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.truncateTableInternal(HiveMetaStoreClient.java:1450) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.truncateTable(HiveMetaStoreClient.java:1427) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.truncateTable(SessionHiveMetaStoreClient.java:171) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) ~[?:?]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
>         at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:212) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at com.sun.proxy.$Proxy59.truncateTable(Unknown Source) ~[?:?]
>         at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) ~[?:?]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
>         at org.apache.hadoop.hive.metastore.HiveMetaStoreClient$SynchronizedHandler.invoke(HiveMetaStoreClient.java:3122) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at com.sun.proxy.$Proxy59.truncateTable(Unknown Source) ~[?:?]
>         at org.apache.hadoop.hive.ql.metadata.Hive.truncateTable(Hive.java:1277) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
>         at org.apache.hadoop.hive.ql.exec.DDLTask.truncateTable(DDLTask.java:5111) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)