where CTAS and IAS produce different results as a plain SELECT when using FULL JOINs and static value columns.
It's a regression. Seen in Impala 2.1.3+ (starting in CDH 5.3.5) but not earlier version.
Performing the same steps in Hive produce expected results. Also verified expected results in postgresql.
Testing using INSERT also produces the same incorrect result.
To produce correct results, you can rewrite the with a UNION ALL to force the inline-view results to be materialized.
Before CTAS with incorrect results:
After CTAS with correct results: