Created
January 5, 2024 02:26
-
-
Save sundy-li/2a470c3c9be55d3c169ed5d849141332 to your computer and use it in GitHub Desktop.
1brc-databend.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## install databend | |
wget "https://github.com/datafuselabs/databend/releases/download/v1.2.279/databend-v1.2.279-x86_64-unknown-linux-musl.tar.gz" | |
tar -xzvf databend-v1.2.279-x86_64-unknown-linux-musl.tar.gz | |
time bin/databend-query local --query """ | |
CREATE FILE FORMAT my_format type = csv field_delimiter = ';' ; | |
WITH AGG AS( | |
select city, min(temperature) x , avg(temperature) y, max(temperature) z from(select \$1::String city, \$2::Float64 temperature from 'fs:///home/sundy/work/1brc/measurements.txt'(file_format => 'my_format')) | |
GROUP BY city | |
ORDER BY city | |
) | |
SELECT string_agg(city || '=' || CONCAT(x::String,'/', y::String,'/', z::String) || ', ') | |
FROM AGG; | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment