feat: Add metadata flag to identify Hive partition keys
Right now, the Hive connector mixes partition keys (like year or country in the folder path) with the actual data columns inside the files. It’s annoying because you can't tell which columns are for filtering/partitioning and which ones are just regular data. This makes it hard to write efficient queries or know how the table is actually organized.
Describe the solution you'd like Make the connector "smart" enough to label partition keys. When I look at the table schema, it should clearly show which columns are partitions. Ideally, it should prevent users from accidentally trying to update a partition key like a normal piece of data.
hi sir I’ve reviewed the issue and have an idea for the fix. I’d like to work on this. Please assign it to me.
@m0hitbansal I would like to work on this issue. Can you please assign it to me?
@m0hitbansal I have pushed a pr please review I would like to work on this issue please assign me
@m0hitbansal I have pushed a pr please review I would like to work on this issue please assign me
Hi @m0hitbansal @harshach ! I'd like to take this on — could you assign it to me? Thanks!
hi @harshach and @TeddyCr, i would like to work on this. Please assign it to me
Hi @m0hitbansal 👋
I'd like to work on this issue.
My approach: Implement get_table_partition_details() in HiveSource that parses DESCRIBE FORMATTED output to extract partition columns, with a robust section-exit parser and metastore-connection awareness to avoid false positives. Will include unit tests covering all edge cases.
Requesting assignment. Starting work now!
I'd love to work on this
Hi @m0hitbansal , it would be helpful for devs to RCA, if u could provide any screenshot or screen recording of this issue. @PubChimps I would like to contribute to resolve this issue if get assigned.
Hi, I'd like to work on this issue. can i get assigned?
Hi @m0hitbansal @ulixius9 👋
I'd like to work on issue #26712.
My Approach:
Implement get_table_partition_details() in HiveSource with
a production-grade DESCRIBE FORMATTED parser that:
- Correctly exits the partition section when the next section
header is encountered — preventing false positives like
Database:,Owner:,Location:being picked up as partition keys - Handles metastore connection (MySQL/Postgres) as a separate
path by querying the metastore
PARTITION_KEYStable directly instead of runningDESCRIBE FORMATTEDagainst a non-Hive engine - Gracefully falls back with a warning if partition detection fails — zero impact on existing ingestion
- Includes complete unit tests covering: tables with partitions, tables without partitions, metastore connection path, parser section-exit correctness, and failure fallback
I have studied the existing Copilot review comments on PR #27029 and #27278 and my implementation directly addresses all flagged issues.
Requesting assignment. Starting work now!
Hi @m0hitbansal and @PubChimps
I’ve analyzed the requirements for identifying Hive partition keys and reviewed the existing PRs (#27029 and #27278). I’d like to take this on with a focus on making the detection robust across different environments.
My proposed approach:
Parser Logic: Implement a refined DESCRIBE FORMATTED parser in HiveSource that strictly identifies the # Partition Information section to avoid false positives from other metadata headers (like Owner or Location).
Metastore Support: Ensure compatibility for users connecting directly to the metastore (MySQL/Postgres) by querying PARTITION_KEYS where available.
Validation: Add unit tests covering partitioned vs. non-partitioned tables to ensure zero regression for existing ingestion workflows.
I'm ready to start immediately. Could you please assign this to me?
Hi! I'd like to work on this issue. Could you please assign it to me? I'm participating in the hackathon (Apr 17–26) and this fits well with my connector work. Thanks! @m0hitbansal
Hi, I’d like to work on this issue. I’ll start working on it.
Hi @m0hitbansal
I went through the issue and also noticed there is an active PR (#27029) addressing this.
The idea of introducing a metadata flag to distinguish Hive partition keys from regular columns makes a lot of sense, especially for improving query clarity and preventing incorrect updates.
If there’s still room for contribution, I’d be happy to help with:
- Adding/expanding test coverage for partition key identification
- Validating edge cases (e.g., nested partitions or missing metadata)
- Improving API/schema representation for better usability
Please let me know if I can contribute alongside the existing work. Happy to assist
Hi @m0hitbansal @harshach @TeddyCr,
I'd like to work on this issue. I've done a thorough analysis of the problem, the existing codebase, and the two open PRs (#27029 and #27278). Here's my understanding and proposed approach:
Problem:
The Hive connector currently mixes partition keys (e.g., year, country in HDFS folder paths) with regular data columns in the schema. Users can't distinguish which columns are for partitioning vs. actual data, making it hard to write efficient queries or understand table organization.
Proposed Approach — Hybrid Strategy:
I plan to modify ingestion/src/metadata/ingestion/source/database/hive/metadata.py with a two-tier detection strategy:
Tier 1 — Direct Metastore Query (primary, high accuracy):
Query the PARTITION_KEYS table in the Hive metastore directly, joined with TBLS and DBS to identify partition columns by table/schema name. This handles both MySQL and Postgres metastore backends with database-agnostic identifier quoting (backticks for MySQL, double-quotes for Postgres).
# Pseudocode
query = """
SELECT pk.PKEY_NAME
FROM PARTITION_KEYS pk
JOIN TBLS tbl ON pk.TBL_ID = tbl.TBL_ID
JOIN DBS db ON tbl.DB_ID = db.DB_ID
WHERE db.NAME = :schema AND tbl.TBL_NAME = :table_name
ORDER BY pk.INTEGER_IDX
"""
Tier 2 — DESCRIBE FORMATTED Fallback (if metastore not directly accessible):
Parse DESCRIBE FORMATTED <schema>.<table> output with a strict state machine — enter partition section on # Partition Information header, extract column names, and exit on the next section header (e.g., # Detailed Table Information). This avoids false positives from other metadata headers.
Integration with OpenMetadata Model:
Build TablePartition objects using PartitionColumnDetails and attach them to the table entity:
TablePartition(
partition_columns=[
PartitionColumnDetails(column_name="year", interval_type=PartitionIntervalTypes.YEARLY),
PartitionColumnDetails(column_name="country", interval_type=None),
]
)
Error Handling:
- If metastore query fails → fallback to DESCRIBE FORMATTED with a warning log
- If both fail → return
None, log a debug message, and continue ingestion (never break existing workflows)
Testing Plan:
- Unit tests for metastore query construction (MySQL + Postgres quoting)
- Unit tests for DESCRIBE FORMATTED parser (correct section detection, edge cases)
- Tests for tables with no partitions, single partition, multiple partitions
- Fallback logic tests (metastore fail → DESCRIBE succeed, both fail → graceful None)
I have experience with Python async programming, REST APIs, and database connectors. I've studied both PRs #27029 and #27278 to understand what's been tried and where the review comments point to improvements. I can deliver a clean, well-tested PR.
Could you please assign this to me? Thank you!
@m0hitbansal @PubChimps
Hi! I'd love to work on this issue and would like to get assigned to it. 🙋
I have gone through the issue description carefully and I'm confident I can tackle it effectively. I'm actively contributing to OpenMetadata and this looks like a great fit for me.
Could you please assign this issue to me? Thank you! 🚀
Hi @harshach @m0hitbansal — I'd like to pick up another ingestion-framework issue before the hackathon ends.
I see #27029 and #27278 were opened for this but didn't land. Happy to take a fresh pass if this is still open.
Proposed approach (two-tier, similar in spirit to yubarajDas's earlier comment):
-
Primary — direct metastore query. For users whose connection points at the Hive metastore backend (MySQL/Postgres), query
PARTITION_KEYSjoined withTBLSandDBSto get partition columns with correct ordering (INTEGER_IDX). Handles quoting differences between MySQL (backticks) and Postgres (double-quotes). -
Fallback —
DESCRIBE FORMATTEDparser. For HiveServer2 connections where the metastore isn't directly reachable, parseDESCRIBE FORMATTED <schema>.<table>with a strict state machine: enter on# Partition Information, exit on the next#section header. This is the part earlier PRs tripped on — false positives fromOwner:/Location:lines. -
Model mapping. Build
TablePartitionwithPartitionColumnDetailsper column and attach to the table entity during ingestion. -
Graceful degradation. Any failure logs a warning and returns
None— never breaks existing ingestion for users without partitioned tables.
Tests: partitioned and non-partitioned tables, multi-column partitions, both metastore backends (quoting), parser section-exit correctness, and the fallback path when the metastore query fails.
I'll review the review comments on #27029 and #27278 before writing anything so I don't repeat the same mistakes. Timeline: draft PR within 2 days of assignment.
Could you assign this to me?
Hi @m0hitbansal @harshach — I've opened PR #27731 with a clean implementation of the partition key flag.
What's in the PR:
_get_partition_column_names(): strict state-machine parser forDESCRIBE FORMATTEDoutput — enters on# Partition Information, exits on the next#-prefixed section header to avoid false positives fromOwner:/Location:rows.get_columnsnow attachesis_partition_column=Trueto partition key columns. Non-partitioned tables getFalse— no regression.get_table_partition_details()inHiveSourcebuilds aTablePartitionwithPartitionColumnDetailsper key usingPartitionIntervalTypes.COLUMN_VALUE. Returns(False, None)gracefully on failure.- 8 unit tests in
TestHivePartitionKeyFlagcovering all edge cases.
Could you please assign this issue to me? Thank you!
hi, can i work on this issue?