-
Notifications
You must be signed in to change notification settings - Fork 543
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
r2dbc module is added. #914
Conversation
|
Thank you @rernas35! Just some immediate feedback:
There're some other minor issues in pom files but once you fixed build break and tidy up code, I can follow up to address them. |
d9a6f24
to
620195c
Compare
Is the failure of the CI/CD expected behavior or does it mean that the PR has not yet completed? Is there any unfinished business? |
can you please approve the workflows |
builds fixed |
@rernas35 i see this pr is still pending |
this is r2dbc module which is compliant with r2dbc specs (https://r2dbc.io/). I need to add a sample and readme then it is ready for review |
Hi @rernas35, it looks like the test never ran. The build success only proves that r2dbc module can be compiled without issue. I think it's better to enable tests and merge it into 0.3.3 release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also move clickhouse-r2dbc-samples to examples directory?
clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseBatch.java
Outdated
Show resolved
Hide resolved
clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseRow.java
Outdated
Show resolved
Hide resolved
clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/types/ClickHouseType.java
Outdated
Show resolved
Hide resolved
@rernas35, please use |
6791f9b
to
50bc36c
Compare
@zhicwu I have done some tests but it looks like r2dbc url is not supporting multiple hosts currently.
Since currently fragment part of r2dbc url is not supported, tags are not supported but other parameters are all passed and ClickHouseNodes is being used. |
resolved |
this module will enable client to use clickhouse-jdbc functionality in a r2dbc compliant way |
5af2de5
to
14f931f
Compare
4854205
to
49976f2
Compare
41e1afc
to
4bb1bea
Compare
4bb1bea
to
5b26f1c
Compare
Thank you @rernas35, really appreciate your efforts on this. Will review this in the coming weekend and merge it into develop if no critical issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more feedback(just for documentation):
- needs a place to close
ClickHouseResponse
in case query was cancelled etc. - exception handling should be improved
- exception when using grpc - try
mvn -Dprotocol=grpc clean verify
- test/resources can be safely removed as it's included in clickhouse-client test-jar
- rename examples directory to r2dbc for consistency
- may remove apache commons dependency
clickhouse-r2dbc/pom.xml
Outdated
</dependency> | ||
<dependency> | ||
<groupId>com.clickhouse</groupId> | ||
<artifactId>clickhouse-jdbc</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be restricted to test scope
clickhouse-r2dbc/pom.xml
Outdated
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>5.8.2</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare version as property
clickhouse-r2dbc/pom.xml
Outdated
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be failsafe plugin as it's integration test
|
||
private static final ClickHouseFormat PREFERRED_FORMAT = ClickHouseFormat.TabSeparatedWithNamesAndTypes; | ||
private ClickHouseRequest<?> request; | ||
List<String> sqlList = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add private final
?
if (isHttp()) { | ||
req = req.set("send_progress_in_http_headers", 1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer required since ClickHouse 22.6 - see #947
private static final List<String> connQueryParams = Arrays.asList("auto_discovery", "node_discovery_interval", | ||
"node_discovery_limit", "load_balancing_policy", "load_balancing_tags", "health_check_method", | ||
"health_check_interval", "check_all_nodes", "node_check_interval", "node_group_size", "failover", | ||
"retry"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should consider all client options
|
||
StringBuilder urlBuilder = new StringBuilder(String.format("%s://%s/%s?user=%s&password=%s", protocol, hosts, database, username, password)); | ||
String params = connQueryParams.stream().filter(queryParam -> cfOpt.getValue(Option.valueOf(queryParam)) != null) | ||
.map(queryParam -> String.format("%s=%s", queryParam, cfOpt.getValue(Option.valueOf(queryParam)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL encode
StringBuilder urlBuilder = new StringBuilder(String.format("%s://%s/%s?user=%s&password=%s", protocol, hosts, database, username, password)); | ||
String params = connQueryParams.stream().filter(queryParam -> cfOpt.getValue(Option.valueOf(queryParam)) != null) | ||
.map(queryParam -> String.format("%s=%s", queryParam, cfOpt.getValue(Option.valueOf(queryParam)))) | ||
.collect(Collectors.joining("%")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a typo? Should be '&'?
final ClickHouseClient client; | ||
final ClickHouseNode server; | ||
|
||
private final String serverVersion = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it's always null?
@BeforeAll | ||
public static void setup() throws Exception { | ||
ClickHouseServerForTest.beforeSuite(); | ||
connectionFactory = ConnectionFactories.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should support more protocols instead of just http
@rernas35, no action required. Just document some of the feedback and I'll make changes on your branch shortly to address most of them and then merge. Stay tuned :) |
No description provided.