Allow splitting generated code in ChainedHashTable into blocks to avoid "code too large" error.
DRILL-4715 added ability to ensure that methods size won't go beyond the 64k limit imposed by JVM. BlkCreateMode.TRUE_IF_BOUND was added to create new block only if # of expressions added hit upper-bound defined by exec.java.compiler.exp_in_method_size. Once number of expressions in methods hits upper bound we create from call inner method.
During code generation ChainedHashTable added all code in its methods in one block (using BlkCreateMode.FALSE) since getHashBuild and getHashProbe methods contained state and thus could not be split. In these methods hash was generated for each key expression. For the first key seed was 0, subsequent keys hash was generated based on seed from previous key.
To allow splitting for there methods the following was done:
1. Method signatures was changed: added new parameter seedValue. Initially starting seed value was hard-coded during code generation (set to 0), now it is passed as method parameter.
2. Initially hash function call for all keys was transformed into one logical expression which did not allow splitting. Now we create logical expression for each key and thus splitting is possible. New seedValue parameter is used as seed holder to pass seed value for the next key.
3. ParameterExpression was added to generate reference to method parameter during code generation.
Examples of code generation:
HashTableGen5_for_40_columns_BEFORE.java - code compiles
HashTableGen5_for_40_columns_AFTER.java - code compiles
HashTableGen5_for_1200_columns_BEFORE.java - error during compilation, method too large
HashTableGen5_for_1200_columns_AFTER.java - code compiles since methods were split