Skip to content

Instantly share code, notes, and snippets.

View gingerwizard's full-sized avatar

Dale McDiarmid gingerwizard

View GitHub Profile
@gingerwizard
gingerwizard / ski_resort_stats.csv
Created January 12, 2024 17:14
ski_resort_stats.csv
resort_name state summit base vertical lifts runs acres green_percent green_acres blue_percent blue_acres black_percent black_acres lat lon
49(degrees) North, WA Washington 5774 3923 1851 6 68 2325 0.3 697.5 0.4 930 0.3 697.5 49 -115.84
Afton Alps, MN Minnesota 700 350 350 21 48 300 0.2 60 0.6 180 0.2 60 44.85 -92.79
Alpine Meadows, CA California 8673 6385 2288 13 100 2400 0.25 600 0.4 960 0.35 840 39.17 -120.22
Alpine Mountain, PA Pennsylvania 1150 600 500 3 21 120 0.17 20.4 0.55 66 0.28 33.6 40.08 -76.9
Alpine Valley, MI Michigan 1210 910 300 14 25 118 0.39 46.02 0.26 30.68 0.35 41.3 44.96 -84.87
Alpine Valley, OH Ohio 1500 1260 230 6 11 72 0.33 23.76 0.34 24.48 0.33 23.76 40.31 -83.68
Alpine Valley, WI Wisconsin 388 16 20 90 0.4 36 0.4 36 0.2 18 42.45 -88.25
Alta, UT Utah 10550 8530 2020 11 116 2200 0.25 550 0.4 880 0.35 770 40.6 -111.64
Alyeska, AK Alaska 3939 250 2500 9 73 1500 0.11 165 0.52 780 0.37 555 60.97 -149.11
DESCRIBE TABLE gcs('https://storage.googleapis.com/clickhouse-website/ga-*.parquet', '<access key>', '<secret>')
FORMAT TSV

event_date    Nullable(String)
event_timestamp    Nullable(Int64)
event_name    Nullable(String)
event_params    Array(Tuple(key Nullable(String), value Tuple(string_value Nullable(String), int_value Nullable(Int64), float_value Nullable(Float64), double_value Nullable(Float64))))
event_previous_timestamp    Nullable(Int64)
event_value_in_usd    Nullable(Float64)
/*-----------------------------------------------------------------------*/
/* Program: STREAM */
/* Revision: $Id: stream.c,v 5.10 2013/01/17 16:01:06 mccalpin Exp mccalpin $ */
/* Original code developed by John D. McCalpin */
/* Programmers: John D. McCalpin */
/* Joe R. Zagar */
/* */
/* This program measures memory transfer rates in MB/s for simple */
/* computational kernels coded in C. */
/*-----------------------------------------------------------------------*/
name alpha-2 country-code
Afghanistan AF 004
Åland Islands AX 248
Albania AL 008
Algeria DZ 012
American Samoa AS 016
Andorra AD 020
Angola AO 024
Anguilla AI 660
Antarctica AQ 010
name alpha-2 country-code
Afghanistan AF 004
Åland Islands AX 248
Albania AL 008
Algeria DZ 012
American Samoa AS 016
Andorra AD 020
Angola AO 024
Anguilla AI 660
Antarctica AQ 010
name alpha-2 country-code
Afghanistan AF 004
Åland Islands AX 248
Albania AL 008
Algeria DZ 012
American Samoa AS 016
Andorra AD 020
Angola AO 024
Anguilla AI 660
Antarctica AQ 010
SELECT
    url,
    caption,
    L2Distance(image_embedding, [0.5736792683601379, 0.2516227662563324, 0.08648405969142914, -0.3087577521800995, 0.16166526079177856, -0.007050537504255772, -0.18505804240703583, -0.4547903835773468, -0.27521055936813354, -0.14916469156742096, -0.3867589235305786, -0.6603131294250488, -0.12612514197826385, 0.0861508697271347, -0.3013170063495636, -0.18740114569664001, -0.47240784764289856, 0.23528385162353516, 0.2165445238351822, -0.14971637725830078, -0.11677167564630508, 0.16455139219760895, 0.6751934885978699, 0.48457151651382446, -0.6089483499526978, 0.1328628659248352, 0.1305725872516632, -0.27523916959762573, 0.6474258899688721, 0.6060798764228821, 0.09428835660219193, -0.059794556349515915, -0.17287959158420563, 0.03964110463857651, -0.223852276802063, -0.026328448206186295, 0.16255885362625122, 0.39999595284461975, -0.2318170964717865, 0.5195636749267578, 0.35400936007499695, -0.3005162477493286, 0.581500768661499, -0.08902442455291748, -0.09745857864618301, -0.32

Below creates a Parquet file with 1 row group for UK house price dataset (28m rows, approx. 200mb Parquet with LZ4):

INSERT INTO FUNCTION file('house_prices-1-row-group.parquet') SELECT *
FROM uk_price_paid
SETTINGS min_insert_block_size_bytes = 10000000000, 
min_insert_block_size_rows=1000000000, 
output_format_parquet_row_group_size=1000000000               

The following assumes use of clickhouse-local, although these steps will alsowork with ClickHouse server.

1. Create table

CREATE TABLE uk_price_paid
(
    `price` UInt32,
    `date` Date,
    `postcode1` LowCardinality(String),
EXPLAIN indexes = 1
SELECT
    Timestamp,
    TraceId,
    SpanId,
    SpanName
FROM otel_traces
WHERE TraceId = '0f8a2c02d77d65da6b2c4d676985b3ab'