首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Hudi分区和upsert不工作

Hudi分区和upsert不工作
EN

Stack Overflow用户
提问于 2021-08-29 05:50:32
回答 1查看 433关注 0票数 1

这个配置中的错误是什么,

分区键在HUDI中不起作用,并且在执行upsert时,hudi数据集中的所有记录都会更新。所以不能从表中提取增量。

代码语言:javascript
复制
commonConfig = {'className' : 'org.apache.hudi',
'hoodie.datasource.hive_sync.use_jdbc':'false',
'hoodie.datasource.write.precombine.field': 'hash_value',
'hoodie.datasource.write.recordkey.field': 'hash_value',
'hoodie.datasource.hive_sync.partition_fields':'year,month,day',
'hoodie.datasource.hive_sync.partition_extractor_class': 'org.apache.hudi.hive.MultiPartKeysValueExtractor',
'hoodie.datasource.write.keygenerator.class':'org.apache.hudi.ComplexKeyGenerator',
'hoodie.table.name': 'hudi_account',
'hoodie.consistency.check.enabled': 'true',
'hoodie.datasource.hive_sync.database': 'hudi_db',
'hoodie.datasource.hive_sync.table': 'hudi_account',
'hoodie.datasource.hive_sync.enable': 'true',
'path': 's3://' + args['curated_bucket'] + '/stage_e/hudi_db/hudi_account'}

我的用例是使用hudi完成upsert逻辑,使用hudi完成分区。Upsert是部分工作的,因为它更新整个记录集,就像我在原始存储桶中有10k个记录一样,当对1k个记录执行upsert时,它更新所有10k数据的hudi时间。

EN

回答 1

Stack Overflow用户

发布于 2021-11-22 01:46:44

你的分区键改变了吗?默认情况下,hudi不使用全局索引,但在每个分区中,我遇到了与您类似的问题,当我启用全局索引时,它是有效的。尝试添加以下设置:

代码语言:javascript
复制
 "hoodie.index.type": "GLOBAL_BLOOM",                 # This is required if we want to ensure we upsert a record, even if the partition changes
 "hoodie.bloom.index.update.partition.path": "true",  # This is required to write the data into the new partition (defaults to false in 0.8.0, true in 0.9.0)

我在这个博客上找到了答案:https://dacort.dev/posts/updating-partition-values-with-apache-hudi/

在这里你可以看到更多关于hudi索引的信息:https://hudi.apache.org/blog/2020/11/11/hudi-indexing-mechanisms/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68970224

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档