alex-shchetkov opened a new issue #3088:
URL: https://github.com/apache/iceberg/issues/3088
Expectation: Using `writeTo().partitionedBy("x")` creates a partitioned table
Reality: `writeTo().partitionedBy("x")` creates a partitioned-less table
Quick Repro, using iceberg version 0.12:
```
df = spark.createDataFrame([{"col1": "two", "tenant_id": "123"},
{"col1": "four", "tenant_id": "456"}])
writer = (df
.sortWithinPartitions("tenant_id")
.writeTo(f"iceberg.ice_db.local_partition_test")
.partitionedBy(
"tenant_id"
)
.create()
)
```
The above creates a partitionless table:
```
"partition-spec" : [ ],
"default-spec-id" : 0,
"partition-specs" : [ {
"spec-id" : 0,
"fields" : [ ]
} ],
```
------
Works fine when using sql directly:
```
df.createOrReplaceGlobalTempView("partition_test")
spark.sql(f"""
create table iceberg.ice_db.local_partition_test2 using iceberg
PARTITIONED BY (tenant_id)
as select * from global_temp.partition_test order by tenant_id
""").show()
```
Produces:
```
"partition-spec" : [ {
"name" : "tenant_id",
"transform" : "identity",
"source-id" : 2,
"field-id" : 1000
} ],
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]