seatunnel
seatunnel copied to clipboard
[Feature][Connector Hive] support hive savemode
Purpose of this pull request
subtask of #5390
- implement hive savemode feature,
- add chinese document
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
- [ ] If any new Jar binary package adding in your PR, please add License Notice according New License Guide
- [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
- [ ] If you are contributing the connector code, please check that the following files are updated:
- Update change log that in connector document. For more details you can refer to connector-v2
- Update plugin-mapping.properties and add new connector information in it
- Update the pom file of seatunnel-dist
- [ ] Update the
release-note
.
@EricJoy2048 @dailai @ruanwenjun hi, guys. PTAL when you have time.
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '<EOF>' '<EOF>' '<EOF>'
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
partition
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
是的,当schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"时,save_mode_create_template 是必须的吗?当为 “” 时,报错为我描述的那个错误
partition
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
是的,当schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"时,save_mode_create_template 是必须的吗?当为 “” 时,报错为我描述的那个错误
是必须的, 这个是你表不存在时的要执行的建表语句
partition
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
是的,当schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"时,save_mode_create_template 是必须的吗?当为 “” 时,报错为我描述的那个错误
是必须的, 这个是你表不存在时的要执行的建表语句
那如果我不知道source的表结构的话,是否该source-sink的conf就不能成立?这个和mysql的schema_save_mode 的配置实现的效果不一样吗?
partition
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
是的,当schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"时,save_mode_create_template 是必须的吗?当为 “” 时,报错为我描述的那个错误
是必须的, 这个是你表不存在时的要执行的建表语句
那如果我不知道source的表结构的话,是否该source-sink的conf就不能成立?这个和mysql的schema_save_mode 的配置实现的效果不一样吗?
有些许的不一样 可以拿到source的表结构, 然后根据这个结构去创建表 但是其他的Hive配置, 比如内表/外表, 外表路径, 存储格式等等的配置是无法拿到的. 所以添加了这个参数 希望用户自定义DDL语句
partition
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
是的,当schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"时,save_mode_create_template 是必须的吗?当为 “” 时,报错为我描述的那个错误
是必须的, 这个是你表不存在时的要执行的建表语句
那如果我不知道source的表结构的话,是否该source-sink的conf就不能成立?这个和mysql的schema_save_mode 的配置实现的效果不一样吗?
有些许的不一样 可以拿到source的表结构, 然后根据这个结构去创建表 但是其他的Hive配置, 比如内表/外表, 外表路径, 存储格式等等的配置是无法拿到的. 所以添加了这个参数 希望用户自定义DDL语句
那也就是说hive的自定义建表需要满足: 1.已知source表结构 2.自定义建表语句并作为sink的参数
老哥稳,我试过了。
老哥稳,我试过了。
目前的代码还有几个问题:
- 你上面的语句 没有指定分隔符, 如果指定了类似于
\t
这样的分割符, 写入Config后会变成\\t
, 导致文件写入有问题. - 由于查询hive表结构是通过
desc formatted <table_name>
的方式 然后解析sql结果. 目前发现在不同的版本中 返回语句会略有不同, 3.1.3 版本 在# col_name
与真正的字段名直接没有空行, 而在2.1.1
版本中 发现会多一个空行. 目前的代码这块的处理逻辑需要兼容 以及优化. - 不确定开启kerberos认证后 是否可以连通, 我这边是使用用户名密码, 可以通过在jdbc url中设置完成这个认证.
Modify the hive documentation by referring to mysql.md
@liunaijie
https://github.com/apache/seatunnel/blob/dev/docs/en/connector-v2/sink/Mysql.md
https://github.com/apache/seatunnel/blob/dev/docs/en/connector-v2/source/Mysql.md
老哥稳,我试过了。
目前的代码还有几个问题:
- 你上面的语句 没有指定分隔符, 如果指定了类似于
\t
这样的分割符, 写入Config后会变成\\t
, 导致文件写入有问题.- 由于查询hive表结构是通过
desc formatted <table_name>
的方式 然后解析sql结果. 目前发现在不同的版本中 返回语句会略有不同, 3.1.3 版本 在# col_name
与真正的字段名直接没有空行, 而在2.1.1
版本中 发现会多一个空行. 目前的代码这块的处理逻辑需要兼容 以及优化.- 不确定开启kerberos认证后 是否可以连通, 我这边是使用用户名密码, 可以通过在jdbc url中设置完成这个认证.
problem 1, 2 solved problem 3, i don't have this env, can't verify about this.
partition
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
大佬你好,创建的statement好像有点问题 org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near '' '' ''
是提交partition信息的语句吗 还是哪个语句?
是的,当schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"时,save_mode_create_template 是必须的吗?当为 “” 时,报错为我描述的那个错误
是必须的, 这个是你表不存在时的要执行的建表语句
那如果我不知道source的表结构的话,是否该source-sink的conf就不能成立?这个和mysql的schema_save_mode 的配置实现的效果不一样吗?
代码更新了一版, 可以在不知道上游表结构的情况下, 使用变量的形式 运行时替换掉. 有一点需要注意的是 如果存在分区, 则需要添加额外的参数标明分区字段, 并且分区字段不能变量化, 即多张上游表只能用一个模板内的分区定义, 不能针对每个表建不同的分区.
waitting for this pr merged #7131
ok, will update when the pr merged
waitting for this pr merged #7131
@liunaijie this pr is merged
@liunaijie Please resolve the conflict, thanks
加油啊
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
Share how to run e2e on my desktop:
- compile/install the project
- start docker env
- choose the Test, like
FakeIT
, click run
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
Share how to run e2e on my desktop:
- compile/install the project
- start docker env
- choose the Test, like
FakeIT
, click run
我也是这样操作的,但是还是不行,对docker的版本有要求吗?
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
你好,我想问下,这个e2e是怎么跑起来的,我的为什么一直都跑不起来呢?
Share how to run e2e on my desktop:
- compile/install the project
- start docker env
- choose the Test, like
FakeIT
, click run我也是这样操作的,但是还是不行,对docker的版本有要求吗?
No requirement for Docker version.
From the error message Could not find or load main class
, looks the package has some issue.
You can run install
command, and copy the final lib, try to run with this lib directly.
@liunaijie Does sink support writing to specified partitions?
@liunaijie Can you provide some examples of source and sink JDBC or e2e?
@liunaijie Does sink support writing to specified partitions?
Hi @wuchunfu this pr only add hive savemode function.
you mentioned write to specified partition
it's implement in the hive writer.
base on my understanging, it's dependency on the upstream data. if the partition column value in upstream is limited, then it will only write to those partition.
the demo config file is https://github.com/apache/seatunnel/pull/6842/files#diff-d7baf931b751ae313c92a9e96e2537e61726e2add691adad696251cb5dec926fR48
I tested it in my local desktop with example module, but the e2e is not enable, because it need hive metastore and hive server2 2 container, i try to enable it in e2e but failed... so i only attach the example config
I tested it in my local desktop with example module, but the e2e is not enable, because it need hive metastore and hive server2 2 container, i try to enable it in e2e but failed... so i only attach the example config
Have you try with https://hub.docker.com/r/apache/hive?