Skip to content

Instantly share code, notes, and snippets.

View BohuTANG's full-sized avatar

Bohu BohuTANG

View GitHub Profile
@BohuTANG
BohuTANG / hits-databend-schema
Created March 18, 2024 05:34
hits-databend-schema
CREATE OR REPLACE TABLE hits
(
WatchID BIGINT NOT NULL,
JavaEnable SMALLINT NOT NULL,
Title TEXT,
GoodEvent SMALLINT NOT NULL,
EventTime TIMESTAMP NOT NULL,
EventDate DATE NOT NULL,
CounterID INTEGER NOT NULL,
ClientIP INTEGER NOT NULL,
@BohuTANG
BohuTANG / hits-snowflake-schema
Last active March 18, 2024 05:31
hits-snowflake-schema
CREATE OR REPLACE TABLE hits
(
WatchID BIGINT NOT NULL,
JavaEnable SMALLINT NOT NULL,
Title TEXT,
GoodEvent SMALLINT NOT NULL,
EventTime TIMESTAMP NOT NULL,
EventDate DATE NOT NULL,
CounterID INTEGER NOT NULL,
ClientIP INTEGER NOT NULL,
@BohuTANG
BohuTANG / r2-tpch-q18
Created February 25, 2023 05:28
r2-tpch-q18
-- TPCH Q18
SELECT c_name,
c_custkey,
o_orderkey,
o_orderdate,
o_totalprice,
Sum(l_quantity)
FROM 'https://pub-0873f8bfe2ba4caa8c1b40c21b39bc10.r2.dev/customer/part-0.parquet' (file_format => 'parquet') AS customer,
'https://pub-0873f8bfe2ba4caa8c1b40c21b39bc10.r2.dev/orders/part-0.parquet' (file_format => 'parquet') AS orders,
@BohuTANG
BohuTANG / res
Created November 15, 2022 01:11
res
```
http query 1323b708-3b00-4bdd-9ec8-3ecef7faf350: already stopped, reason Ok(()), new reason Err(Code: 1043, displayText = killed by http.
<Backtrace disabled by default. Please use RUST_BACKTRACE=1 to enable> )
Log labels
fields_message http query 1323b708-3b00-4bdd-9ec8-3ecef7faf350: already stopped, reason Ok(()), new reason Err(Code: 1043, displayText = killed by http. <Backtrace disabled by default. Please use RUST_BACKTRACE=1 to enable> )
job databend-query
@BohuTANG
BohuTANG / databend-fd-issue
Created October 13, 2022 00:24
databend-fd-issue
Table:
```
create table t7861(
c1 VARCHAR NULL,
c2 VARCHAR NULL,
c3 VARCHAR NULL,
c4 VARCHAR NULL,
c5 VARCHAR NULL,
c6 VARCHAR NULL,
c7 VARCHAR NULL,
@BohuTANG
BohuTANG / tpcc-databend
Created June 19, 2022 02:57
tpcc-databend
CREATE DATABASE IF NOT EXISTS tpch;
USE tpch;
CREATE TABLE IF NOT EXISTS nation ( N_NATIONKEY INTEGER NOT NULL,
N_NAME VARCHAR NOT NULL,
N_REGIONKEY INT NOT NULL,
N_COMMENT VARCHAR);
CREATE TABLE IF NOT EXISTS region ( R_REGIONKEY INT NOT NULL,
R_NAME VARCHAR NOT NULL,
R_COMMENT VARCHAR);
@BohuTANG
BohuTANG / ontime-query.sql
Created January 21, 2022 04:38
ontime-query.sql
Q1:
SELECT DayOfWeek, count(*) AS c FROM ontime WHERE Year >= 2000 AND Year <= 2008 GROUP BY DayOfWeek ORDER BY c DESC;
Q2:
SELECT DayOfWeek, count(*) AS c FROM ontime WHERE DepDelay>10 AND Year >= 2000 AND Year <= 2008 GROUP BY DayOfWeek ORDER BY c DESC;
Q3:
SELECT Origin, count(*) AS c FROM ontime WHERE DepDelay>10 AND Year >= 2000 AND Year <= 2008 GROUP BY Origin ORDER BY c DESC LIMIT 10;
Q4:
@BohuTANG
BohuTANG / snow-ontime-schema.sql
Created January 21, 2022 02:15
snow-ontime-schema.sql
CREATE TABLE IF NOT EXISTS ontime (
YEAR NUMBER(38,0),
QUARTER NUMBER(38,0),
MONTH NUMBER(38,0),
DAYOFMONTH NUMBER(38,0),
DAYOFWEEK NUMBER(38,0),
FLIGHTDATE VARCHAR(16777216),
REPORTING_AIRLINE VARCHAR(16777216),
DOT_ID_REPORTING_AIRLINE NUMBER(38,0),
IATA_CODE_REPORTING_AIRLINE VARCHAR(16777216),
@BohuTANG
BohuTANG / clickhouse-21.9.1-numbers-table-performance
Created August 14, 2021 15:23
clickhouse-21.9.1-numbers-table-performance
bohu@thinkpad:~/github/cppwork/ClickHouse/build$ ./programs/clickhouse client
ClickHouse client version 21.9.1.1.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.9.1 revision 54449.
thinkpad :) SELECT avg(number) FROM numbers_mt(100000000000)
SELECT avg(number)
FROM numbers_mt(100000000000)
@BohuTANG
BohuTANG / datafuse-v0.4.76-nightly-numbers-table-performance
Created August 14, 2021 15:17
datafuse-v0.4.76-nightly-numbers-table-performance
bohu@thinkpad:~/github/cppwork/ClickHouse/build$ ./programs/clickhouse client
ClickHouse client version 21.9.1.1.
Connecting to localhost:9000 as user default.
Connected to datafuse server version 2021.5.0 revision 54405.
ClickHouse client version is older than ClickHouse server. It may lack support for new features.
datafuse :) SELECT avg(number) FROM numbers_mt(100000000000)
SELECT avg(number)