Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码疑问:CK批量写入代码为什么每次批量写入后就关闭了statement ? #625

Open
baoyubobo opened this issue May 3, 2021 · 3 comments

Comments

@baoyubobo
Copy link

类: io.github.interestinglab.waterdrop.output.batch.Clickhouse

方法:private def execute(statement: ClickHousePreparedStatement, retry: Int)

为什么上述方法中 statement.executeBatch() 执行成功后,就执行 statement.close() 关闭了该statement对象?
该方法在代码中有多调用,如果第一次执行就关闭掉statement,那么后续执行会报错呀?

image

麻烦解答一下我的疑问!
谢谢!

@garyelephant
Copy link
Contributor

@RickyHuo 请帮忙看看这个问题。

@baoyubobo
Copy link
Author

@RickyHuo 感谢上面的回答!

但是还是有疑问:
https://github.com/InterestingLab/waterdrop/blob/b92018f56dadfc7de180eab33dca9a8b3450524a/waterdrop-core/src/main/scala/io/github/interestinglab/waterdrop/output/batch/Clickhouse.scala#L183-L193

181 行创建一个statement, 下面while循环中 的execute(statement, retry)可能执行多次。 第一次循环execute执行后statement就关闭了,那么第二次执行再执行statement时,由于statement已经关闭了,就会报错

ic4y added a commit to ic4y/incubator-seatunnel that referenced this issue Dec 27, 2023
alextinng pushed a commit to alextinng/seatunnel that referenced this issue Jan 4, 2024
alextinng pushed a commit to alextinng/seatunnel that referenced this issue Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants