Daniel Dai created HIVE-21296:
---------------------------------

             Summary: Dropping varchar partition throw exception
                 Key: HIVE-21296
                 URL: https://issues.apache.org/jira/browse/HIVE-21296
             Project: Hive
          Issue Type: Bug
            Reporter: Daniel Dai
            Assignee: Daniel Dai


Drop partition fail if the partition column is varchar. For example:
{code:java}
create external table BS_TAB_0_211494(c_date_SAD_29630 date) PARTITIONED BY 
(part_varchar_37229 varchar(56)) STORED AS orc;

INSERT INTO BS_TAB_0_211494 values('4740-04-04','BrNTRsv3c');

ALTER TABLE BS_TAB_0_211494 DROP PARTITION 
(part_varchar_37229='BrNTRsv3c');{code}

Exception:
{code}
2019-02-19T22:12:55,843  WARN [HiveServer2-Handler-Pool: Thread-42] 
thrift.ThriftCLIService: Error executing statement: 
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: 
FAILED: SemanticException [Error 10006]: Partition not found 
(part_varchar_37229 = 'BrNTRsv3c')
        at 
org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:356)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:206)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:269)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.operation.Operation.run(Operation.java:268) 
~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:576)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:561)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_202]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_202]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_202]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at java.security.AccessController.doPrivileged(Native Method) 
~[?:1.8.0_202]
        at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_202]
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1682)
 ~[hadoop-common-3.1.0.jar:?]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at com.sun.proxy.$Proxy43.executeStatementAsync(Unknown Source) ~[?:?]
        at 
org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:568)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1557)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1542)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[?:1.8.0_202]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
~[?:1.8.0_202]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]
Caused by: org.apache.hadoop.hive.ql.parse.SemanticException: Partition not 
found (part_varchar_37229 = 'BrNTRsv3c')
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.addTableDropPartsOutputs(DDLSemanticAnalyzer.java:4110)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeAlterTableDropParts(DDLSemanticAnalyzer.java:3448)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeInternal(DDLSemanticAnalyzer.java:319)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:289)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:671) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1905) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1852) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1847) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:204)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        ... 27 more
Caused by: org.apache.hadoop.hive.metastore.api.MetaException: java.lang.String 
cannot be cast to org.apache.hadoop.hive.common.type.HiveVarchar
        at 
org.apache.hadoop.hive.metastore.ObjectStore$GetHelper.run(ObjectStore.java:3626)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.metastore.ObjectStore.getPartitionsByExprInternal(ObjectStore.java:3333)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.metastore.ObjectStore.getPartitionsByExpr(ObjectStore.java:3286)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_202]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_202]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_202]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202]
        at 
org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:97) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at com.sun.proxy.$Proxy37.getPartitionsByExpr(Unknown Source) ~[?:?]
        at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_partitions_by_expr(HiveMetaStore.java:6284)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_202]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_202]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_202]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202]
        at 
org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at com.sun.proxy.$Proxy39.get_partitions_by_expr(Unknown Source) ~[?:?]
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.listPartitionsByExpr(HiveMetaStoreClient.java:1786)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.listPartitionsByExpr(HiveMetaStoreClient.java:1767)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_202]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_202]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_202]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202]
        at 
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:212)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at com.sun.proxy.$Proxy40.listPartitionsByExpr(Unknown Source) ~[?:?]
        at 
org.apache.hadoop.hive.ql.metadata.Hive.getPartitionsByExpr(Hive.java:3752) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.addTableDropPartsOutputs(DDLSemanticAnalyzer.java:4107)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeAlterTableDropParts(DDLSemanticAnalyzer.java:3448)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeInternal(DDLSemanticAnalyzer.java:319)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:289)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:671) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1905) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1852) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1847) 
~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126)
 ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at 
org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:204)
 ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        ... 27 more
{code}
The real error occurs on this stack:
{code}
equals:65, HiveVarchar (org.apache.hadoop.hive.common.type)
        at isDefaultPartition:105, ExprNodeDescUtils 
(org.apache.hadoop.hive.ql.plan)
        at replaceEqualDefaultPartition:125, ExprNodeDescUtils 
(org.apache.hadoop.hive.ql.plan)
        at filterPartitionsByExpr:75, PartitionExpressionForMetastore 
(org.apache.hadoop.hive.ql.optimizer.ppr)
        at getPartitionNamesPrunedByExprNoTxn:3361, ObjectStore 
(org.apache.hadoop.hive.metastore)
        at access$800:115, ObjectStore (org.apache.hadoop.hive.metastore)
        at getSqlResult:3311, ObjectStore$9 (org.apache.hadoop.hive.metastore)
        at getSqlResult:3298, ObjectStore$9 (org.apache.hadoop.hive.metastore)
        at run:3606, ObjectStore$GetHelper (org.apache.hadoop.hive.metastore)
        at getPartitionsByExprInternal:3333, ObjectStore 
(org.apache.hadoop.hive.metastore)
        at getPartitionsByExpr:3286, ObjectStore 
(org.apache.hadoop.hive.metastore)
        at invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
        at invoke:62, NativeMethodAccessorImpl (sun.reflect)
        at invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
        at invoke:498, Method (java.lang.reflect)
        at invoke:97, RawStoreProxy (org.apache.hadoop.hive.metastore)
        at getPartitionsByExpr:-1, $Proxy37 (com.sun.proxy)
        at get_partitions_by_expr:6284, HiveMetaStore$HMSHandler 
(org.apache.hadoop.hive.metastore)
        at invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
        at invoke:62, NativeMethodAccessorImpl (sun.reflect)
        at invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
        at invoke:498, Method (java.lang.reflect)
        at invokeInternal:147, RetryingHMSHandler 
(org.apache.hadoop.hive.metastore)
        at invoke:108, RetryingHMSHandler (org.apache.hadoop.hive.metastore)
        at get_partitions_by_expr:-1, $Proxy39 (com.sun.proxy)
        at listPartitionsByExpr:1786, HiveMetaStoreClient 
(org.apache.hadoop.hive.metastore)
        at listPartitionsByExpr:1767, HiveMetaStoreClient 
(org.apache.hadoop.hive.metastore)
        at invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
        at invoke:62, NativeMethodAccessorImpl (sun.reflect)
        at invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
        at invoke:498, Method (java.lang.reflect)
        at invoke:212, RetryingMetaStoreClient 
(org.apache.hadoop.hive.metastore)
        at listPartitionsByExpr:-1, $Proxy40 (com.sun.proxy)
        at getPartitionsByExpr:3752, Hive (org.apache.hadoop.hive.ql.metadata)
        at addTableDropPartsOutputs:4107, DDLSemanticAnalyzer 
(org.apache.hadoop.hive.ql.parse)
        at analyzeAlterTableDropParts:3448, DDLSemanticAnalyzer 
(org.apache.hadoop.hive.ql.parse)
        at analyzeInternal:319, DDLSemanticAnalyzer 
(org.apache.hadoop.hive.ql.parse)
        at analyze:289, BaseSemanticAnalyzer (org.apache.hadoop.hive.ql.parse)
        at compile:671, Driver (org.apache.hadoop.hive.ql)
        at compileInternal:1905, Driver (org.apache.hadoop.hive.ql)
        at compileAndRespond:1852, Driver (org.apache.hadoop.hive.ql)
        at compileAndRespond:1847, Driver (org.apache.hadoop.hive.ql)
        at compileAndRespond:126, ReExecDriver 
(org.apache.hadoop.hive.ql.reexec)
        at prepare:204, SQLOperation (org.apache.hive.service.cli.operation)
        at runInternal:269, SQLOperation (org.apache.hive.service.cli.operation)
        at run:268, Operation (org.apache.hive.service.cli.operation)
        at executeStatementInternal:576, HiveSessionImpl 
(org.apache.hive.service.cli.session)
        at executeStatementAsync:561, HiveSessionImpl 
(org.apache.hive.service.cli.session)
        at invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
        at invoke:62, NativeMethodAccessorImpl (sun.reflect)
        at invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
        at invoke:498, Method (java.lang.reflect)
        at invoke:78, HiveSessionProxy (org.apache.hive.service.cli.session)
        at access$000:36, HiveSessionProxy (org.apache.hive.service.cli.session)
        at run:63, HiveSessionProxy$1 (org.apache.hive.service.cli.session)
        at doPrivileged:-1, AccessController (java.security)
        at doAs:422, Subject (javax.security.auth)
        at doAs:1682, UserGroupInformation (org.apache.hadoop.security)
        at invoke:59, HiveSessionProxy (org.apache.hive.service.cli.session)
        at executeStatementAsync:-1, $Proxy43 (com.sun.proxy)
        at executeStatementAsync:315, CLIService (org.apache.hive.service.cli)
        at ExecuteStatement:568, ThriftCLIService 
(org.apache.hive.service.cli.thrift)
        at getResult:1557, TCLIService$Processor$ExecuteStatement 
(org.apache.hive.service.rpc.thrift)
        at getResult:1542, TCLIService$Processor$ExecuteStatement 
(org.apache.hive.service.rpc.thrift)
        at process:39, ProcessFunction (org.apache.thrift)
        at process:39, TBaseProcessor (org.apache.thrift)
        at process:56, TSetIpAddressProcessor (org.apache.hive.service.auth)
        at run:286, TThreadPoolServer$WorkerProcess (org.apache.thrift.server)
        at runWorker:1149, ThreadPoolExecutor (java.util.concurrent)
        at run:624, ThreadPoolExecutor$Worker (java.util.concurrent)
        at run:748, Thread (java.lang)
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to