Skip to content

Instantly share code, notes, and snippets.

@MindFlavor
Created March 7, 2016 11:29
Show Gist options
  • Save MindFlavor/10b466b5fc6ddf3faf20 to your computer and use it in GitHub Desktop.
Save MindFlavor/10b466b5fc6ddf3faf20 to your computer and use it in GitHub Desktop.
@stations =
EXTRACT SensorId int,
SensorType string,
Measure string,
StationId int,
StationName string,
Height int,
Province string,
City string,
Address string,
dontcare0 string,
dontcare1 string,
dontcare2 string,
dontcare3 string,
dontcare4 string
FROM "/user/mindflavor/Stazioni_Meteorologiche_noheader.csv"
USING Extractors.Csv();
@events =
EXTRACT SensorId int,
Data DateTime,
Value float,
State string
FROM "/user/mindflavor/sensori_arpa_2015_noheader.csv"
USING Extractors.Csv();
@joined =
SELECT e.SensorId,
s.SensorType,
s.Measure,
s.StationId,
s.StationName,
s.Height,
s.Province,
s.City,
s.Address,
e.Data,
e.Value,
e.State
FROM @events AS e
LEFT OUTER JOIN
@stations AS s
ON
e.SensorId == s.SensorId;
OUTPUT @joined
TO "/user/mindflavor/output/joined.csv"
USING Outputters.Tsv();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment