diff --git a/docs/about-us/beta-and-experimental-features.md b/docs/about-us/beta-and-experimental-features.md index b681c86f814..9e6deba1b71 100644 --- a/docs/about-us/beta-and-experimental-features.md +++ b/docs/about-us/beta-and-experimental-features.md @@ -128,10 +128,8 @@ Please note: no additional experimental features are allowed to be enabled in Cl | [allow_experimental_join_right_table_sorting](/operations/settings/settings#allow_experimental_join_right_table_sorting) | `0` | | [allow_statistics_optimize](/operations/settings/settings#allow_statistics_optimize) | `0` | | [allow_experimental_statistics](/operations/settings/settings#allow_experimental_statistics) | `0` | +| [use_statistics_cache](/operations/settings/settings#use_statistics_cache) | `0` | | [allow_experimental_full_text_index](/operations/settings/settings#allow_experimental_full_text_index) | `0` | -| [allow_experimental_live_view](/operations/settings/settings#allow_experimental_live_view) | `0` | -| [live_view_heartbeat_interval](/operations/settings/settings#live_view_heartbeat_interval) | `15` | -| [max_live_view_insert_blocks_before_refresh](/operations/settings/settings#max_live_view_insert_blocks_before_refresh) | `64` | | [allow_experimental_window_view](/operations/settings/settings#allow_experimental_window_view) | `0` | | [window_view_clean_interval](/operations/settings/settings#window_view_clean_interval) | `60` | | [window_view_heartbeat_interval](/operations/settings/settings#window_view_heartbeat_interval) | `15` | @@ -159,6 +157,7 @@ Please note: no additional experimental features are allowed to be enabled in Cl | [allow_experimental_ytsaurus_dictionary_source](/operations/settings/settings#allow_experimental_ytsaurus_dictionary_source) | `0` | | [distributed_plan_force_shuffle_aggregation](/operations/settings/settings#distributed_plan_force_shuffle_aggregation) | `0` | | [enable_join_runtime_filters](/operations/settings/settings#enable_join_runtime_filters) | `0` | +| [join_runtime_filter_exact_values_limit](/operations/settings/settings#join_runtime_filter_exact_values_limit) | `10000` | | [join_runtime_bloom_filter_bytes](/operations/settings/settings#join_runtime_bloom_filter_bytes) | `524288` | | [join_runtime_bloom_filter_hash_functions](/operations/settings/settings#join_runtime_bloom_filter_hash_functions) | `3` | | [rewrite_in_to_join](/operations/settings/settings#rewrite_in_to_join) | `0` | diff --git a/docs/integrations/language-clients/java/client/_snippets/_v0_8.mdx b/docs/integrations/language-clients/java/client/_snippets/_v0_8.mdx index 429d4ae44cb..0627d2112c3 100644 --- a/docs/integrations/language-clients/java/client/_snippets/_v0_8.mdx +++ b/docs/integrations/language-clients/java/client/_snippets/_v0_8.mdx @@ -1,6 +1,11 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import WideTableWrapper from '@site/src/components/WideTableWrapper/WideTableWrapper'; +import TOCInline from '@theme/TOCInline'; + + + + Java client library to communicate with a DB server through its protocols. The current implementation only supports the [HTTP interface](/interfaces/http). The library provides its own API to send requests to a server. The library also provides tools to work with different binary data formats (RowBinary* & Native*). @@ -14,11 +19,11 @@ The library provides its own API to send requests to a server. The library also -```xml +```xml com.clickhouse client-v2 - 0.9.1 + 0.9.4 ``` @@ -27,14 +32,14 @@ The library provides its own API to send requests to a server. The library also ```kotlin // https://mvnrepository.com/artifact/com.clickhouse/client-v2 -implementation("com.clickhouse:client-v2:0.9.1") +implementation("com.clickhouse:client-v2:0.9.4") ``` ```groovy // https://mvnrepository.com/artifact/com.clickhouse/client-v2 -implementation 'com.clickhouse:client-v2:0.9.1' +implementation 'com.clickhouse:client-v2:0.9.4' ``` @@ -110,7 +115,7 @@ Configuration is defined during client creation. See `com.clickhouse.client.api. |-----------------------|-----------------------------|:--------------------------------------------| | `addEndpoint(String endpoint)` | - `endpoint` - URL formatted a server address. | Adds a server endpoint to list of available servers. Currently only one endpoint is supported.

Default: `none`
Enum: `none`
Key: `none` | | `addEndpoint(Protocol protocol, String host, int port, boolean secure)` | - `protocol` - connection protocol `com.clickhouse.client.api.enums.Protocol#HTTP`.
- `host` - IP or hostname of a server.
- `secure` - if communication should use secure version of the protocol (HTTPS) | Adds a server endpoint to list of available servers. Currently only one endpoint is supported.

Default: `none`
Enum: `none`
Key: `none` | -| `setOption(String key, String value)` | - `key` - String key of the client configuration option.
- `value` - String value of the option | Sets raw value of client options. Useful when reading configuration from properties files. | +| `setOption(String key, String value)` | - `key` - String key of the client configuration option.
- `value` - String value of the option | Sets raw value of client options. Useful when reading configuration from properties files. | | `setUsername(String username)` | - `username` - User's username to use while authentication | Sets username for an authentication method that is selected by further configuration

Default: `default`
Enum: `ClientConfigProperties.USER`
Key: `user` | | `setPassword(String password)` | - `password` - secret value for password authentication | Sets a secret for password authentication and effectively selects as authentication method

Default: -
Enum: `ClientConfigProperties.PASSWORD`
Key: `password` | | `setAccessToken(String accessToken)` | - `accessToken` - String representation of an access token | Sets an access token to authenticate with a sets corresponding authentication method

Default: -
Enum: `ClientConfigProperties.ACCESS_TOKEN`
Key: `access_token` | @@ -130,7 +135,7 @@ Configuration is defined during client creation. See `com.clickhouse.client.api. | `setSocketLinger(int secondsToWait)` | - `secondsToWait` - number of seconds. | Set linger time for every TCP socket created by the client.

Default: -
Enum: `ClientConfigProperties.SOCKET_LINGER_OPT`
Key: `socket_linger`| | `compressServerResponse(boolean enabled)` | - `enabled` - flag that indicates if the option should be enabled | Sets if server should compress its responses.

Default: `true`
Enum: `ClientConfigProperties.COMPRESS_SERVER_RESPONSE`
Key: `compress` | | `compressClientRequest(boolean enabled)` | - `enabled` - flag that indicates if the option should be enabled | Sets if client should compress its requests.

Default: `false`
Enum: `ClientConfigProperties.COMPRESS_CLIENT_REQUEST`
Key: `decompress` | -| `useHttpCompression(boolean enabled)` | - `enabled` - flag that indicates if the option should be enabled | Sets if HTTP compression should be used for client/server communications if corresponding options are enabled | +| `useHttpCompression(boolean enabled)` | - `enabled` - flag that indicates if the option should be enabled | Sets if HTTP compression should be used for client/server communications if corresponding options are enabled | | `appCompressedData(boolean enabled)` | - `enabled` - flag that indicates if the option should be enabled | Tell client that compression will be handled by application.

Default: `false`
Enum: `ClientConfigProperties.APP_COMPRESSED_DATA`
Key: `app_compressed_data` | | `setLZ4UncompressedBufferSize(int size)` | - `size` - size in bytes | Sets size of a buffer that will receive uncompressed portion of a data stream. If buffer is underestimated - a new one will be created and corresponding warning will be present in logs.

Default: `65536`
Enum: `ClientConfigProperties.COMPRESSION_LZ4_UNCOMPRESSED_BUF_SIZE`
Key: `compression.lz4.uncompressed_buffer_size`| | `disableNativeCompression` | - `disable` - flag that indicates if the option should be disabled | Disable native compression. If set to true then native compression will be disabled.

Default: `false`
Enum: `ClientConfigProperties.DISABLE_NATIVE_COMPRESSION`
Key: `disable_native_compression` | @@ -372,13 +377,13 @@ Future of `InsertResponse` type - the result of the operation and additional inf **Examples** ```java showLineNumbers -// Important step (done once) - register class to pre-compile object serializer according to the table schema. +// Important step (done once) - register class to pre-compile object serializer according to the table schema. client.register(ArticleViewEvent.class, client.getTableSchema(TABLE_NAME)); List events = loadBatch(); try (InsertResponse response = client.insert(TABLE_NAME, events).get()) { - // handle response, then it will be closed and connection that served request will be released. + // handle response, then it will be closed and connection that served request will be released. } ``` @@ -419,7 +424,7 @@ Sends `sqlQuery` as is. Response format is set by query settings. `QueryResponse **Signatures** -```java +```java CompletableFuture query(String sqlQuery, QuerySettings settings) CompletableFuture query(String sqlQuery) ``` @@ -436,7 +441,7 @@ Future of `QueryResponse` type - a result dataset and additional information lik **Examples** -```java +```java final String sql = "select * from " + TABLE_NAME + " where title <> '' limit 10"; // Default format is RowBinaryWithNamesAndTypesFormatReader so reader have all information about columns @@ -453,13 +458,13 @@ try (QueryResponse response = client.query(sql).get(3, TimeUnit.SECONDS);) { String title = reader.getString("title"); String url = reader.getString("url"); - // collecting data + // collecting data } } catch (Exception e) { log.error("Failed to read data", e); } -// put business logic outside of the reading block to release http connection asap. +// put business logic outside of the reading block to release http connection asap. ``` ### query(String sqlQuery, Map<String, Object> queryParams, QuerySettings settings) {#querystring-sqlquery-mapltstring-object-queryparams-querysettings-settings} @@ -467,7 +472,7 @@ try (QueryResponse response = client.query(sql).get(3, TimeUnit.SECONDS);) { Sends `sqlQuery` as is. Additionally will send query parameters so the server can compile the SQL expression. **Signatures** -```java +```java CompletableFuture query(String sqlQuery, Map queryParams, QuerySettings settings) ``` @@ -487,7 +492,7 @@ Future of `QueryResponse` type - a result dataset and additional information lik ```java showLineNumbers -// define parameters. They will be sent to the server along with the request. +// define parameters. They will be sent to the server along with the request. Map queryParams = new HashMap<>(); queryParams.put("param1", 2); @@ -500,7 +505,7 @@ try (QueryResponse response = while (reader.hasNext()) { reader.next(); // Read the next record from stream and parse it - // reading data + // reading data } } catch (Exception e) { @@ -514,7 +519,7 @@ try (QueryResponse response = Queries a data in `RowBinaryWithNamesAndTypes` format. Returns the result as a collection. Read performance is the same as with the reader but more memory is required to hold the whole dataset. **Signatures** -```java +```java List queryAll(String sqlQuery) ``` @@ -594,7 +599,7 @@ Fetches table schema for the `table`. **Signatures** -```java +```java TableSchema getTableSchema(String table) TableSchema getTableSchema(String table, String database) ``` @@ -615,7 +620,7 @@ Fetches schema from a SQL statement. **Signatures** -```java +```java TableSchema getTableSchemaFromQuery(String sql) ``` @@ -636,7 +641,7 @@ Column match is found by extracting its name from a method name. For example, `g **Signatures** -```java +```java void register(Class clazz, TableSchema schema) ``` @@ -648,7 +653,7 @@ void register(Class clazz, TableSchema schema) **Examples** -```java showLineNumbers +```java showLineNumbers client.register(ArticleViewEvent.class, client.getTableSchema(TABLE_NAME)); ``` @@ -659,3 +664,148 @@ Complete examples code is stored in the repo in a 'example` [folder](https://git - [client-v2](https://github.com/ClickHouse/clickhouse-java/tree/main/examples/client-v2) - main set of examples. - [demo-service](https://github.com/ClickHouse/clickhouse-java/tree/main/examples/demo-service) - example of how to use the client in a Spring Boot application. - [demo-kotlin-service](https://github.com/ClickHouse/clickhouse-java/tree/main/examples/demo-kotlin-service) - example of how to use the client in Ktor (Kotlin) application. + +## Migration From V1 ( =< 0.7.x ) {#migration_from_v1} + + +Old client (V1) was using `com.clickhouse.client.ClickHouseClient#builder` as start point. The new client (V2) uses similar pattern with `com.clickhouse.client.api.Client.Builder`. Main +differences are: +- no service loader is used to grab implementation. The `com.clickhouse.client.api.Client` is facade class for all kinds of implementation in the future. +- a fewer sources of configuration: one is provided to the builder and one is with operation settings (`QuerySettings`, `InsertSettings`). Previous version had configuration per node and was loading +env. variables in some cases. + +### Configuration Parameters Match {#migration_from_v1_config} + +There are 3 enum classes related to configuration in V1: +- `com.clickhouse.client.config.ClickHouseDefaults` - configuration parameters that supposed to be set in most use cases. Like `USER` and `PASSWORD`. +- `com.clickhouse.client.config.ClickHouseClientOption` - configuration parameters specific for the client. Like `HEALTH_CHECK_INTERVAL`. +- `com.clickhouse.client.http.config.ClickHouseHttpOption` - configuration parameters specific for HTTP interface. Like `RECEIVE_QUERY_PROGRESS`. + +They were designed to group parameters and provide clear separation. However in some cases it lead to a confusion (is there a difference between `com.clickhouse.client.config.ClickHouseDefaults#ASYNC` and +`com.clickhouse.client.config.ClickHouseClientOption#ASYNC`). The new V2 client uses `com.clickhouse.client.api.Client.Builder` as single dictionary of all possible client configuration options.There is +`com.clickhouse.client.api.ClientConfigProperties` where all configuration parameter names are listed. + +Table below shows what old options are supported in the new client and there new meaning. +✔ - supported +✗ - dropped +| V1 Configuration | Matching V2 Builder Method | Comments | +|------------------|----------------------------|-------------------| +| `com.clickhouse.client.config.ClickHouseDefaults#ASYNC`, `com.clickhouse.client.config.ClickHouseClientOption#ASYNC` | `com.clickhouse.client.api.Client.Builder#useAsyncRequests` | | +| `com.clickhouse.client.config.ClickHouseDefaults#AUTO_SESSION` | ✗ | Session support will be reviewed | +| `com.clickhouse.client.config.ClickHouseDefaults#BUFFERING` | ✗ | | +| `com.clickhouse.client.config.ClickHouseDefaults#HOST` | `com.clickhouse.client.api.Client.Builder#addEndpoint` | | +| `com.clickhouse.client.config.ClickHouseDefaults#PROTOCOL` | ✗ | Only HTTP supported in V2. | +| `com.clickhouse.client.config.ClickHouseDefaults#DATABASE` | `com.clickhouse.client.api.Client.Builder#setDefaultDatabase` | | +| `com.clickhouse.client.config.ClickHouseDefaults#USER` | `com.clickhouse.client.api.Client.Builder#setUsername` | | +| `com.clickhouse.client.config.ClickHouseDefaults#PASSWORD` | `com.clickhouse.client.api.Client.Builder#setPassword` | | +| `com.clickhouse.client.config.ClickHouseDefaults#FORMAT`, `com.clickhouse.client.config.ClickHouseClientOption#FORMAT` | ✗ | Moved to operation settings (`QuerySettings` and `InsertSettings`) | +| `com.clickhouse.client.config.ClickHouseDefaults#MAX_SCHEDULER_THREADS` | ✗ | see `com.clickhouse.client.api.Client.Builder#setSharedOperationExecutor` | +| `com.clickhouse.client.config.ClickHouseDefaults#MAX_THREADS` | ✗ | see `com.clickhouse.client.api.Client.Builder#setSharedOperationExecutor` | +| `com.clickhouse.client.config.ClickHouseDefaults#MAX_REQUESTS` | ✗ | | +| `com.clickhouse.client.config.ClickHouseDefaults#ROUNDING_MODE` | | | +| `com.clickhouse.client.config.ClickHouseDefaults#THREAD_KEEPALIVE_TIMEOUT` | see `com.clickhouse.client.api.Client.Builder#setSharedOperationExecutor` | | +| `com.clickhouse.client.config.ClickHouseDefaults#SERVER_TIME_ZONE` | `com.clickhouse.client.api.Client.Builder#setServerTimeZone` | | +| `com.clickhouse.client.config.ClickHouseDefaults#SERVER_VERSION`, `com.clickhouse.client.config.ClickHouseClientOption#SERVER_VERSION` | `com.clickhouse.client.api.Client.Builder#setServerVersion` | | +| `com.clickhouse.client.config.ClickHouseDefaults#SSL_CERTIFICATE_TYPE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseDefaults#SSL_KEY_ALGORITHM` | ✗ | | +| `com.clickhouse.client.config.ClickHouseDefaults#SSL_PROTOCOL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseDefaults#SRV_RESOLVE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#AUTO_DISCOVERY` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#CUSTOM_SETTINGS` | | | +| `com.clickhouse.client.config.ClickHouseClientOption#CUSTOM_SOCKET_FACTORY` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#CUSTOM_SOCKET_FACTORY_OPTIONS` | ✗ | See `com.clickhouse.client.api.Client.Builder#sslSocketSNI` to set SNI | +| `com.clickhouse.client.config.ClickHouseClientOption#LOAD_BALANCING_POLICY` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#LOAD_BALANCING_TAGS` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#HEALTH_CHECK_INTERVAL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#HEALTH_CHECK_METHOD` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#NODE_DISCOVERY_INTERVAL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#NODE_DISCOVERY_LIMIT` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#NODE_CHECK_INTERVAL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#NODE_GROUP_SIZE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#CHECK_ALL_NODES` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#BUFFER_SIZE` | `com.clickhouse.client.api.Client.Builder#setClientNetworkBufferSize` | | +| `com.clickhouse.client.config.ClickHouseClientOption#BUFFER_QUEUE_VARIATION` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#READ_BUFFER_SIZE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#WRITE_BUFFER_SIZE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#REQUEST_CHUNK_SIZE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#REQUEST_BUFFERING` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#RESPONSE_BUFFERING` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#CLIENT_NAME` | `com.clickhouse.client.api.Client.Builder#setClientName` | | +| `com.clickhouse.client.config.ClickHouseClientOption#COMPRESS` | `com.clickhouse.client.api.Client.Builder#compressServerResponse` | See also `com.clickhouse.client.api.Client.Builder#useHttpCompression` | +| `com.clickhouse.client.config.ClickHouseClientOption#DECOMPRESS` | `com.clickhouse.client.api.Client.Builder#compressClientRequest` | See also `com.clickhouse.client.api.Client.Builder#useHttpCompression` | +| `com.clickhouse.client.config.ClickHouseClientOption#COMPRESS_ALGORITHM` | ✗ | `LZ4` for non-http compression. Http compression is defined by `Accept-Encoding` header. | +| `com.clickhouse.client.config.ClickHouseClientOption#DECOMPRESS_ALGORITHM` | ✗ | `LZ4` for non-http compression. Http compression is defined by `Content-Encoding` header. | +| `com.clickhouse.client.config.ClickHouseClientOption#COMPRESS_LEVEL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#DECOMPRESS_LEVEL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#CONNECTION_TIMEOUT` |`com.clickhouse.client.api.Client.Builder#setConnectTimeout` | | +| `com.clickhouse.client.config.ClickHouseClientOption#DATABASE` | `com.clickhouse.client.api.Client.Builder#setDefaultDatabase` | | +| `com.clickhouse.client.config.ClickHouseClientOption#FAILOVER` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#LOG_LEADING_COMMENT` | ✗ | See `com.clickhouse.client.api.query.QuerySettings#logComment` and `com.clickhouse.client.api.insert.InsertSettings#logComment` | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_BUFFER_SIZE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_MAPPER_CACHE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_EXECUTION_TIME` | `com.clickhouse.client.api.Client.Builder#setExecutionTimeout` | | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_QUEUED_BUFFERS` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_QUEUED_REQUESTS` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_RESULT_ROWS` | ✗ | Is server side setting. | +| `com.clickhouse.client.config.ClickHouseClientOption#RESULT_OVERFLOW_MODE` | ✗ | Is server side setting. | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_THREADS_PER_CLIENT` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#MAX_CORE_THREAD_TTL` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#PRODUCT_NAME` | ✗ | Use client name | +| `com.clickhouse.client.config.ClickHouseClientOption#RENAME_RESPONSE_COLUMN` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#RETRY` | `com.clickhouse.client.api.Client.Builder#setMaxRetries` | See also `com.clickhouse.client.api.Client.Builder#retryOnFailures` | +| `com.clickhouse.client.config.ClickHouseClientOption#REPEAT_ON_SESSION_LOCK` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#REUSE_VALUE_WRAPPER` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SERVER_REVISION` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SERVER_TIME_ZONE` | `com.clickhouse.client.api.Client.Builder#setServerTimeZone` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SESSION_ID` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SESSION_CHECK` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SESSION_TIMEOUT` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_TIMEOUT` | `com.clickhouse.client.api.Client.Builder#setSocketTimeout(long)` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_REUSEADDR` | `com.clickhouse.client.api.Client.Builder#setSocketReuseAddress` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_KEEPALIVE` | `com.clickhouse.client.api.Client.Builder#setSocketKeepAlive` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_LINGER` | `com.clickhouse.client.api.Client.Builder#setSocketLinger` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_IP_TOS` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_TCP_NODELAY` | `com.clickhouse.client.api.Client.Builder#setSocketTcpNodelay` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_RCVBUF` | `com.clickhouse.client.api.Client.Builder#setSocketRcvbuf` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SOCKET_SNDBUF` | `com.clickhouse.client.api.Client.Builder#setSocketSndbuf` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SSL` | ✗ | See `com.clickhouse.client.api.Client.Builder#addEndpoint` | +| `com.clickhouse.client.config.ClickHouseClientOption#SSL_MODE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SSL_ROOT_CERTIFICATE` | `com.clickhouse.client.api.Client.Builder#setRootCertificate` | SSL Auth should be enabled by `com.clickhouse.client.api.Client.Builder#useSSLAuthentication` | +| `com.clickhouse.client.config.ClickHouseClientOption#SSL_CERTIFICATE` | `com.clickhouse.client.api.Client.Builder#setClientCertificate` | | +| `com.clickhouse.client.config.ClickHouseClientOption#SSL_KEY` | `com.clickhouse.client.api.Client.Builder#setClientKey` | | +| `com.clickhouse.client.config.ClickHouseClientOption#KEY_STORE_TYPE` | `com.clickhouse.client.api.Client.Builder#setSSLTrustStoreType` | | +| `com.clickhouse.client.config.ClickHouseClientOption#TRUST_STORE` | `com.clickhouse.client.api.Client.Builder#setSSLTrustStore` | | +| `com.clickhouse.client.config.ClickHouseClientOption#KEY_STORE_PASSWORD` | `com.clickhouse.client.api.Client.Builder#setSSLTrustStorePassword` | | +| `com.clickhouse.client.config.ClickHouseClientOption#TRANSACTION_TIMEOUT` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#WIDEN_UNSIGNED_TYPES` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_BINARY_STRING` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_BLOCKING_QUEUE` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_COMPILATION` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_OBJECTS_IN_ARRAYS` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#PROXY_TYPE` | `com.clickhouse.client.api.Client.Builder#addProxy` | | +| `com.clickhouse.client.config.ClickHouseClientOption#PROXY_HOST` | `com.clickhouse.client.api.Client.Builder#addProxy` | | +| `com.clickhouse.client.config.ClickHouseClientOption#PROXY_PORT` | `com.clickhouse.client.api.Client.Builder#addProxy` | | +| `com.clickhouse.client.config.ClickHouseClientOption#PROXY_USERNAME` | `com.clickhouse.client.api.Client.Builder#setProxyCredentials` | | +| `com.clickhouse.client.config.ClickHouseClientOption#PROXY_PASSWORD` | `com.clickhouse.client.api.Client.Builder#setProxyCredentials` | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_SERVER_TIME_ZONE` | `com.clickhouse.client.api.Client.Builder#useServerTimeZone` | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_SERVER_TIME_ZONE_FOR_DATES` | | | +| `com.clickhouse.client.config.ClickHouseClientOption#USE_TIME_ZONE` | `com.clickhouse.client.api.Client.Builder#useTimeZone` | | +| `com.clickhouse.client.config.ClickHouseClientOption#QUERY_ID` | ✗ | See `QuerySettings` and `InsertSettings` | +| `com.clickhouse.client.config.ClickHouseClientOption#CONNECTION_TTL` | `com.clickhouse.client.api.Client.Builder#setConnectionTTL` | | +| `com.clickhouse.client.config.ClickHouseClientOption#MEASURE_REQUEST_TIME` | ✗ | | +| `com.clickhouse.client.config.ClickHouseClientOption#SSL_SOCKET_SNI` | `com.clickhouse.client.api.Client.Builder#sslSocketSNI` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#CONNECTION_PROVIDER` | ✗ | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#CUSTOM_HEADERS` | `com.clickhouse.client.api.Client.Builder#httpHeaders` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#CUSTOM_PARAMS` | ✗ | See `com.clickhouse.client.api.Client.Builder#serverSetting`| +| `com.clickhouse.client.http.config.ClickHouseHttpOption#DEFAULT_RESPONSE` | ✗ | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#KEEP_ALIVE` | `com.clickhouse.client.api.Client.Builder#setKeepAliveTimeout` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#MAX_OPEN_CONNECTIONS` | `com.clickhouse.client.api.Client.Builder#setMaxConnections` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#RECEIVE_QUERY_PROGRESS` | ✗ | Server side setting | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#SEND_HTTP_CLIENT_ID` | ✗ | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#WAIT_END_OF_QUERY` | ✗ | Server side setting | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#REMEMBER_LAST_SET_ROLES` | `com.clickhouse.client.api.Client#setDBRoles` | Is runtime configuration now. See also `com.clickhouse.client.api.query.QuerySettings#setDBRoles` and `com.clickhouse.client.api.insert.InsertSettings#setDBRoles` | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#AHC_VALIDATE_AFTER_INACTIVITY` | ✗ | Always enabled when Apache Http Client is used | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#AHC_RETRY_ON_FAILURE` | `com.clickhouse.client.api.Client.Builder#retryOnFailures` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#CONNECTION_REUSE_STRATEGY` | `com.clickhouse.client.api.Client.Builder#setConnectionReuseStrategy` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#KEEP_ALIVE_TIMEOUT` | `com.clickhouse.client.api.Client.Builder#setKeepAliveTimeout` | | +| `com.clickhouse.client.http.config.ClickHouseHttpOption#USE_BASIC_AUTHENTICATION` | `com.clickhouse.client.api.Client.Builder#useHTTPBasicAuth` | | diff --git a/docs/integrations/language-clients/java/index.md b/docs/integrations/language-clients/java/index.md index b816ab32529..af2dfc28578 100644 --- a/docs/integrations/language-clients/java/index.md +++ b/docs/integrations/language-clients/java/index.md @@ -1,5 +1,6 @@ --- title: 'Java' +sidebar_position: 1 keywords: ['clickhouse', 'java', 'jdbc', 'client', 'integrate', 'r2dbc'] description: 'Options for connecting to ClickHouse from Java' slug: /integrations/java @@ -20,7 +21,7 @@ import CodeBlock from '@theme/CodeBlock'; Java client is a library implementing own API that abstracts details of network communications with ClickHouse server. Currently HTTP Interface is supported only. The library provide utilities to work with different ClickHouse formats and other related functions. -Java Client was developed far back in 2015. Its codebase became very hard to maintain, API is confusing, it is hard to optimize it further. So we have refactored it in 2024 into a new component `client-v2`. It has clear API, lighter codebase and more performance improvements, better ClickHouse formats support (RowBinary & Native mainly). JDBC will use this client in near feature. +Java Client was developed far back in 2015. Its codebase became very hard to maintain, API is confusing, it is hard to optimize it further. So we have refactored it in 2024 into a new component `client-v2`. It has clear API, lighter codebase and more performance improvements, better ClickHouse formats support (RowBinary & Native mainly). JDBC will use this client in near feature. ### Supported data types {#supported-data-types} @@ -83,7 +84,7 @@ Java Client was developed far back in 2015. Its codebase became very hard to mai - AggregatedFunction - :warning: does not support `SELECT * FROM table ...` - Decimal - `SET output_format_decimal_trailing_zeros=1` in 21.9+ for consistency - Enum - can be treated as both string and integer -- UInt64 - mapped to `long` in client-v1 +- UInt64 - mapped to `long` in client-v1 ::: ### Features {#features} @@ -94,7 +95,8 @@ Table of features of the clients: |----------------------------------------------|:---------:|:---------:|:---------:| | Http Connection |✔ |✔ | | | Http Compression (LZ4) |✔ |✔ | | -| Server Response Compression - LZ4 |✔ |✔ | | +| Application Controlled Compression |✔ |✗ | | +| Server Response Compression - LZ4 |✔ |✔ | | | Client Request Compression - LZ4 |✔ |✔ | | | HTTPS |✔ |✔ | | | Client SSL Cert (mTLS) |✔ |✔ | | @@ -109,6 +111,7 @@ Table of features of the clients: | Log Comment |✔ |✔ | | | Session Roles |✔ |✔ | | | SSL Client Authentication |✔ |✔ | | +| SNI Configuration |✔ |✗ | | | Session timezone |✔ |✔ | | JDBC Drive inherits same features as underlying client implementation. Other JDBC features are listed on its [page](/integrations/language-clients/java/jdbc). @@ -122,7 +125,7 @@ JDBC Drive inherits same features as underlying client implementation. Other JDB ### Logging {#logging} -Our Java language client uses [SLF4J](https://www.slf4j.org/) for logging. You can use any SLF4J-compatible logging framework, such as `Logback` or `Log4j`. +Our Java language client uses [SLF4J](https://www.slf4j.org/) for logging. You can use any SLF4J-compatible logging framework, such as `Logback` or `Log4j`. For example, if you are using Maven you could add the following dependency to your `pom.xml` file: ```xml title="pom.xml" diff --git a/docs/integrations/language-clients/java/jdbc/_snippets/_v0_8.mdx b/docs/integrations/language-clients/java/jdbc/_snippets/_v0_8.mdx index 40d0084a125..e50f3e7cc7d 100644 --- a/docs/integrations/language-clients/java/jdbc/_snippets/_v0_8.mdx +++ b/docs/integrations/language-clients/java/jdbc/_snippets/_v0_8.mdx @@ -1,5 +1,9 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import TOCInline from '@theme/TOCInline'; + + + :::note `clickhouse-jdbc` implements the standard JDBC interface using the latest java client. @@ -35,8 +39,8 @@ In 0.8 we tried to make the driver more strictly follow the JDBC specification, com.clickhouse clickhouse-jdbc - 0.9.1 - shaded-all + 0.9.4 + all ``` @@ -45,14 +49,14 @@ In 0.8 we tried to make the driver more strictly follow the JDBC specification, ```kotlin // https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc - implementation("com.clickhouse:clickhouse-jdbc:0.9.1:shaded-all") + implementation("com.clickhouse:clickhouse-jdbc:0.9.4:all") ``` ```groovy // https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc - implementation 'com.clickhouse:clickhouse-jdbc:0.9.1:shaded-all' + implementation 'com.clickhouse:clickhouse-jdbc:0.9.4:all' ``` @@ -67,9 +71,9 @@ In 0.8 we tried to make the driver more strictly follow the JDBC specification, - `jdbc:clickhouse:http://localhost:8123` - `jdbc:clickhouse:https://localhost:8443?ssl=true` -**Connection Properties**: +### Connection Properties -Beyond standard JDBC properties, the driver supports the ClickHouse-specific properties offered by the underlying [java client](/integrations/language-clients/java/client/client.mdx). +Beyond standard JDBC properties, the driver supports the ClickHouse-specific properties offered by the underlying [java client](/integrations/language-clients/java/client#client-configuration). Where possible methods will return an `SQLFeatureNotSupportedException` if the feature is not supported. Other custom properties include: | Property | Default | Description | @@ -81,6 +85,11 @@ Where possible methods will return an `SQLFeatureNotSupportedException` if the f | `jdbc_resultset_auto_close` | `true` | Automatically closes `ResultSet` when `Statement` is closed | | `beta.row_binary_for_simple_insert` | `false` | Use `PreparedStatement` implementation based on `RowBinary` writer. Works only for `INSERT INTO ... VALUES` queries. | +:::note Server Settings + +All server settings should be prefixed with `clickhouse_setting_` (same as for the client [configuration](/integrations/language-clients/java/client#server-settings)). +::: + ## Supported data types {#supported-data-types} JDBC Driver supports the same data formats as the underlying [java client](/integrations/language-clients/java/client/client.mdx). diff --git a/docs/whats-new/changelog/index.md b/docs/whats-new/changelog/index.md index 8721e2d50fe..b832e36d5da 100644 --- a/docs/whats-new/changelog/index.md +++ b/docs/whats-new/changelog/index.md @@ -2145,7 +2145,3 @@ doc_type: 'changelog' #### Build/Testing/Packaging Improvement * The universal installation script will propose installation even on macOS. [#74339](https://github.com/ClickHouse/ClickHouse/pull/74339) ([Alexey Milovidov](https://github.com/alexey-milovidov)). -:::note -There have been no new releases yet for 2025. - View changelog for the year [2024](/docs/whats-new/changelog/2024). -::: diff --git a/package.json b/package.json index 59ac0d6ec89..670537f533f 100644 --- a/package.json +++ b/package.json @@ -109,5 +109,6 @@ }, "resolutions": { "form-data": "^4.0.4" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/sidebars.js b/sidebars.js index 254eb8fb7d7..d1f81474e04 100644 --- a/sidebars.js +++ b/sidebars.js @@ -177,7 +177,7 @@ const sidebars = { } ] }, - { + { type: "category", label: "Data lake", collapsed: true,