apache / apache/paimon

[Bug] can not exec `Adding Column Position` in hive catalog

Open
#1,542 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
3.4k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
396

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/incubator-paimon/issues) and found nothing similar.

### Paimon version

master

### Compute Engine

flink

### Minimal reproduce step

```

Flink SQL> show create table t001;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| result |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| CREATE TABLE `paimon_hive_catalog`.`test`.`t001` (
`user_id` BIGINT NOT NULL,
`item_id` BIGINT,
`behavior` VARCHAR(2147483647),
`dt` VARCHAR(2147483647) NOT NULL,
`hh` VARCHAR(2147483647) NOT NULL,
CONSTRAINT `d6963365-a209-47e5-8dd0-774b0e4a684d` PRIMARY KEY (`dt`, `hh`, `user_id`) NOT ENFORCED
) PARTITIONED BY (`dt`, `hh`)
WITH (
'bucket' = '1',
'path' = 'hdfs://localhost/user/hive/warehouse/test.db/t001'
)
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set

Flink SQL> alter table t001 add id int first;
[ERROR] Could not execute SQL statement. Reason:
InvalidOperationException(message:The following columns have types incompatible with the existing columns in their respective positions :
id,item_id)

```

### What doesn't meet your expectations?

it throws an exccption .

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided Flink SQL against a Hive catalog, starting with SHOW CREATE TABLE and ALTER TABLE ... ADD ... FIRST. Trace the catalog/schema-change handling for column positions; done means adding the column before item_id succeeds without the incompatible-types exception and preserves the intended column order.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.