Skip to content

Commit 43d061c

Browse files
committed
fiz timezone
1 parent 7aa3b78 commit 43d061c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

internal/custom-kafka-to-flexprice-clickhouse.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ pipeline:
5454
root.external_customer_id = this.orgId.string().or("")
5555
root.source = this.targetItemId.string().or("")
5656
57-
# Timestamp: handle JSON null (becomes string "null"), missing fields, and empty strings
57+
# Timestamp: parse ISO 8601 with timezone, then format for ClickHouse
58+
# 1. Check if createdAt exists and is valid
59+
# 2. Parse it as timestamp to preserve timezone info
60+
# 3. Format to ClickHouse DateTime64 format: "2006-01-02 15:04:05.999"
5861
root.timestamp = if this.createdAt != null && this.createdAt.string().or("") != "" && this.createdAt.string() != "null" {
59-
this.createdAt.string()
62+
this.createdAt.ts_parse("2006-01-02T15:04:05Z07:00").ts_format("2006-01-02 15:04:05.999")
6063
} else {
61-
timestamp_unix().ts_format("2006-01-02T15:04:05.999Z")
64+
timestamp_unix().ts_format("2006-01-02 15:04:05.999")
6265
}
6366
6467
# ---- Build event_name SAFELY ----

0 commit comments

Comments
 (0)