You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/11/10 19:26:19 UTC

[GitHub] [hudi] Frogglet opened a new issue #3965: [SUPPORT] Upserts results in truncated milliseconds from timestamps

Frogglet opened a new issue #3965:
URL: https://github.com/apache/hudi/issues/3965


   **Describe the problem you faced**
   
   This issue seems distinct from issue https://github.com/apache/hudi/issues/3429 because it involves loss of millisecond precision, not just microsecond precision.
   
   We are using the Spark-hive integration on EMR. Initially we are running a bulk insert to get the data in place. Among the columns are a few timestamp columns with millisecond precision. After the bulk insert all is well. Then we run an upsert on the latest partition. After performing the upsert, the resulting data has some issues. In the rows that were updated/inserted, all is still well, but rows that were not touched by the upsert now have their timestamp columns truncated all the way down to seconds instead of milliseconds. We are setting the `CLEANER_FILE_VERSIONS_RETAINED_PROP` setting to `1`, to ensure that only the most recent file is in place, so it appears whenever the old data from the old file is brought over, these timestamp columns are being truncated for some reason.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   
   1. Bulk insert data with millisecond timestamp columns into a CoW table.
   2. Run an upsert that doesn't touch every row in the partition.
   3. Observe that rows that weren't touched by the upsert now have their timestamps truncated to the second instead of millisecond
   
   **Expected behavior**
   
   Expected behavior should be to retain the millisecond precision of the timestamp columns
   
   **Environment Description**
   
   * Hudi version : 0.8.0-amzn-0
   
   * Spark version : 3.1.2
   
   * Hive version : 3.1.2
   
   * Hadoop version : 3.2.1
   
   * Storage (HDFS/S3/GCS..) : S3
   
   * Running on Docker? (yes/no) : no
   
   
   **Additional context**
   
   Some possibly relevant general settings:
   
   ```
         DataSourceWriteOptions.TABLE_TYPE_OPT_KEY -> "COPY_ON_WRITE",
         HoodieCompactionConfig.CLEANER_FILE_VERSIONS_RETAINED_PROP -> "1",
         HoodieCompactionConfig.CLEANER_POLICY_PROP -> HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS.name()
   ```
   
   Settings specific to the initial bulk insert:
   
   ```
           .option(DataSourceWriteOptions.OPERATION_OPT_KEY, DataSourceWriteOptions.BULK_INSERT_OPERATION_OPT_VAL)
           .option(DataSourceWriteOptions.ENABLE_ROW_WRITER_OPT_KEY, "true")
           .option(HoodieWriteConfig.BULKINSERT_SORT_MODE, BulkInsertSortMode.PARTITION_SORT.name())
           .mode(SaveMode.Overwrite)
           .save(outputLocation)
   ```
   
   
   Settings specific to the upsert:
   
   ```
           .option(DataSourceWriteOptions.OPERATION_OPT_KEY, DataSourceWriteOptions.UPSERT_OPERATION_OPT_VAL)
           .mode(SaveMode.Append)
           .save(outputLocation)
   ```
   
   
   `enableHiveSupport` is being called on the spark session builder. 
   
   `'spark.sql.legacy.parquet.int96RebaseModeInWrite=CORRECTED'` is being set in configuration of the EMR cluster to avoid Spark 3.0 errors on timestamps from before 1900.
   
   Any help on how to avoid this issue would be greatly appreciated.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-1047400781


   Closing this due to no activity for the past 3+ months. 


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan removed a comment on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan removed a comment on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-998380572


   could be related: hudi use avro logical type with time millis(spark default), so that they differ in percison by 3
   Related issue: https://github.com/apache/hudi/issues/3429
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-998380572


   hudi use avro logical type with time millis(spark default), so that they differ in percison by 3
   Related issue: https://github.com/apache/hudi/issues/3429
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] YannByron commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
YannByron commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-1040294984


   @Frogglet According to the steps you provide, I think it's same to https://github.com/apache/hudi/issues/3429. Can you set `hoodie.parquet.outputtimestamptype` to `TIMESTAMP_MICROS` and retry the whole steps.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-1018601204


   @Frogglet : gentle ping 


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan closed issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan closed issue #3965:
URL: https://github.com/apache/hudi/issues/3965


   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-997091385


   @Frogglet : Can you respond to my above question. 
   Also, can you tell us whats the resultant column's schema in hudi after insert and after upsert? Can you try reading as parquet and let us know whats the data type. guess in hive its bigint. 
   
   Also, can you give us the configs you set for writing. especially interested in the key generator configs. I will try to reproduce on my end. 
   
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan edited a comment on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan edited a comment on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-998380572


   could be related: hudi use avro logical type with time millis(spark default), so that they differ in percison by 3
   Related issue: https://github.com/apache/hudi/issues/3429
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] Frogglet edited a comment on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
Frogglet edited a comment on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-965950614


   @xushiyan Hey, I'm using AWS Glue for my Hive metastore, and according to glue the type for these timestamps is just "bigint". So, it's not changing the schema, it is just integer-dividing by 1000. For example, before this change, a value might be `1628643404092`, which is a unix timestamp in milliseconds. After my upsert, if that row was affected the value would become `1628643404`, losing the millisecond information.
   
   One source for these timestamps for me is just calling the sparksql builtin `current_timestamp()`. Also I should have mentioned I have hive syncing turned on.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] xushiyan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
xushiyan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-965932515


   > a few timestamp columns with millisecond precision
   
   @Frogglet can you also share the schema you're dealing with pls? When you see the timestamps being truncated, did you mean the hive table schema changed? so it's likely due to some hive sync issue


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] Frogglet edited a comment on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
Frogglet edited a comment on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-965950614


   @xushiyan Hey, I'm using AWS Glue for my Hive metastore, and according to glue the type for these timestamps is just "bigint". So, it's not changing the schema, it is just integer dividing by 1000. For example, before this change, a value might be `1628643404092`, which is a unix timestamp in milliseconds. After my upsert, if that row was affected the value would become `1628643404`, losing the millisecond information.
   
   One source for these timestamps for me is just calling the sparksql builtin `current_timestamp()`. Also I should have mentioned I have hive syncing turned on.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] Frogglet commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
Frogglet commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-965950614


   @xushiyan Hey, I'm using AWS Glue for my Hive metastore, and according to glue the types for these timestamps is just "bigint". So, it's not changing the schema, it is just integer dividing by 1000. For example, before this change, a value might be `1628643404092`, which is a unix timestamp in milliseconds. After my upsert, if that row was affected the value would become `1628643404`, losing the millisecond information.
   
   One source for these timestamps for me is just calling the sparksql builtin `current_timestamp()`. Also I should have mentioned I have hive syncing turned on.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] YannByron commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
YannByron commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-1040294984


   @Frogglet According to the steps you provide, I think it's same to https://github.com/apache/hudi/issues/3429. Can you set `hoodie.parquet.outputtimestamptype` to `TIMESTAMP_MICROS` and retry the whole steps.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-991847044


   @Frogglet : bulk_insert row writer had some issues around timestamp. did you query your dataset after bulk_insert and before upsert to ensure data is intact? 
   
   Also, can you try setting 
   ```
   .option(DataSourceWriteOptions.ENABLE_ROW_WRITER_OPT_KEY, "false")
   ```
   and let us know what you see. 
   
   And I don't think cleaner has anything to do with the issue you are reporting. 


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #3965: [SUPPORT] Upserts result in truncated milliseconds from timestamps

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #3965:
URL: https://github.com/apache/hudi/issues/3965#issuecomment-1031433122


   @Frogglet : Can you please respond us w/ more info. w/o further info, it will be tough to debug this further. 
   @YannByron : could be related to the other ticket you are triaging. would you mind following up on this as well ? 


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org