DRILL-1663: Fix casting to a variable width type implicitly in a join condition

Factor out logic in ExpressionTreeMaterializer so the same logic can be reused in ChainedHashTable.
DRILL-1631: Bump optiq version to r8
Add test case. Fix is in optiq.
DRILL-1470 : cast into varchar should recognize the length parameter in varchar. Fix casting function implementation: the length parameter should mean # of chars, not # of bytes.

New unit test case to verify the result from cast function.

Fix bug in cast into varchar. When target length = 0, it means we want to keep the input .

code clean up.

Include change for varbinary cast as well.
DRILL-1592: Detect drillbit failure and cancel the affected running queries.

Revise code based on review comments.

Revise code based on comments: only track the newly dead drillbits.

Remove some debug msg.

Minor code change based on review comments.

clean up.