VenuReddy2103 opened a new pull request, #4050:
URL: https://github.com/apache/hive/pull/4050

   ### What changes were proposed in this pull request?
   Used `preparedStatement.setBytes()` to set the histogram.
   
   ### Why are the changes needed?
   `java.sql.BatchUpdateException` thrown from 
`DirectSqlUpdateStat.insertIntoPartColStatTable()` with SQL Server db when 
histogram statistics is not enabled.
   
   **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]`
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   Tested manually with SQL Server
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to