added Junit test in TestAST.materialziation_extensions to show issue.
If a query has say a filter and an assignment, which both use the same var.
If the filter is processed first, and adds a materialization step, since the var was put in the doneSet, a materialization step is not added for the var again for the assignment.
The issue arises if the filter step doesn't need materialization to do its processing, ie doing a compare of 2 ivs with the same datatype. In that case, the var is not materialized, but if the subsequent assignment does need the materialization, it throws and exception.