Skip to content

Commit d2d7233

Browse files
authored
Merge pull request #87 from Altinity/clickhouse_timezone_settings
Clickhouse timezone settings
2 parents 339d59d + a5e0d4f commit d2d7233

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

examples/docker-compose/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,41 @@ Solution: Upgrade docker/docker compose to v2.
2828

2929
### Supplemental
3030

31+
#### Setting ClickHouse Server Timezone
32+
33+
To configure the ClickHouse server timezone:
34+
35+
1. Edit `config.xml` with your desired timezone:
36+
37+
```xml
38+
<clickhouse replace="true">
39+
<timezone>America/Chicago</timezone>
40+
</clickhouse>
41+
```
42+
43+
2. Uncomment the volume mount in `docker-compose.yaml` under the `clickhouse` service:
44+
45+
```yaml
46+
volumes:
47+
- ./config.xml:/etc/clickhouse-server/conf.d/config.xml
48+
```
49+
50+
3. Restart the containers: `docker compose down && docker compose up`
51+
3152
#### Querying data using Spark
53+
To set the session timezone in spark, uncomment and set the value for the variable `spark.sql.session.timeZone`
54+
under the section.
55+
```
56+
configs:
57+
spark-defaults.conf:
58+
content: |
59+
```
60+
61+
```
62+
# spark.sql.session.timeZone America/Chicago
63+
```
64+
65+
This ensures that Spark SQL sessions will use the specified timezone.
3266
3367
```shell
3468
docker compose -f docker-compose-spark-iceberg.yaml down -v

examples/docker-compose/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<clickhouse replace="true">
2+
<timezone>America/Chicago</timezone>
3+
</clickhouse>

examples/docker-compose/docker-compose-spark-iceberg.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ configs:
3333
spark.eventLog.dir /home/iceberg/spark-events
3434
spark.history.fs.logDirectory /home/iceberg/spark-events
3535
spark.sql.catalogImplementation in-memory
36+
# spark.sql.session.timeZone America/Chicago
3637
# spark.log.level DEBUG

examples/docker-compose/docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
depends_on:
4141
- minio-init
4242
clickhouse:
43-
image: altinity/clickhouse-server:25.3.3.20186.altinityantalya-alpine
43+
image: altinity/clickhouse-server:25.8.9.20496.altinityantalya-alpine
4444
restart: unless-stopped
4545
environment:
4646
CLICKHOUSE_SKIP_USER_SETUP: "1" # insecure
@@ -53,6 +53,7 @@ services:
5353
volumes:
5454
# for access to clickhouse-logs
5555
- ./data/docker-compose/clickhouse/var/log/clickhouse-server:/var/log/clickhouse-server
56+
# - ./config.xml:/etc/clickhouse-server/conf.d/config.xml
5657
depends_on:
5758
- ice-rest-catalog
5859
configs:

0 commit comments

Comments
 (0)