I know there are a lot of people with experience on developing database internals on this list. Please take a look at this proposal for a new, simpler way to handle view canonicalization in Spark SQL: https://issues.apache.org/jira/browse/SPARK-18209
It sounds much simpler than what we currently do in 2.0/2.1, but I'm not sure if there are obvious holes that I missed.