iceberg icon indicating copy to clipboard operation
iceberg copied to clipboard

Field comments are not written for timestamp field

Open itaise opened this issue 3 years ago • 7 comments

We are trying to write field comments using spark, and comments are not written for timestamp (without tz) fields. For timestamp with timezone fields comments are written.

Here is a minimal example that reproduces the issue:

from pyspark.sql import SparkSession

spark = SparkSession.builder.master('local[1]').appName('example') \
    .config("spark.sql.iceberg.use-timestamp-without-timezone-in-new-tables", "true") \
    .getOrCreate()

field_metadata = {'comment': '{"is_test": true}'}

df = spark.sql("select CAST(1000 AS TIMESTAMP)")

df = df.select([df[col_name].alias('some_field', metadata=field_metadata) for col_name in df.columns])

spark.sql(f"use iprod")  # catalog
spark.sql(f"CREATE SCHEMA IF NOT EXISTS iprod.test_schema")

df.write.mode("overwrite").format("iceberg").saveAsTable("iprod.test_schema.timestamp_example")

When the config (use-timestamp-without...) is set to true, the data type is Timestamp, but without the field comments. When it is set to False - The timestamp is with time zone and with field comments.

(Spark version is 3.1.2)

Thanks a lot!

itaise avatar Feb 23 '22 21:02 itaise

@rdblue mentioned that field comments are supported for timestamps. Might be an issue with this config?

itaise avatar Feb 25 '22 04:02 itaise

@rdblue we will be very grateful to get your input on this. thank you!

itaise avatar Mar 08 '22 09:03 itaise

@rdblue can you or anyone else advise regarding that? thank you!

itaise avatar May 22 '22 05:05 itaise

@itaise, it looks like you're saving the table as Parquet, not Iceberg. That could be a problem.

rdblue avatar Jul 06 '22 15:07 rdblue

Thanks you @rdblue, I tried with "iceberg" instead of parquet, and got the same results. We would like to write the field comments to "timestamp without tz" field, any other suggestion?

itaise avatar Jul 07 '22 03:07 itaise

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Apr 29 '23 00:04 github-actions[bot]

Hi, there is any update regarding the issue?

ariksa1 avatar Jun 24 '24 13:06 ariksa1

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Feb 03 '25 00:02 github-actions[bot]

This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'

github-actions[bot] avatar Feb 17 '25 00:02 github-actions[bot]