[Bug]: hive的hdfs写不支持多分区 想写hive的时侯支持动态分区 #1127
Answered
by
wgzhao
laixueyong
asked this question in
Q&A
-
What happened?hive的hdfs写不支持多分区 想写hive的时侯支持动态分区 Version4.1.7 (Default) OS TypeNo response Java JDK VersionOracle JDK 1.8.0 Relevant log outputNo response |
Beta Was this translation helpful? Give feedback.
Answered by
wgzhao
Sep 18, 2024
Replies: 3 comments
-
请给出具体的需求场景 |
Beta Was this translation helpful? Give feedback.
0 replies
-
1.随着数据量的发展希望用hive存储其他数据库的历史数据,因为在hive在开表的时候需要建成分区表,但是用addax写入hive的时候需要先建分区目录在写入数据比较麻烦。有没有动态分区的写法指定一个字段进行分区呢,数据都是从关系型数据库读取存储到hive中 有些是做为ods层的表 |
Beta Was this translation helpful? Give feedback.
0 replies
-
"writer": {
"name": "hdfswriter",
"parameter": {
"defaultFS": "hdfs://cluster",
"fileType": "orc",
"path": "/ods/odstl/account_info/logdate=${logdate}",
"fileName": "addax",
"column": [
{
"name": "id",
"type": "bigint"
},
{
"name": "platform",
"type": "string"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "relation_time",
"type": "string"
},
{
"name": "channel_id",
"type": "bigint"
}
],
"writeMode": "overwrite",
"fieldDelimiter": "\u0001",
"compress": "lz4"
}
} 上述采集的数据对应的 Hive 表是 bin/addax.sh -p"-Dlogdate=20240918" xxx.json |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
wgzhao
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hdfswriter
来保存数据的话,那么写入 HDFS 和 Hive 没有关系。也就是说,hdfswriter
只会检查要写入的目录是否存在,至于这个目录如何创建,它并不关心。hdfswriter
插件所需要解决的问题。hive
创建分区,第二步是通过动态传递参数的方式来告诉hdfswriter
要写入的 HDFS 目录位置。举例如下: