denys-tyshetskyy opened a new issue #4552:
URL: https://github.com/apache/hudi/issues/4552


   **_Tips before filing an issue_**
   
   - Have you gone through our [FAQs](https://hudi.apache.org/learn/faq/)?
   
   - Join the mailing list to engage in conversations and get faster support at 
[email protected].
   
   - If you have triaged this as a bug, then file an 
[issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.
   
   **Describe the problem you faced**
   
   I am using hudi as a part of Glue jobs to manage data mutations in our data 
lake. The only modification that is being applied during the ETL from raw to 
bronze (where hudi is involved) is introduction of timestamp field that 
transforms date in seconds field from raw (ie 1602297930 -> 2020-10-10 
02:45:30.000). I have noticed that for some entities, after subsequent 
ingestions, the timestamp field value becomes corrupted (even for the records 
that are not present in the update). I managed to isolate the bulk_insert as a 
source of the issue. The timestamp field gets reset to 1970-01-01 19:45:30.000. 
Just to note, when insert is being used in place of bulk_insert for the initial 
ingest, the issue is not occurring.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   Unfortunately it is pretty tricky to reproduce and it is only happening to 2 
types of entities out of 16 we are using.
   We are moving stripe data into the data lake and the entities that do get 
issues are (https://stripe.com/docs/api/invoices and 
https://stripe.com/docs/api/customers
   1. Create AWS Glue ETL job with hudi config
           `hudi_options = {
               "hoodie.table.create.schema": "default",
               "hoodie.table.name": tableName,
               "hoodie.datasource.write.recordkey.field": "id",
               "hoodie.datasource.write.keygenerator.class": 
"org.apache.hudi.keygen.ComplexKeyGenerator",
               "hoodie.datasource.write.partitionpath.field": "field_1, 
field_2",
               "hoodie.datasource.hive_sync.partition_extractor_class": 
"org.apache.hudi.hive.MultiPartKeysValueExtractor",
               "hoodie.datasource.hive_sync.partition_fields": "field_1, 
field_2",
               'hoodie.cleaner.policy': 'KEEP_LATEST_COMMITS',
               'hoodie.cleaner.commits.retained': 10,
               "hoodie.datasource.write.table.name": tableName,
               "hoodie.datasource.write.operation": "bulk_insert",
               "hoodie.parquet.compression.codec": "snappy",
               "hoodie.datasource.hive_sync.enable": "true",
               "hoodie.datasource.hive_sync.use_jdbc": "false",
               'hoodie.datasource.hive_sync.support_timestamp': "true",
               "hoodie.datasource.write.precombine.field": "lastupdate",
               "hoodie.datasource.hive_sync.database": f"{database_name}",
               "hoodie.datasource.hive_sync.table": tableName,
           }`
   The transformation of the raw data looks as following:
   `sparkDF = dfc.select(list(dfc.keys())[0]).toDF()
   transformed = sparkDF.select("*", 
from_unixtime(col("created")).cast("timestamp").alias("created_ts"))
   resolvechoice4 = DynamicFrame.fromDF(transformed, glueContext, 
"transformedDF")
   return DynamicFrameCollection({"CustomTransform0": resolvechoice4}, 
glueContext)`
   
   2. Write data to data lake
   `sparkDF.write.format("hudi").options(**hudi_options).mode("overwrite").save(
               basePath
           )`
   3. Update the previously mentioned hudi config with write operation to 
become upsert. Update spark mode to append
   4. Trigger Glue job again with updates
   
   **Expected behavior**
   
   I expect the data to remain consistent and the fields to represent the 
relevant info
   
   **Environment Description**
   
   * Hudi version : 0.9.0
   
   * Spark version : 3.1
   
   * Hive version : Using Glue data catalogue as hive metastore
   
   * Hadoop version : N/A
   
   * Glue version: 3
   
   * Storage (HDFS/S3/GCS..) : S3
   
   * Running on Docker? (yes/no) :
   
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   There is no error
   
   


-- 
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]


Reply via email to