SQL: Fixes for spark graphs