Currently, planner may choose merge join for full outer join for the case when another join types are enabled. When planner chooses merge join for full outer join an error is thrown when MergeJoinPOP is being created:
2018-06-15 10:22:05,815 [24dc6cb4-a0d1-f6a5-0af9-c6138bc326d3:foreman] ERROR o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: IllegalArgumentException: Full outer join not currently supported with Merge Join
It may be observed using TPC-DS query 51.
To fix this issue, the infinite cost should be set for merge rel node for the case when join type is full outer join.