Skip to content

Commit

Permalink
Merge pull request #1247 from zhicwu/main
Browse files Browse the repository at this point in the history
make jdbc driver executable without any dependency
  • Loading branch information
zhicwu authored Feb 19, 2023
2 parents 45bb960 + 8cf690e commit c6744b7
Show file tree
Hide file tree
Showing 19 changed files with 1,272 additions and 469 deletions.
57 changes: 50 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ concurrency:
cancel-in-progress: true

jobs:
compile:
compile8:
runs-on: ubuntu-latest
timeout-minutes: 10
name: Compile using JDK 8
Expand All @@ -56,10 +56,53 @@ jobs:
run: mvn --batch-mode --show-version --strict-checksums --threads C1 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
- name: Compile examples
run: for d in $(ls -d `pwd`/examples/*/); do cd $d && mvn clean compile; done

compile:
runs-on: ubuntu-latest
timeout-minutes: 10
name: Compile using JDK 17
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: |
8
17
cache: "maven"
- name: Setup Toolchain
shell: bash
run: |
mkdir -p $HOME/.m2 \
&& cat << EOF > $HOME/.m2/toolchains.xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
- name: Build and install libraries
run: mvn --batch-mode --show-version --strict-checksums --threads C1 -Dmaven.wagon.rto=30000 -DskipITs install
- name: Compile examples
run: for d in $(ls -d `pwd`/examples/*/); do cd $d && mvn clean compile; done

test-cli-client:
runs-on: ubuntu-latest
needs: compile
needs: compile8
timeout-minutes: 10
name: CLI client + CH 22.8
steps:
Expand Down Expand Up @@ -114,7 +157,7 @@ jobs:
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 8 and Maven
- name: Install JDK 17 and Maven
uses: actions/setup-java@v3
with:
distribution: "temurin"
Expand Down Expand Up @@ -174,7 +217,7 @@ jobs:
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 8 and Maven
- name: Install JDK 17 and Maven
uses: actions/setup-java@v3
with:
distribution: "temurin"
Expand Down Expand Up @@ -234,7 +277,7 @@ jobs:
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 8 and Maven
- name: Install JDK 17 and Maven
uses: actions/setup-java@v3
with:
distribution: "temurin"
Expand Down Expand Up @@ -277,7 +320,7 @@ jobs:
test-timezone-support:
runs-on: ubuntu-latest
needs: compile
needs: compile8
strategy:
matrix:
serverTz:
Expand Down Expand Up @@ -312,7 +355,7 @@ jobs:
with:
distribution: "temurin"
java-version: 8
cache: "maven"
cache: ""
- name: Install Java client
run: mvn --also-make --batch-mode --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -Dj8 -DskipTests install
- name: Test JDBC and R2DBC drivers
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.DS_Store

# Java Files
*.bgv
*.class
*.jar
*.war
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Java libraries for connecting to ClickHouse and processing data in various forma
| ----------------- | ----------------------------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| API | [JDBC](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) | :white_check_mark: | |
| | [R2DBC](https://r2dbc.io/) | :white_check_mark: | supported since 0.4.0 |
| Query Language | SQL | :white_check_mark: | |
| | [PRQL](https://prql-lang.org/) | :x: | |
| | [GraphQL](https://graphql.org/) | :x: | |
| Protocol | [HTTP](https://clickhouse.com/docs/en/interfaces/http/) | :white_check_mark: | recommended, defaults to `java.net.HttpURLConnection` and it can be changed to `java.net.http.HttpClient`(unstable) or `Apache HTTP Client 5`. Note that the latter was added in 0.4.0 to support custom socket options. |
| | [gRPC](https://clickhouse.com/docs/en/interfaces/grpc/) | :white_check_mark: | still experimental, works with 22.3+, known to has [issue](https://github.com/ClickHouse/ClickHouse/issues/28671#issuecomment-1087049993) when using LZ4 compression |
| | [TCP/Native](https://clickhouse.com/docs/en/interfaces/tcp/) | :white_check_mark: | `clickhouse-cli-client`(wrapper of ClickHouse native command-line client) was added in 0.3.2-patch10, `clickhouse-tcp-client` will be available in 0.5 |
Expand All @@ -22,7 +25,7 @@ Java libraries for connecting to ClickHouse and processing data in various forma
| | [zstd](https://facebook.github.io/zstd/) | :white_check_mark: | supported since 0.4.0, works with ClickHouse 22.10+ |
| Data Format | RowBinary | :white_check_mark: | `RowBinaryWithNamesAndTypes` for query and `RowBinary` for insertion |
| | TabSeparated | :white_check_mark: | Does not support as many data types as RowBinary |
| Data Type | AggregatedFunction | :x: | limited to `groupBitmap`, and known to have issue with 64bit bitmap |
| Data Type | AggregatedFunction | :x: | :warning: limited to `groupBitmap`; 64bit bitmap was NOT working properly before 0.4.1 |
| | Array(\*) | :white_check_mark: | |
| | Bool | :white_check_mark: | |
| | Date\* | :white_check_mark: | |
Expand All @@ -33,10 +36,10 @@ Java libraries for connecting to ClickHouse and processing data in various forma
| | Int\*, UInt\* | :white_check_mark: | UInt64 is mapped to `long` |
| | IPv\* | :white_check_mark: | |
| | Map(\*) | :white_check_mark: | |
| | Nested(\*) | :white_check_mark: | |
| | Nested(\*) | :white_check_mark: | :warning: broken before 0.4.1 |
| | Object('JSON') | :white_check_mark: | supported since 0.3.2-patch8 |
| | SimpleAggregateFunction | :white_check_mark: | |
| | \*String | :white_check_mark: | |
| | \*String | :white_check_mark: | :warning: requires `use_binary_string=true` for binary string support since v0.4.0 |
| | Tuple(\*) | :white_check_mark: | |
| | UUID | :white_check_mark: | |
| High Availability | Load Balancing | :white_check_mark: | supported since 0.3.2-patch10 |
Expand Down
26 changes: 14 additions & 12 deletions clickhouse-cli-client/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -22,7 +24,8 @@
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
<artifactId>lz4-pure-java</artifactId>
<optional>true</optional>
</dependency>

<!-- necessary for Java 9+ -->
Expand Down Expand Up @@ -87,17 +90,22 @@
<createDependencyReducedPom>true</createDependencyReducedPom>
<createSourcesJar>true</createSourcesJar>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<artifactSet>
<includes>
<include>com.clickhouse:clickhouse-data</include>
<include>com.clickhouse:clickhouse-client</include>
<include>org.lz4:lz4-pure-java</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>net.jpountz</pattern>
<shadedPattern>${shade.base}.jpountz</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Automatic-Module-Name>com.clickhouse.client.cli</Automatic-Module-Name>
</manifestEntries>
Expand All @@ -107,13 +115,7 @@
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/darwin/**</exclude>
<exclude>**/linux/**</exclude>
<exclude>**/win32/**</exclude>
<exclude>**/module-info.class</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/native-image/**</exclude>
</excludes>
</filter>
</filters>
Expand Down
12 changes: 12 additions & 0 deletions clickhouse-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
</exclusions>
</dependency>

<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>${graphql.version}</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
Loading

0 comments on commit c6744b7

Please sign in to comment.