Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CREATE OR REPLACE FUNCTION
`osm_planet.get_partitions`(name STRING)
RETURNS ARRAY<DATE> AS (
CASE
WHEN name="place-city" THEN ARRAY<DATE>["1970-01-01"]
WHEN name="place-town" THEN ARRAY<DATE>["1970-01-02"]
WHEN name="place-village" THEN ARRAY<DATE>["1970-01-03"]
WHEN name="place-hamlet" THEN ARRAY<DATE>["1970-01-04"]
WHEN name="place-national_capital" THEN ARRAY<DATE>["1970-01-05"]
WHEN name="place-suburb" THEN ARRAY<DATE>["1970-01-06"]
WHEN name="place-island" THEN ARRAY<DATE>["1970-01-07"]
WHEN name="place-farm" THEN ARRAY<DATE>["1970-01-08"]
WHEN name="place-dwelling" THEN ARRAY<DATE>["1970-01-09"]
WHEN name="place-region" THEN ARRAY<DATE>["1970-01-10"]
WHEN name="place-country" THEN ARRAY<DATE>["1970-01-11"]
WHEN name="place-locality" THEN ARRAY<DATE>["1970-01-12"]
WHEN name="place-named_place" THEN ARRAY<DATE>["1970-01-13"]
WHEN name="place" THEN ARRAY<DATE>["1900-01-01","1900-01-02","1900-01-03","1900-01-04","1900-01-05","1900-01-06","1900-01-07","1900-01-08","1900-01-09","1900-01-10","1900-01-11","1900-01-12","1900-01-13"]
ELSE ARRAY<DATE>[]
END
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.