Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benjaminlaird/03b1bbd323b6e7bb0455c0a7489a3529 to your computer and use it in GitHub Desktop.
Save benjaminlaird/03b1bbd323b6e7bb0455c0a7489a3529 to your computer and use it in GitHub Desktop.
Range join query
spark.sql('''
SELECT ips.ip, ips.ip_int, asns.asn
FROM ips inner join asns
ON ips.ip_network = asns.network
WHERE ips.ip_int > asns.ip_min and ips.ip_int < asns.ip_max
''').count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment