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 2022/12/19 02:52:30 UTC
[GitHub] [hudi] gaoshihang opened a new issue, #7503: Failed to read schema while doing delete_partition operation
gaoshihang opened a new issue, #7503:
URL: https://github.com/apache/hudi/issues/7503
**Describe the problem you faced**
When I do a delete_partition operation, during the sync-hive phase, this Exception will be thrown:
**And only happens when the files to be deleted are the last committed data files.**
```
User class threw exception: org.apache.hudi.exception.HoodieException: Got runtime exception when hive syncing pgao_test_delete_partition_1
at org.apache.hudi.hive.HiveSyncTool.syncHoodieTable(HiveSyncTool.java:118)
at org.apache.hudi.HoodieSparkSqlWriter$.syncHive(HoodieSparkSqlWriter.scala:539)
at org.apache.hudi.HoodieSparkSqlWriter$.$anonfun$metaSync$2(HoodieSparkSqlWriter.scala:595)
at org.apache.hudi.HoodieSparkSqlWriter$.$anonfun$metaSync$2$adapted(HoodieSparkSqlWriter.scala:591)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at org.apache.hudi.HoodieSparkSqlWriter$.metaSync(HoodieSparkSqlWriter.scala:591)
at org.apache.hudi.HoodieSparkSqlWriter$.commitAndPerformPostOperations(HoodieSparkSqlWriter.scala:665)
at org.apache.hudi.HoodieSparkSqlWriter$.write(HoodieSparkSqlWriter.scala:286)
at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:164)
at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:46)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:90)
at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:180)
at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:218)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:215)
at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:176)
at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:127)
at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:126)
at org.apache.spark.sql.DataFrameWriter.$anonfun$runCommand$1(DataFrameWriter.scala:962)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:100)
at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:160)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:87)
at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:767)
at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:64)
at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:962)
at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:414)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:398)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:287)
at tv.freewheel.reporting.river.spark.engine.RiverSparkBatchEngineContext.standardSinkingToHudi(RiverSparkBatchEngineContext.java:188)
at tv.freewheel.reporting.river.common.engine.RiverEngineContext.sinkToHudi(RiverEngineContext.java:131)
at tv.freewheel.reporting.river.core.RiverMain.main(RiverMain.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:728)
Caused by: org.apache.hudi.sync.common.HoodieSyncException: Failed to read data schema
at org.apache.hudi.sync.common.AbstractSyncHoodieClient.getDataSchema(AbstractSyncHoodieClient.java:158)
at org.apache.hudi.hive.HiveSyncTool.syncHoodieTable(HiveSyncTool.java:171)
at org.apache.hudi.hive.HiveSyncTool.doSync(HiveSyncTool.java:129)
at org.apache.hudi.hive.HiveSyncTool.syncHoodieTable(HiveSyncTool.java:115)
... 37 more
Caused by: java.lang.IllegalArgumentException: Failed to read schema from data file s3a://lake-house-hudi/pgao_test_delete_partition_1/1849/liveramp/523319/dd689c6344/e4043ee1-c8b8-4e5c-8788-b86d35d437d0-0_13-25-11859_20221206065637234.parquet. File does not exist.
at org.apache.hudi.common.table.TableSchemaResolver.readSchemaFromBaseFile(TableSchemaResolver.java:451)
at org.apache.hudi.common.table.TableSchemaResolver.getTableParquetSchemaFromDataFile(TableSchemaResolver.java:95)
at org.apache.hudi.common.table.TableSchemaResolver.getTableParquetSchema(TableSchemaResolver.java:209)
at org.apache.hudi.sync.common.AbstractSyncHoodieClient.getDataSchema(AbstractSyncHoodieClient.java:155)
... 40 more
```
**To Reproduce**
Steps to reproduce the behavior:
1.Upsert a dataframe into Hudi
2.Do delete_partition on this same dataframe
**Environment Description**
* Hudi version : 0.10.1
* Spark version : 3.0.3
* Hive version : 2.3.7
* Hadoop version : 3.3.0
* Storage (HDFS/S3/GCS..) : S3
* Running on Docker? (yes/no) : no
**Additional context**
Add any other context about the problem here.
**Stacktrace**
```Add the stacktrace of the 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: commits-unsubscribe@hudi.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Failed to read schema while doing delete_partition operation [hudi]
Posted by "deepakpanda93 (via GitHub)" <gi...@apache.org>.
deepakpanda93 closed issue #7503: Failed to read schema while doing delete_partition operation
URL: https://github.com/apache/hudi/issues/7503
--
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
Re: [I] Failed to read schema while doing delete_partition operation [hudi]
Posted by "deepakpanda93 (via GitHub)" <gi...@apache.org>.
deepakpanda93 commented on issue #7503:
URL: https://github.com/apache/hudi/issues/7503#issuecomment-4844697029
This is fixed in current Hudi.
Root cause: during Hive sync, TableSchemaResolver read the table schema by opening a base file from the latest commit. When delete_partition removed exactly those latest files, the schema read failed with Failed to read schema from data file … File does not exist.
Fix: the schema resolver no longer depends on those files —
It reads the schema from commit metadata first (getTableSchemaFromLatestCommitMetadata), so the deleted data files aren't touched in the normal path; and
when it does fall back to reading a data file, it now only inspects commits that actually wrote data (getLatestCommitMetadataWithInsertOrUpdate, filtering numInserts/numUpdateWrites > 0), so a delete_partition/replace commit is skipped — HUDI-9612 / [#13586](https://github.com/apache/hudi/pull/13586), in 1.1.0+.
@ad1happy2go was also unable to reproduce this as far back as 0.13.0. Closing as fixed (hardened in 1.1.0). If you still hit Failed to read data schema on a delete_partition + Hive sync on 1.1.0+, please reopen with a minimal repro and the timeline listing. Thanks!
--
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] ad1happy2go commented on issue #7503: Failed to read schema while doing delete_partition operation
Posted by "ad1happy2go (via GitHub)" <gi...@apache.org>.
ad1happy2go commented on issue #7503:
URL: https://github.com/apache/hudi/issues/7503#issuecomment-1547810419
@gaoshihang I was not able to reproduce this error , tried multiple scenarios with both Hudi version 0.13.0 and 0.10.1.
Are you still facing this issue, Can you try reproducing with mock up data and share us.
Code I used for reference. Please let me know in case of any issues.
```common_config={
"hoodie.datasource.write.table.type": "COPY_ON_WRITE",
"hoodie.datasource.write.recordkey.field": "id",
"hoodie.datasource.write.precombine.field": "timestamp",
"hoodie.datasource.write.partitionpath.field": "timestamp__date_",
'hoodie.table.name': table_name,
"hoodie.payload.ordering.field": "timestamp",
'hoodie.datasource.hive_sync.mode': 'hms',
'hoodie.datasource.hive_sync.use_jdbc': 'false',
}
schema = StructType([
StructField("id", IntegerType(), True),
StructField("b", IntegerType(), True),
StructField("c", StringType(), True),
StructField("d", StringType(), True),
StructField("timestamp", StringType(), True),
StructField("f", StringType(), True)
])
#df = spark.createDataFrame([
# Row(id=3, b=2, c='string1', d="2000-01-01", timestamp="2000-01-01 12:00:00", f = "2000-01-01 12:00:00"),
# Row(id=5, b=3, c='string2', d="2000-02-01", timestamp="2000-01-01 12:00:00", f = "2000-01-01 12:21:20"),
# Row(id=6, b=5, c='string3', d="2000-03-01", timestamp="2000-01-01 12:00:00", f = "2000-01-03 12:00:00")
#], schema)
df = spark.createDataFrame([
Row(id=5, b=3, c='string2', d="2000-02-01", timestamp="2000-01-01 12:00:00", f = "2000-01-01 12:21:20")
], schema)
df = df.withColumn("timestamp__date_", to_date(df["timestamp"]))
df.write.format("org.apache.hudi") \
.options(**common_config) \
.option("hoodie.datasource.hive_sync.database",db_name) \
.option("hoodie.datasource.hive_sync.table",table_name) \
.option("hoodie.datasource.hive_sync.partition_fields","timestamp__date_") \
.option("hoodie.datasource.write.operation","upsert") \
.mode("append") \
.save(path)
df.write.format("org.apache.hudi") \
.options(**common_config) \
.option("hoodie.datasource.hive_sync.database",db_name) \
.option("hoodie.datasource.hive_sync.table",table_name) \
.option("hoodie.datasource.hive_sync.partition_fields","timestamp__date_") \
.option("hoodie.datasource.write.operation","delete_partition") \
.mode("append") \
.save(path)
```
--
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