DECODE in SQL JOIN predicate | Query Optimization in Snowflake (QOSF)