AsukaMilet
11/03/2025, 7:35 AMdep, and I've run into a bug related to Hive views. I found that its maintainer is you, but the GitHub repo seems to no longer exist. I'd like to know if it's no longer maintained? If so, where can I find its source code?criccomini
11/03/2025, 3:18 PMcriccomini
11/03/2025, 3:18 PMcriccomini
11/03/2025, 3:19 PMcriccomini
11/03/2025, 3:19 PMAsukaMilet
11/03/2025, 3:35 PMcriccomini
11/03/2025, 4:54 PMAsukaMilet
11/03/2025, 5:23 PMAsukaMilet
11/04/2025, 1:59 AMAsukaMilet
11/04/2025, 2:40 AMserializationLib to be null.
https://cdn.discordapp.com/attachments/1434808177374920714/1435096384565936242/2025-11-04_10.32.31.jpg?ex=690ab928&is=690967a8&hm=65bc89b5fc47e1e5ee9339e7a014f92113319e9235a8d697c7f11fdfaba8119b&criccomini
11/04/2025, 3:04 AMcriccomini
11/04/2025, 3:04 AMcriccomini
11/04/2025, 3:04 AMAsukaMilet
11/04/2025, 3:15 AMcriccomini
11/04/2025, 3:17 AMcriccomini
11/04/2025, 3:17 AMcriccomini
11/04/2025, 3:18 AMcriccomini
11/04/2025, 3:20 AMcriccomini
11/04/2025, 3:28 AMcriccomini
11/04/2025, 3:30 AMcriccomini
11/04/2025, 3:41 AMcriccomini
11/04/2025, 3:43 AMpdm style on it?criccomini
11/04/2025, 3:45 AMAsukaMilet
11/04/2025, 3:52 AMAsukaMilet
11/04/2025, 3:58 AMserdeLib info required to be nonNull during writing; I will be able to fix it quickly after attending company meeting.criccomini
11/04/2025, 4:11 AMcriccomini
11/04/2025, 4:11 AMcriccomini
11/04/2025, 4:12 AMcriccomini
11/04/2025, 4:14 AMβ’ Understood. I reverted the test back to using a null SerDeInfo and updated the code to support it end-to-end without failing.
What I changed
- Thrift client normalization
- pymetastore/hive_metastore/ThriftHiveMetastore.py: send_create_table, send_create_table_with_environment_context, send_create_table_with_constraints
- If tbl.sd.serdeInfo is None, inject a minimal default SerDeInfo:
- serializationLib='org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
- parameters={}
- This avoids server-side MetaException rejections while letting callers pass None in Python.
- HMS parsing improvements
- pymetastore/metastore.py: get_table conversion
- Accepts completely missing serdeInfo for VIRTUAL_VIEW tables (sets serde=None in StorageFormat).
- Accepts serdeInfo with missing serializationLib for views and treats it as None.
- Allows missing serdeInfo.parameters by treating them as {} instead of raising.
- This ensures our model handles views with null SerDeInfo cleanly.
- Test fixture
- tests/integration/test_metastore.py:352
- Uses serdeInfo=None for the VIRTUAL_VIEW storage descriptor again (as originally intended).
Why this solves it
- You can now create a view with serdeInfo=None in tests without tripping the Metastoreβs validation, since the client fills a minimal valid SerDeInfo at send time.
- The HMS wrapper properly tolerates and represents the absence of SerDe info for views.
How to verify
- Run: pytest -q tests/integration/test_metastore.py
- Requires a running Hive Metastore at localhost:9083 (or set HMS_HOST/HMS_PORT).
If you want, I can also make the same serdeInfo normalization available via an explicit helper in our higher-level API, but with these changes the tests and normal usage
should already pass.criccomini
11/04/2025, 4:14 AMlazy.LazySimpleSerDe if None is set.criccomini
11/04/2025, 4:14 AMcriccomini
11/04/2025, 5:14 AMindex f93dcfa..a8c82d8 100644
--- a/pymetastore/metastore.py
+++ b/pymetastore/metastore.py
@@ -446,13 +446,13 @@ class HMS:
raise TypeError(
f"Expected serializationLib to be str, got {type(table.sd.serdeInfo.serializationLib)}"
)
- else:
+ elif table.tableType == "VIRTUAL_VIEW":
# See #39 and #40 for details
- if table.tableType != "VIRTUAL_VIEW":
- raise TypeError(
- f"Expected serdeInfo to be str, got {type(table.sd.serdeInfo)}"
- )
serde = None
+ else:
+ raise TypeError(
+ f"Expected serdeInfo to be str, got {type(table.sd.serdeInfo)}"
+ )
else:
raise TypeError(
f"Expected serdeInfo to be SerDeInfo, got {type(table.sd.serdeInfo)}"criccomini
11/04/2025, 5:15 AMcriccomini
11/04/2025, 5:23 AMcriccomini
11/04/2025, 5:24 AMTable has StorageDescriptor sd which has SerDeInfo serdeInfocriccomini
11/04/2025, 5:32 AMserde_info instead of None (and left a comment). https://github.com/criccomini/pymetastore/pull/40/commits/420d69e9c6568116a36d47a67cf7df8a7783b409criccomini
11/04/2025, 5:34 AMAsukaMilet
11/04/2025, 5:35 AMserdeInfo because all its information is stored in the original sql field.AsukaMilet
11/04/2025, 5:36 AMAsukaMilet
11/04/2025, 5:37 AMcriccomini
11/04/2025, 5:37 AMcriccomini
11/04/2025, 5:38 AMcriccomini
11/04/2025, 5:38 AMAsukaMilet
11/04/2025, 5:41 AMcriccomini
11/04/2025, 5:42 AMcriccomini
11/04/2025, 5:42 AMcriccomini
11/04/2025, 5:43 AM