Skip to content

Instantly share code, notes, and snippets.

@andreaskaempf
Created June 13, 2017 01:23
Show Gist options
  • Save andreaskaempf/932232b8267fdc0a00dff56e09b35254 to your computer and use it in GitHub Desktop.
Save andreaskaempf/932232b8267fdc0a00dff56e09b35254 to your computer and use it in GitHub Desktop.
Quick script to get ICAO codes from JSON files
// Read all JSON files in the current directory
val d = spark.read.json("*.json")
// Do the SQL query to get all ICAO codes for the US
d.registerTempTable("crap")
val regs = sql("select distinct Icao from crap where Cou = 'United States'")
// Save to a CSV file
regs.write.csv("US_transmitting_ICAO_codes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment