You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to upgrade our Apache Hive we ship from version 4.0.0 to 4.0.1 as Hive 4.0.x is our LTS line.
Currently we mark 4.0.1 as experimental due to issues we encountered when we tried it.
Value
Hive 4.0.1 contains bug fixes and security patches that our customers need. Since we're committed to supporting the 4.0.x line for LTS reasons for at least until the 26.3 release, we need to provide the most stable version available in that line.
When using Hive 4.0.1 for the hive-iceberg-metastore the Spark application spark-ad fails with the error:
$ k logs spark-ad-driver
...
2025-08-29T07:49:01,678 INFO [Thread-4] hive.metastore - Connected to metastore.
Traceback (most recent call last):
File "/spark-scripts/spark-ad.py", line 13, in <module>
spark.sql("CREATE TABLE IF NOT EXISTS prediction.ad.iforest (pickup_ts TIMESTAMP, pickup_minute_group VARCHAR(4), pickup_hour INT, pickup_year INT, pickup_month INT, pickup_dayofmonth INT, pickup_dayofweek INT, norides INT, total_bill DOUBLE, avg_bill DOUBLE, norides_lag INT, pred INT) USING iceberg")
File "/stackable/spark/python/lib/pyspark.zip/pyspark/sql/session.py", line 1631, in sql
File "/stackable/spark/python/lib/py4j-0.10.9.7-src.zip/py4j/java_gateway.py", line 1322, in __call__
File "/stackable/spark/python/lib/pyspark.zip/pyspark/errors/exceptions/captured.py", line 179, in deco
File "/stackable/spark/python/lib/py4j-0.10.9.7-src.zip/py4j/protocol.py", line 326, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o77.sql.
: java.lang.RuntimeException: Failed to get table info from metastore ad.iforest
at org.apache.iceberg.hive.HiveTableOperations.doRefresh(HiveTableOperations.java:160)
...
Caused by: org.apache.thrift.TApplicationException: Invalid method name: 'get_table'
...
This is problem with Iceberg and there is an open issue for it: apache/iceberg#12878
Workaround
Patch and build Hive 2 as described in this comment . Then replace the Hive jars shipped by Spark.
Okay. My current plan would be: Continue shipping Hive 3 and 4 at the same time.
Spark/Iceberg/Hive is not something we can untangle anytime soon even if we wanted to, and we'll need to jump to later Hive versions than 4 at some point
Trino issue is something we might be able to fix upstream but that's also not going to be trivial
So, my suggestion: Follow the relevant upstream discussions and jump in and help if we can and in the meantime clearly document where Hive 3 is still needed and what works/doesn't work with Hive 4. If that is fine then I'd make two issues out of this:
I think what would be great is to have a story on downgrading. E.g. users bump 3.6.3 -> 4.0.0 or 4.0.0 -> 4.0.1 and notice that things broke.
Can they downgrade again? I recall for some tools the database migration script would panic, not sure about HMS.
I think we should add docs on downgrading as part of this issue, WDYT?
We just clarified in the lifecycle policies (or will) that downgrades are not supported.
It'd be nice to have the support but we currently just don't have the resources to test all of those paths :(
I think what would be great is to have a story on downgrading. E.g. users bump 3.6.3 -> 4.0.0 or 4.0.0 -> 4.0.1 and notice that things broke.
Can they downgrade again? I recall for some tools the database migration script would panic, not sure about HMS.
I think we should add docs on downgrading as part of this issue, WDYT?
ALTERTABLE"TAB_COL_STATS" DROP COLUMN "CAT_NAME", DROP COLUMN "DB_NAME", DROP COLUMN "TABLE_NAME";
ALTERTABLE"PART_COL_STATS" DROP COLUMN "CAT_NAME", DROP COLUMN "DB_NAME", DROP COLUMN "TABLE_NAME", DROP COLUMN "PARTITION_NAME";
UPDATE"VERSION"SET"SCHEMA_VERSION"='4.1.0', "VERSION_COMMENT"='Hive release version 4.1.0'where"VER_ID"=1;
They drop columns, which can't be restored.
Luckily, in the particular case of the customer, the TAB_COL_STATS and PART_COL_STATS tables where both empty, so we where able to re-add the columns (empty):
That way we brought the Hive metastore 4.0.0 back to live, but this is not recommended.
I created stackabletech/documentation#810 to warn users more prominently
Activity
razvan commentedon Aug 28, 2025
There seems to be no easy workaround for any of these problems. A proper fix upstream requires the Iceberg catalog model to change as described below.
Spark/Iceberg/Hive
Problem
When using Hive 4.0.1 for the
hive-iceberg-metastorethe Spark applicationspark-adfails with the error:This is problem with Iceberg and there is an open issue for it: apache/iceberg#12878
Workaround
Patch and build Hive 2 as described in this comment . Then replace the Hive jars shipped by Spark.
Spark 3.5 ships Hive 2.3.9, while Spark 4.0 ships Hive 2.3.10.
See this PR for an attempt to build Hive 2.
Trino/Hive
This comment explains the problem. Hive 4 added a new type for timestamp fields that is not supported by Trino (as of v476).
Workaround
???
sbernauer commentedon Sep 3, 2025
Just throwing in
spark.sql.hive.metastore.jars.pathIt maybe won't help, but I wanted to mention that property
lfrancke commentedon Sep 9, 2025
Okay. My current plan would be: Continue shipping Hive 3 and 4 at the same time.
So, my suggestion: Follow the relevant upstream discussions and jump in and help if we can and in the meantime clearly document where Hive 3 is still needed and what works/doesn't work with Hive 4. If that is fine then I'd make two issues out of this:
Opinions?
sbernauer commentedon Sep 10, 2025
I think what would be great is to have a story on downgrading. E.g. users bump 3.6.3 -> 4.0.0 or 4.0.0 -> 4.0.1 and notice that things broke.
Can they downgrade again? I recall for some tools the database migration script would panic, not sure about HMS.
I think we should add docs on downgrading as part of this issue, WDYT?
lfrancke commentedon Oct 2, 2025
We just clarified in the lifecycle policies (or will) that downgrades are not supported.
It'd be nice to have the support but we currently just don't have the resources to test all of those paths :(
sbernauer commentedon Nov 26, 2025
A customer was running into exactly this problem.
They upgraded from HMS 4.0.0 to 4.1.0, so the HMS ran the database migration from https://github.com/apache/hive/blob/6b361ac3582a18852a6f090a9a20f522b84c8135/standalone-metastore/metastore-server/src/main/sql/postgres/upgrade-4.0.0-to-4.1.0.postgres.sql
Some statements are especially breaking, namely
They drop columns, which can't be restored.
Luckily, in the particular case of the customer, the
TAB_COL_STATSandPART_COL_STATStables where both empty, so we where able to re-add the columns (empty):That way we brought the Hive metastore 4.0.0 back to live, but this is not recommended.
I created stackabletech/documentation#810 to warn users more prominently