Skip to content

feat: Add logic to add non-primitive types to alter table add column#183

Merged
subkanthi merged 4 commits into
masterfrom
add_alter_table_list_map_struct
Jun 30, 2026
Merged

feat: Add logic to add non-primitive types to alter table add column#183
subkanthi merged 4 commits into
masterfrom
add_alter_table_list_map_struct

Conversation

@subkanthi

@subkanthi subkanthi commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

closes: #185

@subkanthi subkanthi requested a review from xieandrew June 29, 2026 17:24
@subkanthi

Copy link
Copy Markdown
Collaborator Author
alter-table flowers.iris \
  '[{"op":"add_column","name":"tags","type":"list<string>","after":"petal.width"}]'
alter-table flowers.iris \
  '[{"op":"add_column","name":"metadata","type":"map<string,long>"}]'
 alter-table flowers.iris \
  '[{"op":"add_column","name":"address","type":"struct<street:string,zip:int>"}]'
>>> from pyiceberg.catalog import load_catalog
...
... catalog = load_catalog("default", **{
...     "uri": "http://localhost:5000",
...     "token": "foo",
...     "s3.endpoint": "http://localhost:9000",
...     "s3.access-key-id": "miniouser",
...     "s3.secret-access-key": "miniopassword",
...     "s3.region": "us-east-1",
...     "s3.path-style-access": "true",
... })
... table = catalog.load_table("flowers.iris")
...
... import pyarrow as pa
...
... schema = pa.schema([
...     ("sepal.length", pa.float64()),
...     ("sepal.width", pa.float64()),
...     ("petal.length", pa.float64()),
...     ("petal.width", pa.float64()),
...     ("variety", pa.string()),
...     ("tags", pa.list_(pa.string())),
...     ("metadata", pa.map_(pa.string(), pa.int64())),
...     ("address", pa.struct([
...         ("street", pa.string()),
...         ("zip", pa.int32()),
...     ])),
... ])
...
... df = pa.table({
...     "sepal.length": [6.0],
...     "sepal.width": [3.0],
...     "petal.length": [4.5],
...     "petal.width": [1.5],
...     "variety": ["Versicolor"],
...     "tags": [["red", "tall"]],
...     "metadata": [[("count", 42)]],
...     "address": [{"street": "123 Main St", "zip": 90210}],
... }, schema=schema)
...
... table.append(df)

@subkanthi subkanthi marked this pull request as ready for review June 29, 2026 17:25
@xieandrew xieandrew changed the title Added logic to add non-primitive types to alter table add column. feat: Add logic to add non-primitive types to alter table add column Jun 29, 2026

@xieandrew xieandrew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic and tests look good to me

@xieandrew xieandrew added the ice Relates to ice label Jun 29, 2026
@subkanthi subkanthi merged commit afbed65 into master Jun 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ice Relates to ice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ice: Support for Alter Table add column (Non-primitive types)

2 participants