Skip to content

Commit

Permalink
Add data_source column, #12
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-milovidov committed Apr 21, 2024
1 parent ea8eade commit bc6a87f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion process-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

INPUT=$1
TMPFILE=/tmp/$$
#SOURCE='adsb.lol'

gzip -cd "$INPUT" | sed '/^"trace"/Q' | tr -d '\n' | sed -r -e 's/,$/}\n/' > ${TMPFILE}.meta.jsonl
gzip -cd "$INPUT" | grep '^\[' | sed -r -e 's/ ]$/,/' > ${TMPFILE}.data.jsonl
Expand Down Expand Up @@ -58,7 +59,8 @@ clickhouse-local --query "
geometric_altitude,
geometric_vertical_rate,
indicated_airspeed,
roll_angle
roll_angle,
'${SOURCE}'
FROM
file('${TMPFILE}.data.jsonl', JSONCompactEachRow, '
time_offset Decimal64(3),
Expand Down
4 changes: 3 additions & 1 deletion setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ CREATE TABLE planes_mercator
geometric_altitude Int32,
geometric_vertical_rate Int32,
indicated_airspeed Int32,
roll_angle Float32
roll_angle Float32,

data_source Enum8('', 'adsb.lol', 'adsbexchange', 'airplanes.live')
) ENGINE = MergeTree ORDER BY (mortonEncode(mercator_x, mercator_y), time);

CREATE TABLE planes_mercator_sample10 AS planes_mercator;
Expand Down

0 comments on commit bc6a87f

Please sign in to comment.