Fixed an unnecessary hash map access in spark by only performing the lookup when we actually need the result. This should improve performance slightly, but most importantly, fix an issue in which spark failed due to non-existing types which are however not needed anyway.
improved generic typing
even more typing