# Hive partition column value silently overwritten to NULL during dynamic partition insert

- **ID:** `data/hive-partition-column-null-overwrite`
- **Domain:** data
- **Category:** data_error
- **Error Code:** `HIVE-16997`
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

When using dynamic partitioning in Hive INSERT OVERWRITE, the partition column in the SELECT clause is misinterpreted as a regular column if the partition column name matches a column being inserted, causing the partition value to be overwritten to NULL.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Apache Hive 3.1.2 | active | — | — |
| Apache Hive 4.0.0-alpha-1 | active | — | — |
| CDH 6.3.2 | active | — | — |

## Workarounds

1. **Explicitly list the partition column in the SELECT clause with a different alias or use static partition assignment in the INSERT statement.** (92% success)
   ```
   Explicitly list the partition column in the SELECT clause with a different alias or use static partition assignment in the INSERT statement.
   ```
2. **Use INSERT INTO with explicit partition specification instead of INSERT OVERWRITE, then manually clean duplicates.** (75% success)
   ```
   Use INSERT INTO with explicit partition specification instead of INSERT OVERWRITE, then manually clean duplicates.
   ```

## Dead Ends

- **** — Nonstrict mode bypasses validation but does not fix the column mapping, so data is still overwritten. (95% fail)
- **** — Hive's column resolution is based on names, not positions, so extra columns cause schema mismatch. (80% fail)
