Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-27065

Exception in partition column statistics update with SQL Server db when histogram statistics is not enabled

    XMLWordPrintableJSON

Details

    Description

      [Description] 

      java.sql.BatchUpdateException thrown from insertIntoPartColStatTable() with SQL Server db when histogram statistics is not enabled.

      java.sql.BatchUpdateException: Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.

       

      [Steps to reproduce] 

      Create stage table, load data into stage table, create partition table and load data into the table from the stage table.

      0: jdbc:hive2://localhost:10000> create database mydb;
      0: jdbc:hive2://localhost:10000> use mydb;
       
      0: jdbc:hive2://localhost:10000> create table stage(sr int, st string, name string) row format delimited fields terminated by '\t' stored as textfile;
       
      0: jdbc:hive2://localhost:10000> load data local inpath 'partdata' into table stage;
       
      0: jdbc:hive2://localhost:10000> create table dynpart(num int, name string) partitioned by (category string) row format delimited fields terminated by '\t' stored as textfile;
       
      0: jdbc:hive2://localhost:10000> insert into dynpart select * from stage; 

       

      [Exception Stack]

      2023-02-10T05:16:42,921 ERROR [HiveServer2-Background-Pool: Thread-112] metastore.DirectSqlUpdateStat: Unable to update Column stats for  dynpart
      java.sql.BatchUpdateException: Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
          at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2303) ~[mssql-jdbc-6.2.1.jre8.jar:?]
          at org.apache.hive.com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hive.com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.DirectSqlUpdateStat.insertIntoPartColStatTable(DirectSqlUpdateStat.java:281) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.DirectSqlUpdateStat.updatePartitionColumnStatistics(DirectSqlUpdateStat.java:612) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.MetaStoreDirectSql.updatePartitionColumnStatisticsBatch(MetaStoreDirectSql.java:3063) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.ObjectStore.updatePartitionColumnStatisticsInBatch(ObjectStore.java:9943) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
          at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
          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.$Proxy29.updatePartitionColumnStatisticsInBatch(Unknown Source) ~[?:?]
          at org.apache.hadoop.hive.metastore.HMSHandler.updatePartitionColStatsForOneBatch(HMSHandler.java:7068) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.HMSHandler.updatePartitionColStatsInBatch(HMSHandler.java:7121) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.HMSHandler.updatePartColumnStatsWithMerge(HMSHandler.java:9247) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.HMSHandler.set_aggr_stats_for(HMSHandler.java:9149) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
          at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
          at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:146) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:107) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at com.sun.proxy.$Proxy31.set_aggr_stats_for(Unknown Source) ~[?:?]
          at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.setPartitionColumnStatistics(HiveMetaStoreClient.java:3307) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.setPartitionColumnStatistics(SessionHiveMetaStoreClient.java:566) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
          at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
          at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:218) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at com.sun.proxy.$Proxy32.setPartitionColumnStatistics(Unknown Source) ~[?:?]
          at org.apache.hadoop.hive.ql.metadata.Hive.setPartitionColumnStatistics(Hive.java:5677) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.stats.ColStatsProcessor.persistColumnStats(ColStatsProcessor.java:221) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.stats.ColStatsProcessor.process(ColStatsProcessor.java:94) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.exec.StatsTask.execute(StatsTask.java:107) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:214) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:105) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Executor.launchTask(Executor.java:354) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Executor.launchTasks(Executor.java:327) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Executor.runTasks(Executor.java:244) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Executor.execute(Executor.java:105) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:370) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:205) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Driver.run(Driver.java:154) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.Driver.run(Driver.java:149) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:185) ~[hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:236) ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hive.service.cli.operation.SQLOperation.access$500(SQLOperation.java:90) ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.run(SQLOperation.java:340) ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_292]
          at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_292]
          at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1682) ~[hadoop-common-3.1.0.jar:?]
          at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.run(SQLOperation.java:360) ~[hive-service-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_292]
          at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_292]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_292]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_292]
          at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_292] 

       

      Attachments

        Issue Links

          Activity

            People

              VenuReddy Venugopal Reddy K
              VenuReddy Venugopal Reddy K
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m