Releases: quackscience/duckdb-extension-clickhouse-sql
Releases · quackscience/duckdb-extension-clickhouse-sql
v1.0.6
v1.0.5
v1.0.4
v1.0.3
v1.0.2
What's Changed
Supported Macros
toString (CAST(x AS VARCHAR))
toInt8 (CAST(x AS INT8))
toInt16 (CAST(x AS INT16))
toInt32 (CAST(x AS INT32))
toInt64 (CAST(x AS INT64))
toInt128 (CAST(x AS INT128))
toInt256 (CAST(x AS HUGEINT))
toInt8OrZero (CASE WHEN TRY_CAST(x AS INT8) IS NOT NULL THEN CAST(x AS INT8) ELSE 0 END)
toInt16OrZero (CASE WHEN TRY_CAST(x AS INT16) IS NOT NULL THEN CAST(x AS INT16) ELSE 0 END)
toInt32OrZero (CASE WHEN TRY_CAST(x AS INT32) IS NOT NULL THEN CAST(x AS INT32) ELSE 0 END)
toInt64OrZero (CASE WHEN TRY_CAST(x AS INT64) IS NOT NULL THEN CAST(x AS INT64) ELSE 0 END)
toInt128OrZero (CASE WHEN TRY_CAST(x AS INT128) IS NOT NULL THEN CAST(x AS INT128) ELSE 0 END)
toInt256OrZero (CASE WHEN TRY_CAST(x AS HUGEINT) IS NOT NULL THEN CAST(x AS HUGEINT) ELSE 0 END)
toInt8OrNull (TRY_CAST(x AS INT8))
toInt16OrNull (TRY_CAST(x AS INT16))
toInt32OrNull (TRY_CAST(x AS INT32))
toInt64OrNull (TRY_CAST(x AS INT64))
toInt128OrNull (TRY_CAST(x AS INT128))
toInt256OrNull (TRY_CAST(x AS HUGEINT))
toUInt8 (CAST(x AS UTINYINT))
toUInt16 (CAST(x AS USMALLINT))
toUInt32 (CAST(x AS UINTEGER))
toUInt64 (CAST(x AS UBIGINT))
toUInt8OrZero (CASE WHEN TRY_CAST(x AS UTINYINT) IS NOT NULL THEN CAST(x AS UTINYINT) ELSE 0 END)
toUInt16OrZero (CASE WHEN TRY_CAST(x AS USMALLINT) IS NOT NULL THEN CAST(x AS USMALLINT) ELSE 0 END)
toUInt32OrZero (CASE WHEN TRY_CAST(x AS UINTEGER) IS NOT NULL THEN CAST(x AS UINTEGER) ELSE 0 END)
toUInt64OrZero (CASE WHEN TRY_CAST(x AS UBIGINT) IS NOT NULL THEN CAST(x AS UBIGINT) ELSE 0 END)
toUInt8OrNull (TRY_CAST(x AS UTINYINT))
toUInt16OrNull (TRY_CAST(x AS USMALLINT))
toUInt32OrNull (TRY_CAST(x AS UINTEGER))
toUInt64OrNull (TRY_CAST(x AS UBIGINT))
toFloat (CAST(x AS DOUBLE))
toFloatOrNull (TRY_CAST(x AS DOUBLE))
toFloatOrZero (CASE WHEN TRY_CAST(x AS DOUBLE) IS NOT NULL THEN CAST(x AS DOUBLE) ELSE 0 END)
intDiv ((CAST(a AS BIGINT) // CAST(b AS BIGINT)))
intDivOrNull (TRY_CAST((TRY_CAST(a AS BIGINT) // TRY_CAST(b AS BIGINT)) AS BIGINT))
intDivOZero (COALESCE((TRY_CAST((TRY_CAST(a AS BIGINT) // TRY_CAST(b AS BIGINT)) AS BIGINT)),0))
plus (add(a, b))
minus (subtract(a, b))
modulo (CAST(a AS BIGINT) % CAST(b AS BIGINT))
moduloOrZero (COALESCE(((TRY_CAST(a AS BIGINT) % TRY_CAST(b AS BIGINT))),0))
tupleIntDiv (apply(a, (x,i) -> apply(b, x -> CAST(x AS BIGINT))[i] // CAST(x AS BIGINT)))
tupleIntDivByNumber (apply(a, (x) -> CAST(apply(b, x -> CAST(x AS BIGINT))[1] as BIGINT) // CAST(x AS BIGINT)))
tupleDivide (apply(a, (x,i) -> apply(b, x -> CAST(x AS BIGINT))[i] / CAST(x AS BIGINT)))
tupleMultiply (apply(a, (x,i) -> CAST(apply(b, x -> CAST(x AS BIGINT))[i] as BIGINT) * CAST(x AS BIGINT)))
tupleMinus (apply(a, (x,i) -> apply(b, x -> CAST(x AS BIGINT))[i] - CAST(x AS BIGINT)))
tuplePlus (apply(a, (x,i) -> apply(b, x -> CAST(x AS BIGINT))[i] + CAST(x AS BIGINT)))
tupleMultiplyByNumber (apply(a, (x) -> CAST(apply(b, x -> CAST(x AS BIGINT))[1] as BIGINT) * CAST(x AS BIGINT)))
tupleDivideByNumber (apply(a, (x) -> CAST(apply(b, x -> CAST(x AS BIGINT))[1] as BIGINT) / CAST(x AS BIGINT)))
tupleModulo (apply(a, (x) -> CAST(apply(b, x -> CAST(x AS BIGINT))[1] as BIGINT) % CAST(x AS BIGINT)))
tupleModuloByNumber (apply(a, (x) -> CAST(apply(b, x -> CAST(x AS BIGINT))[1] as BIGINT) % CAST(x AS BIGINT)))
tupleConcat (list_concat(a, b))
match (string LIKE token)
arrayExists (haystack @> ARRAY[needle])
arrayMap (array_transform(arr, e -> (e * e)))
toYear (EXTRACT(YEAR FROM date_expression))
toMonth (EXTRACT(MONTH FROM date_expression))
toDayOfMonth (EXTRACT(DAY FROM date_expression))
toHour (EXTRACT(HOUR FROM date_expression))
toMinute (EXTRACT(MINUTE FROM date_expression))
toSecond (EXTRACT(SECOND FROM date_expression))
toYYYYMM (DATE_FORMAT(date_expression, '%Y%m'))
toYYYYMMDD (DATE_FORMAT(date_expression, '%Y%m%d'))
toYYYYMMDDhhmmss (DATE_FORMAT(date_expression, '%Y%m%d%H%M%S'))
formatDateTime (CASE WHEN timezone IS NULL THEN strftime(time, format) ELSE strftime(time AT TIME ZONE timezone, format) END)
empty (LENGTH(str) = 0)
notEmpty (LENGTH(str) > 0)
lengthUTF8 (LENGTH(str))
leftPad (LPAD(str, length, pad_str))
rightPad (RPAD(str, length, pad_str))
extractAllGroups (regexp_extract_all(text, pattern))
toFixedString (RPAD(LEFT(str, length), length, '\0'))
ifNull (COALESCE(x, y))
arrayJoin (UNNEST(arr))
splitByChar (string_split(str, separator))
protocol (REGEXP_EXTRACT(url, '^(\w+)://', 1))
domain (REGEXP_EXTRACT(url, '://([^/]+)', 1))
topLevelDomain (REGEXP_EXTRACT(url, '.([^./:]+)([:/]|$)', 1))
path (REGEXP_EXTRACT(url, '://[^/]+(/.*)', 1))
IPv4NumToString (CONCAT(CAST((num >> 24) & 255 AS VARCHAR), '.', CAST((num >> 16) & 255 AS VARCHAR), '.', CAST((num >> 8) & 255 AS VARCHAR), '.', CAST(num & 255 AS VARCHAR)))
IPv4StringToNum (CAST(SPLIT_PART(ip, '.', 1) AS INTEGER) * 256 * 256 * 256 + CAST(SPLIT_PART(ip, '.', 2) AS INTEGER) * 256 * 256 + CAST(SPLIT_PART(ip, '.', 3) AS INTEGER) * 256 + CAST(SPLIT_PART(ip, '.', 4) AS INTEGER))
generateUUIDv4 (toString(uuid()))
parseURL (CASE part WHEN 'protocol' THEN REGEXP_EXTRACT(url, '^(\w+)://') WHEN 'domain' THEN REGEXP_EXTRACT(url, '://([^/:]+)') WHEN 'port' THEN REGEXP_EXTRACT(url, ':(\d+)') WHEN 'path' THEN REGEXP_EXTRACT(url, '://[^/]+(/.+?)(?|#|$)') WHEN 'query' THEN REGEXP_EXTRACT(url, '?([^#]+)') WHEN 'fragment' THEN REGEXP_EXTRACT(url, '#(.+)$') END)
bitCount (BIT_COUNT(num))