You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2019/03/30 14:15:28 UTC

[hive] branch master updated: HIVE-21001: Upgrade to calcite-1.19 (Zoltan Haindrich reviewed by Jesus Camacho Rodriguez)

This is an automated email from the ASF dual-hosted git repository.

kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new dc0b16a  HIVE-21001: Upgrade to calcite-1.19 (Zoltan Haindrich reviewed by Jesus Camacho Rodriguez)
dc0b16a is described below

commit dc0b16ab66f69cb32a20921ea3adcfcf5466d331
Author: Zoltan Haindrich <ki...@rxd.hu>
AuthorDate: Sat Mar 30 15:10:30 2019 +0100

    HIVE-21001: Upgrade to calcite-1.19 (Zoltan Haindrich reviewed by Jesus Camacho Rodriguez)
    
    Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>
---
 .../positive/accumulo_predicate_pushdown.q.out     |   4 +-
 .../test/results/positive/accumulo_queries.q.out   |   8 +-
 .../results/positive/hbase_ppd_key_range.q.out     |   2 +-
 .../src/test/results/positive/hbase_pushdown.q.out |   2 +-
 .../src/test/results/positive/hbase_queries.q.out  |  12 +-
 pom.xml                                            |  12 +-
 .../hive/ql/optimizer/calcite/HiveRelBuilder.java  |  13 +-
 .../calcite/rules/HiveRelDecorrelator.java         |  15 +-
 .../calcite/rules/HiveSubQueryRemoveRule.java      |   5 +-
 .../optimizer/calcite/translator/ASTBuilder.java   |  47 +-
 .../optimizer/calcite/translator/ASTConverter.java |  51 +-
 .../hive/ql/optimizer/ppr/PartitionPruner.java     |  10 +-
 .../hadoop/hive/ql/parse/CalcitePlanner.java       |  68 +-
 .../hadoop/hive/ql/parse/TypeCheckProcFactory.java |   3 +
 .../queries/clientpositive/druidmini_expressions.q |  22 +-
 .../clientpositive/join_constraints_optimization.q |   2 +-
 .../test/queries/clientpositive/subquery_multi.q   |   4 +
 .../results/clientpositive/allcolref_in_udf.q.out  |   4 +-
 .../clientpositive/alter_partition_coltype.q.out   |   3 +
 .../clientpositive/annotate_stats_filter.q.out     |  12 +-
 .../clientpositive/annotate_stats_join_pkfk.q.out  |   4 +-
 .../test/results/clientpositive/auto_join2.q.out   |  12 +-
 .../test/results/clientpositive/auto_join33.q.out  |   8 +-
 .../results/clientpositive/auto_join_stats.q.out   |  60 +-
 .../results/clientpositive/auto_join_stats2.q.out  |  28 +-
 .../clientpositive/cbo_rp_simple_select.q.out      |  68 +-
 .../results/clientpositive/cbo_simple_select.q.out |  68 +-
 ql/src/test/results/clientpositive/char_udf1.q.out |   2 +-
 .../results/clientpositive/complex_alias.q.out     |   8 +-
 .../results/clientpositive/constantPropWhen.q.out  |   8 +-
 .../results/clientpositive/constant_prop_3.q.out   |   2 +-
 .../clientpositive/constprog_when_case.q.out       |   2 +-
 ql/src/test/results/clientpositive/cte_mat_5.q.out |   8 +-
 .../test/results/clientpositive/decimal_udf.q.out  |   8 +-
 .../druid/druidmini_expressions.q.out              | 176 ++++-
 .../druid/druidmini_extractTime.q.out              |   4 +-
 .../clientpositive/druid/druidmini_floorTime.q.out |   4 +-
 .../clientpositive/druid/druidmini_test_ts.q.out   |  13 +-
 .../dynamic_partition_skip_default.q.out           |   3 +
 .../encryption_join_unencrypted_tbl.q.out          |  12 +-
 .../test/results/clientpositive/except_all.q.out   |  10 +-
 .../clientpositive/filter_cond_pushdown.q.out      |   2 +-
 ql/src/test/results/clientpositive/fold_case.q.out |  14 +-
 .../clientpositive/fold_eq_with_case_when.q.out    |   9 +-
 .../test/results/clientpositive/fold_to_null.q.out |  12 +-
 ql/src/test/results/clientpositive/fold_when.q.out |   8 +-
 .../groupby_grouping_sets_grouping.q.out           |  10 +-
 .../clientpositive/groupby_rollup_empty.q.out      |   2 +-
 .../results/clientpositive/groupby_sort_1_23.q.out |   4 +-
 .../clientpositive/groupby_sort_skew_1_23.q.out    |   4 +-
 .../results/clientpositive/in_typecheck_char.q.out |   4 +-
 .../infer_bucket_sort_map_operators.q.out          |   6 +-
 .../results/clientpositive/infer_join_preds.q.out  |   4 +-
 .../test/results/clientpositive/innerjoin1.q.out   |  52 +-
 ql/src/test/results/clientpositive/input8.q.out    |  12 +-
 ql/src/test/results/clientpositive/join2.q.out     |  12 +-
 .../clientpositive/join_filters_overlap.q.out      |  50 ++
 .../results/clientpositive/list_bucket_dml_6.q.out |   4 +-
 .../results/clientpositive/list_bucket_dml_7.q.out |   4 +-
 .../results/clientpositive/list_bucket_dml_8.q.out |   2 +-
 .../list_bucket_query_multiskew_2.q.out            |   3 +
 .../llap/auto_sortmerge_join_12.q.out              | 221 +++---
 .../llap/auto_sortmerge_join_16.q.out              |   6 +-
 .../llap/auto_sortmerge_join_6.q.out               |  24 +-
 .../clientpositive/llap/bucket_map_join_tez2.q.out |  39 +-
 .../clientpositive/llap/bucketpruning1.q.out       |  41 +-
 .../clientpositive/llap/cbo_simple_select.q.out    |  23 +-
 .../llap/constraints_optimization.q.out            |  10 +-
 .../results/clientpositive/llap/cte_mat_5.q.out    |   4 +-
 .../llap/current_date_timestamp.q.out              |   2 +-
 .../clientpositive/llap/default_constraint.q.out   |  10 +-
 .../llap/dynamic_partition_pruning.q.out           | 372 +++++-----
 .../llap/dynamic_semijoin_reduction_2.q.out        |   4 +-
 .../clientpositive/llap/except_distinct.q.out      |  10 +-
 .../clientpositive/llap/explainuser_1.q.out        |  46 +-
 .../clientpositive/llap/groupby_rollup_empty.q.out |   2 +-
 .../llap/join_constraints_optimization.q.out       |  58 +-
 ql/src/test/results/clientpositive/llap/kryo.q.out |   2 +-
 .../results/clientpositive/llap/lineage3.q.out     |  18 +-
 .../results/clientpositive/llap/mapjoin_hint.q.out | 252 +++----
 .../llap/materialized_view_create_rewrite_3.q.out  |   4 +-
 .../llap/materialized_view_create_rewrite_4.q.out  |   8 +-
 .../llap/materialized_view_create_rewrite_5.q.out  |   8 +-
 ...ialized_view_create_rewrite_rebuild_dummy.q.out |   4 +-
 ...erialized_view_create_rewrite_time_window.q.out |   4 +-
 .../llap/materialized_view_rewrite_1.q.out         |   4 +-
 .../llap/materialized_view_rewrite_10.q.out        |   2 +-
 .../llap/materialized_view_rewrite_4.q.out         |   4 +-
 .../llap/materialized_view_rewrite_7.q.out         |   4 +-
 .../materialized_view_rewrite_no_join_opt.q.out    |   2 +-
 .../results/clientpositive/llap/mergejoin.q.out    |   6 +-
 .../clientpositive/llap/optimize_join_ptp.q.out    |   4 +-
 .../clientpositive/llap/orc_ppd_varchar.q.out      |   4 +-
 .../results/clientpositive/llap/sharedwork.q.out   |   4 +-
 .../results/clientpositive/llap/subquery_in.q.out  | 154 ++--
 .../clientpositive/llap/subquery_in_having.q.out   |   2 +-
 .../clientpositive/llap/subquery_multi.q.out       |  84 ++-
 .../clientpositive/llap/subquery_notin.q.out       | 432 +++++------
 .../clientpositive/llap/subquery_null_agg.q.out    |  77 +-
 .../clientpositive/llap/subquery_scalar.q.out      | 177 +++--
 .../clientpositive/llap/subquery_select.q.out      |  62 +-
 .../clientpositive/llap/subquery_views.q.out       |  18 +-
 .../llap/tez_dynpart_hashjoin_2.q.out              |  42 +-
 .../clientpositive/llap/tez_smb_reduce_side.q.out  |  16 +-
 .../llap/tez_vector_dynpart_hashjoin_2.q.out       |  42 +-
 .../clientpositive/llap/unionDistinct_1.q.out      |  13 +
 .../llap/vector_adaptor_usage_mode.q.out           |   4 +-
 .../clientpositive/llap/vector_case_when_1.q.out   |  20 +-
 .../clientpositive/llap/vector_case_when_2.q.out   |  24 +-
 .../clientpositive/llap/vector_char_mapjoin1.q.out |   6 +-
 .../clientpositive/llap/vector_coalesce_3.q.out    |  10 +-
 .../clientpositive/llap/vector_date_1.q.out        |  54 +-
 .../llap/vector_decimal_math_funcs.q.out           |   8 +-
 .../vector_groupby_grouping_sets_grouping.q.out    |  10 +-
 .../llap/vector_groupby_mapjoin.q.out              |   4 +-
 .../clientpositive/llap/vector_interval_2.q.out    |  56 +-
 .../llap/vector_interval_mapjoin.q.out             |  22 +-
 .../llap/vector_orc_nested_column_pruning.q.out    |  22 +-
 .../llap/vector_varchar_mapjoin1.q.out             |   4 +-
 .../llap/vector_windowing_navfn.q.out              |  10 +-
 .../clientpositive/llap/vectorization_0.q.out      |  32 +-
 .../clientpositive/llap/vectorization_5.q.out      |   6 +-
 .../clientpositive/llap/vectorization_6.q.out      |   6 +-
 .../clientpositive/llap/vectorization_8.q.out      |  12 +-
 .../clientpositive/llap/vectorization_div0.q.out   |   2 +-
 .../llap/vectorization_short_regress.q.out         |  40 +-
 .../clientpositive/llap/vectorized_casts.q.out     |   8 +-
 .../vectorized_dynamic_partition_pruning.q.out     | 269 ++++---
 .../llap/vectorized_math_funcs.q.out               |   4 +-
 .../llap/vectorized_string_funcs.q.out             |   4 +-
 .../llap/vectorized_timestamp_ints_casts.q.out     |   8 +-
 ql/src/test/results/clientpositive/masking_1.q.out |   8 +-
 .../test/results/clientpositive/masking_12.q.out   |  12 +-
 ql/src/test/results/clientpositive/masking_2.q.out |  12 +-
 ql/src/test/results/clientpositive/masking_3.q.out |  88 +--
 ql/src/test/results/clientpositive/masking_4.q.out |  12 +-
 ql/src/test/results/clientpositive/mergejoin.q.out |   4 +-
 .../clientpositive/nested_column_pruning.q.out     |  10 +-
 .../clientpositive/optimize_filter_literal.q.out   |   1 -
 .../clientpositive/orc_nested_column_pruning.q.out |  10 +-
 .../test/results/clientpositive/orc_ppd_char.q.out |   8 +-
 .../clientpositive/parquet_vectorization_0.q.out   |  28 +-
 .../clientpositive/parquet_vectorization_5.q.out   |   6 +-
 .../clientpositive/parquet_vectorization_6.q.out   |   6 +-
 .../clientpositive/parquet_vectorization_8.q.out   |  12 +-
 .../parquet_vectorization_div0.q.out               |   2 +-
 ql/src/test/results/clientpositive/pcr.q.out       |  22 +-
 ql/src/test/results/clientpositive/pcs.q.out       |  44 +-
 .../clientpositive/perf/spark/query11.q.out        |   2 +-
 .../clientpositive/perf/spark/query13.q.out        |   4 +-
 .../clientpositive/perf/spark/query21.q.out        |   2 +-
 .../clientpositive/perf/spark/query27.q.out        |   2 +-
 .../clientpositive/perf/spark/query31.q.out        |   2 +-
 .../clientpositive/perf/spark/query34.q.out        |   6 +-
 .../clientpositive/perf/spark/query36.q.out        |   8 +-
 .../results/clientpositive/perf/spark/query4.q.out |   2 +-
 .../clientpositive/perf/spark/query45.q.out        |  60 +-
 .../clientpositive/perf/spark/query47.q.out        |   2 +-
 .../clientpositive/perf/spark/query48.q.out        |   4 +-
 .../clientpositive/perf/spark/query53.q.out        |   2 +-
 .../clientpositive/perf/spark/query57.q.out        |   2 +-
 .../clientpositive/perf/spark/query63.q.out        |   2 +-
 .../clientpositive/perf/spark/query67.q.out        |   2 +-
 .../clientpositive/perf/spark/query70.q.out        |   8 +-
 .../clientpositive/perf/spark/query73.q.out        |   6 +-
 .../clientpositive/perf/spark/query74.q.out        |   2 +-
 .../clientpositive/perf/spark/query78.q.out        | 212 +++---
 .../clientpositive/perf/spark/query85.q.out        |   4 +-
 .../clientpositive/perf/spark/query86.q.out        |   8 +-
 .../clientpositive/perf/spark/query87.q.out        |   4 +-
 .../clientpositive/perf/spark/query88.q.out        |  64 +-
 .../clientpositive/perf/spark/query89.q.out        |   2 +-
 .../clientpositive/perf/spark/query93.q.out        |  18 +-
 .../clientpositive/perf/spark/query97.q.out        |   2 +-
 .../clientpositive/perf/tez/cbo_ext_query1.q.out   |   4 +-
 .../clientpositive/perf/tez/cbo_query1.q.out       |   2 +-
 .../clientpositive/perf/tez/cbo_query11.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query12.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query13.q.out      |  20 +-
 .../clientpositive/perf/tez/cbo_query14.q.out      |  12 +-
 .../clientpositive/perf/tez/cbo_query15.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query16.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query17.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query2.q.out       |   4 +-
 .../clientpositive/perf/tez/cbo_query20.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query21.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query23.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query24.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query25.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query27.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query28.q.out      |  12 +-
 .../clientpositive/perf/tez/cbo_query29.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query30.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query31.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query32.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query33.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query34.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query36.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query37.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query39.q.out      |   8 +-
 .../clientpositive/perf/tez/cbo_query4.q.out       |  22 +-
 .../clientpositive/perf/tez/cbo_query40.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query43.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query47.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query48.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query49.q.out      |  18 +-
 .../clientpositive/perf/tez/cbo_query5.q.out       |  24 +-
 .../clientpositive/perf/tez/cbo_query50.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query53.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query54.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query56.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query57.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query58.q.out      |  12 +-
 .../clientpositive/perf/tez/cbo_query59.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query6.q.out       |   2 +-
 .../clientpositive/perf/tez/cbo_query60.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query61.q.out      |  10 +-
 .../clientpositive/perf/tez/cbo_query63.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query64.q.out      |  10 +-
 .../clientpositive/perf/tez/cbo_query65.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query66.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query73.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query74.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query75.q.out      |  14 +-
 .../clientpositive/perf/tez/cbo_query76.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query77.q.out      |  18 +-
 .../clientpositive/perf/tez/cbo_query78.q.out      |  87 +--
 .../clientpositive/perf/tez/cbo_query80.q.out      |  18 +-
 .../clientpositive/perf/tez/cbo_query81.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query82.q.out      |   4 +-
 .../clientpositive/perf/tez/cbo_query83.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query85.q.out      |   8 +-
 .../clientpositive/perf/tez/cbo_query87.q.out      |   8 +-
 .../clientpositive/perf/tez/cbo_query88.q.out      |  16 +-
 .../clientpositive/perf/tez/cbo_query89.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query91.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query92.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query93.q.out      |  10 +-
 .../clientpositive/perf/tez/cbo_query94.q.out      |   6 +-
 .../clientpositive/perf/tez/cbo_query95.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query97.q.out      |   2 +-
 .../clientpositive/perf/tez/cbo_query98.q.out      |   4 +-
 .../perf/tez/constraints/cbo_ext_query1.q.out      |  60 +-
 .../perf/tez/constraints/cbo_query1.q.out          |  30 +-
 .../perf/tez/constraints/cbo_query11.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query12.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query13.q.out         |  18 +-
 .../perf/tez/constraints/cbo_query14.q.out         |  12 +-
 .../perf/tez/constraints/cbo_query15.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query16.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query17.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query2.q.out          |   4 +-
 .../perf/tez/constraints/cbo_query20.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query21.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query23.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query24.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query25.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query27.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query28.q.out         |  12 +-
 .../perf/tez/constraints/cbo_query29.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query30.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query31.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query32.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query33.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query34.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query36.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query37.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query39.q.out         |   8 +-
 .../perf/tez/constraints/cbo_query4.q.out          |  22 +-
 .../perf/tez/constraints/cbo_query40.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query43.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query46.q.out         |  50 +-
 .../perf/tez/constraints/cbo_query47.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query48.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query49.q.out         |  18 +-
 .../perf/tez/constraints/cbo_query5.q.out          |  24 +-
 .../perf/tez/constraints/cbo_query50.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query53.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query54.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query56.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query57.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query58.q.out         |   8 +-
 .../perf/tez/constraints/cbo_query59.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query6.q.out          |  66 +-
 .../perf/tez/constraints/cbo_query60.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query61.q.out         |  10 +-
 .../perf/tez/constraints/cbo_query63.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query64.q.out         |  10 +-
 .../perf/tez/constraints/cbo_query65.q.out         |  10 +-
 .../perf/tez/constraints/cbo_query66.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query68.q.out         |  50 +-
 .../perf/tez/constraints/cbo_query72.q.out         |  22 +-
 .../perf/tez/constraints/cbo_query73.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query74.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query75.q.out         |  14 +-
 .../perf/tez/constraints/cbo_query76.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query77.q.out         |  18 +-
 .../perf/tez/constraints/cbo_query78.q.out         |  84 +--
 .../perf/tez/constraints/cbo_query80.q.out         |  18 +-
 .../perf/tez/constraints/cbo_query81.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query82.q.out         |   4 +-
 .../perf/tez/constraints/cbo_query83.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query85.q.out         |   8 +-
 .../perf/tez/constraints/cbo_query87.q.out         |   8 +-
 .../perf/tez/constraints/cbo_query88.q.out         |  16 +-
 .../perf/tez/constraints/cbo_query89.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query91.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query92.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query94.q.out         |   6 +-
 .../perf/tez/constraints/cbo_query95.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query97.q.out         |   2 +-
 .../perf/tez/constraints/cbo_query98.q.out         |   4 +-
 .../perf/tez/constraints/mv_query44.q.out          | 208 +++---
 .../perf/tez/constraints/query1.q.out              | 140 ++--
 .../perf/tez/constraints/query11.q.out             |   2 +-
 .../perf/tez/constraints/query13.q.out             |   2 +-
 .../perf/tez/constraints/query21.q.out             |   2 +-
 .../perf/tez/constraints/query31.q.out             |   2 +-
 .../perf/tez/constraints/query34.q.out             |   4 +-
 .../perf/tez/constraints/query36.q.out             |   4 +-
 .../perf/tez/constraints/query4.q.out              |   4 +-
 .../perf/tez/constraints/query44.q.out             | 208 +++---
 .../perf/tez/constraints/query45.q.out             | 222 +++---
 .../perf/tez/constraints/query46.q.out             | 204 ++---
 .../perf/tez/constraints/query47.q.out             |   2 +-
 .../perf/tez/constraints/query48.q.out             |   2 +-
 .../perf/tez/constraints/query53.q.out             |   2 +-
 .../perf/tez/constraints/query57.q.out             |   2 +-
 .../perf/tez/constraints/query6.q.out              | 236 +++---
 .../perf/tez/constraints/query63.q.out             |   2 +-
 .../perf/tez/constraints/query68.q.out             | 204 ++---
 .../perf/tez/constraints/query70.q.out             |   4 +-
 .../perf/tez/constraints/query72.q.out             | 150 ++--
 .../perf/tez/constraints/query73.q.out             |   4 +-
 .../perf/tez/constraints/query74.q.out             |   2 +-
 .../perf/tez/constraints/query78.q.out             | 326 ++++----
 .../perf/tez/constraints/query85.q.out             |   2 +-
 .../perf/tez/constraints/query86.q.out             |   4 +-
 .../perf/tez/constraints/query87.q.out             |   4 +-
 .../perf/tez/constraints/query88.q.out             |   2 +-
 .../perf/tez/constraints/query89.q.out             |   2 +-
 .../results/clientpositive/perf/tez/query11.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query13.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query21.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query31.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query34.q.out  |   4 +-
 .../results/clientpositive/perf/tez/query36.q.out  |   4 +-
 .../results/clientpositive/perf/tez/query4.q.out   |   4 +-
 .../results/clientpositive/perf/tez/query45.q.out  | 120 +--
 .../results/clientpositive/perf/tez/query47.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query48.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query53.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query57.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query63.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query70.q.out  |   4 +-
 .../results/clientpositive/perf/tez/query73.q.out  |   4 +-
 .../results/clientpositive/perf/tez/query74.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query78.q.out  | 374 +++++-----
 .../results/clientpositive/perf/tez/query85.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query86.q.out  |   4 +-
 .../results/clientpositive/perf/tez/query87.q.out  |   4 +-
 .../results/clientpositive/perf/tez/query88.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query89.q.out  |   2 +-
 .../results/clientpositive/perf/tez/query93.q.out  |  20 +-
 .../test/results/clientpositive/pointlookup.q.out  |   2 +
 .../test/results/clientpositive/pointlookup2.q.out |  20 +
 .../test/results/clientpositive/pointlookup3.q.out |  17 +
 .../test/results/clientpositive/pointlookup4.q.out |   4 +
 .../results/clientpositive/ppd_constant_expr.q.out |  24 +-
 .../results/clientpositive/ppd_join_filter.q.out   |   8 +-
 ql/src/test/results/clientpositive/row__id.q.out   |   4 +-
 ql/src/test/results/clientpositive/semijoin4.q.out |   4 +-
 ql/src/test/results/clientpositive/semijoin5.q.out |   4 +-
 .../results/clientpositive/skewjoinopt18.q.out     |   8 +-
 .../results/clientpositive/spark/auto_join2.q.out  |  12 +-
 .../clientpositive/spark/auto_join_stats.q.out     |  28 +-
 .../clientpositive/spark/auto_join_stats2.q.out    |  28 +-
 .../spark/auto_sortmerge_join_12.q.out             | 226 +++---
 .../spark/auto_sortmerge_join_16.q.out             |   2 +-
 .../spark/auto_sortmerge_join_16.q.out_spark       |   2 +-
 .../spark/auto_sortmerge_join_6.q.out              |  24 +-
 .../spark/bucket_map_join_tez2.q.out               |  39 +-
 .../clientpositive/spark/cbo_simple_select.q.out   |  23 +-
 .../clientpositive/spark/groupby_sort_1_23.q.out   |   4 +-
 .../spark/groupby_sort_skew_1_23.q.out             |   4 +-
 .../spark/infer_bucket_sort_map_operators.q.out    |   6 +-
 .../test/results/clientpositive/spark/join2.q.out  |  12 +-
 .../spark/join_filters_overlap.q.out               |  50 ++
 .../spark/parquet_vectorization_0.q.out            |  22 +-
 .../spark/parquet_vectorization_5.q.out            |   6 +-
 .../spark/parquet_vectorization_6.q.out            |   6 +-
 .../spark/parquet_vectorization_8.q.out            |  12 +-
 .../spark/parquet_vectorization_div0.q.out         |   2 +-
 ql/src/test/results/clientpositive/spark/pcr.q.out |  22 +-
 .../clientpositive/spark/ppd_join_filter.q.out     |   8 +-
 .../clientpositive/spark/skewjoinopt18.q.out       |   8 +-
 .../spark/spark_dynamic_partition_pruning.q.out    | 411 +++++-----
 .../clientpositive/spark/spark_explainuser_1.q.out |  46 +-
 .../spark/spark_use_ts_stats_for_mapjoin.q.out     |  12 +-
 ...park_vectorized_dynamic_partition_pruning.q.out | 825 +++++++++++----------
 .../results/clientpositive/spark/subquery_in.q.out | 152 ++--
 .../clientpositive/spark/subquery_multi.q.out      |  92 ++-
 .../clientpositive/spark/subquery_notin.q.out      | 491 +++++-------
 .../clientpositive/spark/subquery_null_agg.q.out   |  60 +-
 .../clientpositive/spark/subquery_scalar.q.out     | 176 +++--
 .../clientpositive/spark/subquery_select.q.out     |  48 +-
 .../clientpositive/spark/subquery_views.q.out      |  22 +-
 .../results/clientpositive/spark/union22.q.out     |  11 +
 .../clientpositive/spark/vectorization_0.q.out     |  26 +-
 .../clientpositive/spark/vectorization_5.q.out     |   6 +-
 .../clientpositive/spark/vectorization_6.q.out     |   6 +-
 .../clientpositive/spark/vectorization_div0.q.out  |   2 +-
 .../spark/vectorization_short_regress.q.out        |  40 +-
 .../spark/vectorized_math_funcs.q.out              |   4 +-
 .../spark/vectorized_string_funcs.q.out            |   4 +-
 .../clientpositive/subquery_notexists.q.out        |   8 +-
 .../clientpositive/subquery_notin_having.q.out     |  22 +-
 .../clientpositive/subquery_unqualcolumnrefs.q.out |   8 +-
 .../clientpositive/timestamp_ints_casts.q.out      |   8 +-
 .../clientpositive/udf_isops_simplify.q.out        |   2 +-
 .../clientpositive/udf_to_unix_timestamp.q.out     |   8 +-
 ql/src/test/results/clientpositive/union22.q.out   |  11 +
 .../test/results/clientpositive/union_offcbo.q.out |  60 +-
 .../clientpositive/vector_case_when_1.q.out        |  20 +-
 .../clientpositive/vector_case_when_2.q.out        |  20 +-
 .../clientpositive/vector_char_mapjoin1.q.out      |   6 +-
 .../results/clientpositive/vector_coalesce_3.q.out |   2 +-
 .../results/clientpositive/vector_date_1.q.out     |  38 +-
 .../clientpositive/vector_decimal_math_funcs.q.out |   8 +-
 .../clientpositive/vector_groupby_mapjoin.q.out    |  10 +-
 .../clientpositive/vector_interval_mapjoin.q.out   |  18 +-
 .../clientpositive/vector_varchar_mapjoin1.q.out   |   4 +-
 .../results/clientpositive/vectorization_5.q.out   |   6 +-
 .../results/clientpositive/vectorization_6.q.out   |   6 +-
 .../results/clientpositive/vectorization_8.q.out   |  12 +-
 .../results/clientpositive/vectorized_casts.q.out  |   8 +-
 .../clientpositive/vectorized_math_funcs.q.out     |   4 +-
 .../clientpositive/vectorized_string_funcs.q.out   |   4 +-
 .../vectorized_timestamp_ints_casts.q.out          |   8 +-
 ql/src/test/results/clientpositive/view_cbo.q.out  |   2 +-
 440 files changed, 6203 insertions(+), 5692 deletions(-)

diff --git a/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out b/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
index fb8fca9..63368c2 100644
--- a/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
+++ b/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
@@ -414,10 +414,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: accumulo_pushdown
-            filterExpr: (not COALESCE((key < '90'),false)) (type: boolean)
+            filterExpr: (key < '90') is not true (type: boolean)
             Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (not COALESCE((key < '90'),false)) (type: boolean)
+              predicate: (key < '90') is not true (type: boolean)
               Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
diff --git a/accumulo-handler/src/test/results/positive/accumulo_queries.q.out b/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
index 80a7dc9..c5379c7 100644
--- a/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
+++ b/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
@@ -147,7 +147,7 @@ STAGE PLANS:
             alias: accumulo_table_1
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int)
@@ -162,7 +162,7 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string)
@@ -551,7 +551,7 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Group By Operator
                 aggregations: count(key)
@@ -592,7 +592,7 @@ STAGE PLANS:
             alias: accumulo_table_1
             Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
diff --git a/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out b/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
index b80738b..5ab5bb3 100644
--- a/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
@@ -416,7 +416,7 @@ STAGE PLANS:
             alias: hbase_pushdown
             Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (not COALESCE((key < '90'),false)) (type: boolean)
+              predicate: (key < '90') is not true (type: boolean)
               Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
diff --git a/hbase-handler/src/test/results/positive/hbase_pushdown.q.out b/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
index f37460c..d3cdd9e 100644
--- a/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
@@ -305,7 +305,7 @@ STAGE PLANS:
             alias: hbase_pushdown
             Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (not COALESCE((key = 90),false)) (type: boolean)
+              predicate: (key = 90) is not true (type: boolean)
               Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string)
diff --git a/hbase-handler/src/test/results/positive/hbase_queries.q.out b/hbase-handler/src/test/results/positive/hbase_queries.q.out
index cfcfaf3..adf8864 100644
--- a/hbase-handler/src/test/results/positive/hbase_queries.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_queries.q.out
@@ -146,7 +146,7 @@ STAGE PLANS:
             alias: hbase_table_1
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int)
@@ -159,10 +159,10 @@ STAGE PLANS:
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: src
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string)
@@ -549,10 +549,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Group By Operator
                 aggregations: count(key)
@@ -593,7 +593,7 @@ STAGE PLANS:
             alias: hbase_table_1
             Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
diff --git a/pom.xml b/pom.xml
index cf80540..6a4b250 100644
--- a/pom.xml
+++ b/pom.xml
@@ -127,7 +127,7 @@
     <avatica.version>1.12.0</avatica.version>
     <avro.version>1.8.2</avro.version>
     <bonecp.version>0.8.0.RELEASE</bonecp.version>
-    <calcite.version>1.17.0</calcite.version>
+    <calcite.version>1.19.0</calcite.version>
     <datanucleus-api-jdo.version>4.2.4</datanucleus-api-jdo.version>
     <datanucleus-core.version>4.1.17</datanucleus-core.version>
     <datanucleus-rdbms.version>4.1.19</datanucleus-rdbms.version>
@@ -225,6 +225,16 @@
   <repositories>
    <!-- This needs to be removed before checking in-->
     <repository>
+      <id>central</id>
+      <name>central</name>
+      <url>https://repo.maven.apache.org/maven2</url>
+      <layout>default</layout>
+      <releases>
+        <enabled>true</enabled>
+        <checksumPolicy>warn</checksumPolicy>
+      </releases>
+    </repository>
+    <repository>
       <id>datanucleus</id>
       <name>datanucleus maven repository</name>
       <url>http://www.datanucleus.org/downloads/maven2</url>
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelBuilder.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelBuilder.java
index e85a99e..4794883 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelBuilder.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelBuilder.java
@@ -41,9 +41,6 @@ import org.apache.hadoop.hive.ql.optimizer.calcite.functions.HiveSqlSumAggFuncti
 import org.apache.hadoop.hive.ql.optimizer.calcite.functions.HiveSqlSumEmptyIsZeroAggFunction;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveFloorDate;
 
-import java.util.HashMap;
-import java.util.Map;
-
 
 /**
  * Builder for relational expressions in Hive.
@@ -66,6 +63,7 @@ public class HiveRelBuilder extends RelBuilder {
     final RelOptSchema[] relOptSchemas = {null};
     Frameworks.withPrepare(
         new Frameworks.PrepareAction<Void>(config) {
+          @Override
           public Void apply(RelOptCluster cluster, RelOptSchema relOptSchema,
               SchemaPlus rootSchema, CalciteServerStatement statement) {
             clusters[0] = cluster;
@@ -80,6 +78,7 @@ public class HiveRelBuilder extends RelBuilder {
    * Just add a {@link RelOptCluster} and a {@link RelOptSchema} */
   public static RelBuilderFactory proto(final Context context) {
     return new RelBuilderFactory() {
+      @Override
       public RelBuilder create(RelOptCluster cluster, RelOptSchema schema) {
         return new HiveRelBuilder(context, cluster, schema);
       }
@@ -153,4 +152,12 @@ public class HiveRelBuilder extends RelBuilder {
     return null;
   }
 
+  @Override
+  protected boolean shouldMergeProject() {
+    /* CALCITE-2470 added ability to merge Project-s together.
+     * The problem with it is that it may merge 2 windowing expressions.
+     */
+    return false;
+  }
+
 }
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java
index 238ae4e..dd5eb41 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java
@@ -275,6 +275,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
 
   private Function2<RelNode, RelNode, Void> createCopyHook() {
     return new Function2<RelNode, RelNode, Void>() {
+      @Override
       public Void apply(RelNode oldNode, RelNode newNode) {
         if (cm.mapRefRelToCorRef.containsKey(oldNode)) {
           final CorelMap corelMap = new CorelMapBuilder().build(newNode);
@@ -1193,7 +1194,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
       final RexFieldAccess f = (RexFieldAccess) e;
       if (f.getField().getIndex() == correlation.field
           && f.getReferenceExpr() instanceof RexCorrelVariable) {
-        if (((RexCorrelVariable) f.getReferenceExpr()).id == correlation.corr) {
+        if (((RexCorrelVariable) f.getReferenceExpr()).id.equals(correlation.corr)) {
           return true;
         }
       }
@@ -2193,6 +2194,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
                               operand(Aggregate.class, any()))));
     }
 
+    @Override
     public void onMatch(RelOptRuleCall call) {
       Aggregate singleAggregate = call.rel(0);
       Project project = call.rel(1);
@@ -2242,6 +2244,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
                                       operand(RelNode.class, any())))));
     }
 
+    @Override
     public void onMatch(RelOptRuleCall call) {
       final LogicalCorrelate correlate = call.rel(0);
       final RelNode left = call.rel(1);
@@ -2444,6 +2447,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
                                               operand(RelNode.class, any()))))));
     }
 
+    @Override
     public void onMatch(RelOptRuleCall call) {
       final LogicalCorrelate correlate = call.rel(0);
       final RelNode left = call.rel(1);
@@ -2825,6 +2829,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
       this.flavor = flavor;
     }
 
+    @Override
     public void onMatch(RelOptRuleCall call) {
       final LogicalCorrelate correlate = call.rel(0);
       final RelNode left = call.rel(1);
@@ -2975,6 +2980,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
           && field == ((CorRef) o).field;
     }
 
+    @Override
     public int compareTo(@Nonnull CorRef o) {
       int c = corr.compareTo(o.corr);
       if (c != 0) {
@@ -3025,6 +3031,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
           && field == ((CorDef) o).field;
     }
 
+    @Override
     public int compareTo(@Nonnull CorDef o) {
       int c = corr.compareTo(o.corr);
       if (c != 0) {
@@ -3158,7 +3165,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
       return rel;
     }
     @Override public RelNode visit(HiveProject rel) {
-      if(!(hasRexOver(((HiveProject)rel).getProjects()))) {
+      if(!(hasRexOver(rel.getProjects()))) {
         mightRequireValueGen = false;
         return super.visit(rel);
       } else {
@@ -3199,6 +3206,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
         Multimaps.newSortedSetMultimap(
             new HashMap<RelNode, Collection<CorRef>>(),
             new Supplier<TreeSet<CorRef>>() {
+              @Override
               public TreeSet<CorRef> get() {
                 Bug.upgrade("use MultimapBuilder when we're on Guava-16");
                 return Sets.newTreeSet();
@@ -3219,6 +3227,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
               mapFieldAccessToCorVar);
     }
 
+    @Override
     public RelNode visit(HiveJoin join) {
       try {
         Stacks.push(stack, join);
@@ -3248,6 +3257,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
       return join;
     }
 
+    @Override
     public RelNode visit(final HiveProject project) {
       try {
         Stacks.push(stack, project);
@@ -3260,6 +3270,7 @@ public final class HiveRelDecorrelator implements ReflectiveVisitor {
       return super.visit(project);
     }
 
+    @Override
     public RelNode visit(final HiveFilter filter) {
       try {
         Stacks.push(stack, filter);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSubQueryRemoveRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSubQueryRemoveRule.java
index 50ed8ed..ea19302 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSubQueryRemoveRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSubQueryRemoveRule.java
@@ -83,6 +83,7 @@ public class HiveSubQueryRemoveRule extends RelOptRule {
         HiveRelFactories.HIVE_BUILDER, "SubQueryRemoveRule:Filter");
     this.conf = conf;
   }
+  @Override
   public void onMatch(RelOptRuleCall call) {
     final RelNode relNode = call.rel(0);
     final HiveSubQRemoveRelBuilder builder =
@@ -113,7 +114,8 @@ public class HiveSubQueryRemoveRule extends RelOptRule {
       final RexShuttle shuttle = new ReplaceSubQueryShuttle(e, target);
       builder.filter(shuttle.apply(filter.getCondition()));
       builder.project(fields(builder, filter.getRowType().getFieldCount()));
-      call.transformTo(builder.build());
+      RelNode newRel = builder.build();
+      call.transformTo(newRel);
     } else if(relNode instanceof Project) {
       // if subquery is in PROJECT
       final Project project = call.rel(0);
@@ -507,6 +509,7 @@ public class HiveSubQueryRemoveRule extends RelOptRule {
     /** Returns whether a {@link Project} contains a sub-query. */
     public static final Predicate<RelNode> RELNODE_PREDICATE=
         new Predicate<RelNode>() {
+          @Override
           public boolean apply(RelNode relNode) {
             if (relNode instanceof Project) {
               Project project = (Project)relNode;
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
index 74f8c33..c4c771e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
@@ -33,7 +33,6 @@ import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
 import org.apache.hadoop.hive.conf.Constants;
 import org.apache.hadoop.hive.ql.optimizer.calcite.RelOptHiveTable;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveTableScan;
-import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.JdbcHiveTableScan;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter;
 import org.apache.hadoop.hive.ql.parse.ASTNode;
 import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
@@ -223,10 +222,6 @@ public class ASTBuilder {
   }
 
   public static ASTNode literal(RexLiteral literal) {
-    return literal(literal, false);
-  }
-
-  public static ASTNode literal(RexLiteral literal, boolean useTypeQualInLiteral) {
     Object val = null;
     int type = 0;
     SqlTypeName sqlType = literal.getType().getSqlTypeName();
@@ -272,30 +267,28 @@ public class ASTBuilder {
 
     switch (sqlType) {
     case TINYINT:
-      if (useTypeQualInLiteral) {
-        val = literal.getValue3() + "Y";
-      } else {
-        val = literal.getValue3();
-      }
-      type = HiveParser.IntegralLiteral;
-      break;
     case SMALLINT:
-      if (useTypeQualInLiteral) {
-        val = literal.getValue3() + "S";
-      } else {
-        val = literal.getValue3();
-      }
-      type = HiveParser.IntegralLiteral;
-      break;
     case INTEGER:
-      val = literal.getValue3();
-      type = HiveParser.IntegralLiteral;
-      break;
     case BIGINT:
-      if (useTypeQualInLiteral) {
-        val = literal.getValue3() + "L";
-      } else {
-        val = literal.getValue3();
+      val = literal.getValue3();
+      // Calcite considers all numeric literals as bigdecimal values
+      // Hive makes a distinction between them most importantly IntegralLiteral
+      if (val instanceof BigDecimal) {
+        val = ((BigDecimal) val).longValue();
+      }
+      switch (sqlType) {
+      case TINYINT:
+        val += "Y";
+        break;
+      case SMALLINT:
+        val += "S";
+        break;
+      case INTEGER:
+        val += "";
+        break;
+      case BIGINT:
+        val += "L";
+        break;
       }
       type = HiveParser.IntegralLiteral;
       break;
@@ -309,7 +302,7 @@ public class ASTBuilder {
       break;
     case FLOAT:
     case REAL:
-      val = literal.getValue3();
+      val = literal.getValue3() + "F";
       type = HiveParser.Number;
       break;
     case VARCHAR:
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java
index e783d1c..a93d21a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java
@@ -298,8 +298,9 @@ public class ASTConverter {
           // 3 Convert OB expr (OB Expr is usually an input ref except for top
           // level OB; top level OB will have RexCall kept in a map.)
           obExpr = null;
-          if (obRefToCallMap != null)
+          if (obRefToCallMap != null) {
             obExpr = obRefToCallMap.get(c.getFieldIndex());
+          }
 
           if (obExpr != null) {
             astCol = obExpr.accept(new RexVisitor(schema, false, order.getCluster().getRexBuilder()));
@@ -466,7 +467,6 @@ public class ASTConverter {
   static class RexVisitor extends RexVisitorImpl<ASTNode> {
 
     private final Schema schema;
-    private final boolean useTypeQualInLiteral;
     private final RexBuilder rexBuilder;
     // this is to keep track of null literal which already has been visited
     private Map<RexLiteral, Boolean> nullLiteralMap ;
@@ -483,7 +483,6 @@ public class ASTConverter {
     protected RexVisitor(Schema schema, boolean useTypeQualInLiteral, RexBuilder rexBuilder) {
       super(true);
       this.schema = schema;
-      this.useTypeQualInLiteral = useTypeQualInLiteral;
       this.rexBuilder = rexBuilder;
 
       this.nullLiteralMap =
@@ -493,8 +492,11 @@ public class ASTConverter {
             // of value/type
             @Override
             public int compare(RexLiteral o1, RexLiteral o2) {
-              if(o1 == o2) return 0;
-              else return 1;
+              if(o1 == o2) {
+                return 0;
+              } else {
+                return 1;
+              }
             }
           });
     }
@@ -512,10 +514,11 @@ public class ASTConverter {
         return (ASTNode) ParseDriver.adaptor.dupTree(cI.agg);
       }
 
-      if (cI.table == null || cI.table.isEmpty())
+      if (cI.table == null || cI.table.isEmpty()) {
         return ASTBuilder.unqualifiedName(cI.column);
-      else
+      } else {
         return ASTBuilder.qualifiedName(cI.table, cI.column);
+      }
 
     }
 
@@ -527,14 +530,14 @@ public class ASTConverter {
         // It is NULL value with different type, we need to introduce a CAST
         // to keep it
         if(nullLiteralMap.containsKey(literal)) {
-          return ASTBuilder.literal(literal, useTypeQualInLiteral);
+          return ASTBuilder.literal(literal);
         }
         nullLiteralMap.put(literal, true);
         RexNode r = rexBuilder.makeAbstractCast(literal.getType(), literal);
 
         return r.accept(this);
       }
-      return ASTBuilder.literal(literal, useTypeQualInLiteral);
+      return ASTBuilder.literal(literal);
     }
 
     private ASTNode getPSpecAST(RexWindow window) {
@@ -575,7 +578,7 @@ public class ASTConverter {
             }
           }
           ASTNode astCol = ok.left.accept(this);
-          
+
           nullDirectionAST.addChild(astCol);
           oByAst.addChild(directionAST);
         }
@@ -583,10 +586,12 @@ public class ASTConverter {
 
       if (dByAst != null || oByAst != null) {
         pSpecAst = ASTBuilder.createAST(HiveParser.TOK_PARTITIONINGSPEC, "TOK_PARTITIONINGSPEC");
-        if (dByAst != null)
+        if (dByAst != null) {
           pSpecAst.addChild(dByAst);
-        if (oByAst != null)
+        }
+        if (oByAst != null) {
           pSpecAst.addChild(oByAst);
+        }
       }
 
       return pSpecAst;
@@ -598,10 +603,11 @@ public class ASTConverter {
       if (wb.isCurrentRow()) {
         wbAST = ASTBuilder.createAST(HiveParser.KW_CURRENT, "CURRENT");
       } else {
-        if (wb.isPreceding())
+        if (wb.isPreceding()) {
           wbAST = ASTBuilder.createAST(HiveParser.KW_PRECEDING, "PRECEDING");
-        else
+        } else {
           wbAST = ASTBuilder.createAST(HiveParser.KW_FOLLOWING, "FOLLOWING");
+        }
         if (wb.isUnbounded()) {
           wbAST.addChild(ASTBuilder.createAST(HiveParser.KW_UNBOUNDED, "UNBOUNDED"));
         } else {
@@ -630,14 +636,17 @@ public class ASTConverter {
 
       if (startAST != null || endAST != null) {
         // NOTE: in Hive AST Rows->Range(Physical) & Range -> Values (logical)
-        if (window.isRows())
+        if (window.isRows()) {
           wRangeAst = ASTBuilder.createAST(HiveParser.TOK_WINDOWRANGE, "TOK_WINDOWRANGE");
-        else
+        } else {
           wRangeAst = ASTBuilder.createAST(HiveParser.TOK_WINDOWVALUES, "TOK_WINDOWVALUES");
-        if (startAST != null)
+        }
+        if (startAST != null) {
           wRangeAst.addChild(startAST);
-        if (endAST != null)
+        }
+        if (endAST != null) {
           wRangeAst.addChild(endAST);
+        }
       }
 
       return wRangeAst;
@@ -660,10 +669,12 @@ public class ASTConverter {
       final RexWindow window = over.getWindow();
       final ASTNode wPSpecAst = getPSpecAST(window);
       final ASTNode wRangeAst = getWindowRangeAST(window);
-      if (wPSpecAst != null)
+      if (wPSpecAst != null) {
         wSpec.addChild(wPSpecAst);
-      if (wRangeAst != null)
+      }
+      if (wRangeAst != null) {
         wSpec.addChild(wRangeAst);
+      }
 
       return wUDAFAst;
     }
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
index 7645564..aeb30e8 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
@@ -280,12 +280,16 @@ public class PartitionPruner extends Transform {
       return null;
     }
     if (expr instanceof ExprNodeConstantDesc) {
-      if (((ExprNodeConstantDesc)expr).getValue() == null) return null;
+      if (((ExprNodeConstantDesc)expr).getValue() == null) {
+        return null;
+      }
       if (!isBooleanExpr(expr)) {
         throw new IllegalStateException("Unexpected non-boolean ExprNodeConstantDesc: "
             + expr.getExprString());
       }
       return expr;
+    } else if (expr instanceof ExprNodeColumnDesc) {
+      return expr;
     } else if (expr instanceof ExprNodeGenericFuncDesc) {
       GenericUDF udf = ((ExprNodeGenericFuncDesc)expr).getGenericUDF();
       boolean isAnd = udf instanceof GenericUDFOPAnd;
@@ -310,7 +314,7 @@ public class PartitionPruner extends Transform {
             allTrue = false;
           }
         }
-        
+
         if (allTrue) {
           return new ExprNodeConstantDesc(Boolean.TRUE);
         }
@@ -401,7 +405,7 @@ public class PartitionPruner extends Transform {
             Preconditions.checkArgument(expr.getTypeInfo().accept(TypeInfoFactory.booleanTypeInfo));
             other = new ExprNodeConstantDesc(expr.getTypeInfo(), true);
           } else {
-            // Functions like NVL, COALESCE, CASE can change a 
+            // Functions like NVL, COALESCE, CASE can change a
             // NULL introduced by a nonpart column removal into a non-null
             // and cause overaggressive prunning, missing data (incorrect result)
             return new ExprNodeConstantDesc(expr.getTypeInfo(), null);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
index 98e94e2..38afaf4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
@@ -907,21 +907,28 @@ public class CalcitePlanner extends SemanticAnalyzer {
     // Not ok to run CBO, build error message.
     String msg = "";
     if (verbose) {
-      if (queryProperties.hasClusterBy())
+      if (queryProperties.hasClusterBy()) {
         msg += "has cluster by; ";
-      if (queryProperties.hasDistributeBy())
+      }
+      if (queryProperties.hasDistributeBy()) {
         msg += "has distribute by; ";
-      if (queryProperties.hasSortBy())
+      }
+      if (queryProperties.hasSortBy()) {
         msg += "has sort by; ";
-      if (queryProperties.hasPTF())
+      }
+      if (queryProperties.hasPTF()) {
         msg += "has PTF; ";
-      if (queryProperties.usesScript())
+      }
+      if (queryProperties.usesScript()) {
         msg += "uses scripts; ";
-      if (queryProperties.hasLateralViews())
+      }
+      if (queryProperties.hasLateralViews()) {
         msg += "has lateral views; ";
+      }
 
-      if (msg.isEmpty())
+      if (msg.isEmpty()) {
         msg += "has some unspecified limitations; ";
+      }
     }
     return msg;
   }
@@ -1234,7 +1241,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
     if (runCBO) {
       int lastDot = colName.lastIndexOf('.');
       if (lastDot < 0)
+       {
         return colName; // alias is not fully qualified
+      }
       String nqColumnName = colName.substring(lastDot + 1);
       STATIC_LOG.debug("Replacing " + colName + " (produced by CBO) by " + nqColumnName);
       return nqColumnName;
@@ -1381,16 +1390,18 @@ public class CalcitePlanner extends SemanticAnalyzer {
           ASTNode next = searchQueue.poll();
           found = next.getType() == token;
           if (found) {
-            if (i == tokens.length - 1)
+            if (i == tokens.length - 1) {
               return next;
+            }
             searchQueue.clear();
           }
           for (int j = 0; j < next.getChildCount(); ++j) {
             searchQueue.add((ASTNode) next.getChild(j));
           }
         }
-        if (!found)
+        if (!found) {
           return null;
+        }
       }
       return null;
     }
@@ -1400,7 +1411,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
       searchQueue.add(ast);
       while (!searchQueue.isEmpty()) {
         ASTNode next = searchQueue.poll();
-        if (next.getType() == token) return next;
+        if (next.getType() == token) {
+          return next;
+        }
         for (int j = 0; j < next.getChildCount(); ++j) {
           searchQueue.add((ASTNode) next.getChild(j));
         }
@@ -1414,7 +1427,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
       while (!searchQueue.isEmpty()) {
         ASTNode next = searchQueue.poll();
         for (int i = 0; i < tokens.length; ++i) {
-          if (next.getType() == tokens[i]) return next;
+          if (next.getType() == tokens[i]) {
+            return next;
+          }
         }
         for (int i = 0; i < next.getChildCount(); ++i) {
           searchQueue.add((ASTNode) next.getChild(i));
@@ -1476,6 +1491,7 @@ public class CalcitePlanner extends SemanticAnalyzer {
         .withDatabaseMajorVersion(4) // TODO: should not be hardcoded
         .withDatabaseMinorVersion(0)
         .withIdentifierQuoteString("`")
+        .withDataTypeSystem(new HiveTypeSystemImpl())
         .withNullCollation(nullCollation)) {
       @Override
       protected boolean allowsAs() {
@@ -1644,11 +1660,13 @@ public class CalcitePlanner extends SemanticAnalyzer {
 
     public static boolean resetCause(Throwable target, Throwable newCause) {
       try {
-        if (MESSAGE_FIELD == null)
+        if (MESSAGE_FIELD == null) {
           return false;
+        }
         Field field = (target instanceof InvocationTargetException) ? TARGET_FIELD : CAUSE_FIELD;
-        if (field == null)
+        if (field == null) {
           return false;
+        }
 
         Throwable oldCause = target.getCause();
         String oldMsg = target.getMessage();
@@ -2372,8 +2390,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
         programBuilder = programBuilder.addRuleCollection(ImmutableList.copyOf(rules));
       } else {
         // TODO: Should this be also TOP_DOWN?
-        for (RelOptRule r : rules)
+        for (RelOptRule r : rules) {
           programBuilder.addRuleInstance(r);
+        }
       }
 
       // Create planner and copy context
@@ -3626,10 +3645,11 @@ public class CalcitePlanner extends SemanticAnalyzer {
 
       // 3.2 Rank functions type is 'int'/'double'
       if (FunctionRegistry.isRankingFunction(aggName)) {
-        if (aggName.equalsIgnoreCase("percent_rank"))
+        if (aggName.equalsIgnoreCase("percent_rank")) {
           udafRetType = TypeInfoFactory.doubleTypeInfo;
-        else
+        } else {
           udafRetType = TypeInfoFactory.intTypeInfo;
+        }
       } else {
         // 3.3 Try obtaining UDAF evaluators to determine the ret type
         try {
@@ -3776,9 +3796,10 @@ public class CalcitePlanner extends SemanticAnalyzer {
             ASTNode grpbyExpr = grpByAstExprs.get(i);
             Map<ASTNode, ExprNodeDesc> astToExprNDescMap = genAllExprNodeDesc(grpbyExpr, groupByInputRowResolver);
             ExprNodeDesc grpbyExprNDesc = astToExprNDescMap.get(grpbyExpr);
-            if (grpbyExprNDesc == null)
+            if (grpbyExprNDesc == null) {
               throw new CalciteSemanticException("Invalid Column Reference: " + grpbyExpr.dump(),
                   UnsupportedFeature.Invalid_column_reference);
+            }
 
             addToGBExpr(groupByOutputRowResolver, groupByInputRowResolver, grpbyExpr,
                 grpbyExprNDesc, gbExprNDescLst, outputColumnNames);
@@ -4153,9 +4174,10 @@ public class CalcitePlanner extends SemanticAnalyzer {
         RexNode amtLiteral = null;
         SqlCall sc = null;
 
-        if (amt != null)
+        if (amt != null) {
           amtLiteral = cluster.getRexBuilder().makeLiteral(Integer.valueOf(bs.getAmt()),
               cluster.getTypeFactory().createSqlType(SqlTypeName.INTEGER), true);
+        }
 
         switch (bs.getDirection()) {
         case PRECEDING:
@@ -4259,13 +4281,15 @@ public class CalcitePlanner extends SemanticAnalyzer {
       getQBParseInfo(qb);
       WindowingSpec wSpec = (!qb.getAllWindowingSpecs().isEmpty()) ? qb.getAllWindowingSpecs()
           .values().iterator().next() : null;
-      if (wSpec == null)
+      if (wSpec == null) {
         return null;
+      }
       // 1. Get valid Window Function Spec
       wSpec.validateAndMakeEffective();
       List<WindowExpressionSpec> windowExpressions = wSpec.getWindowExpressions();
-      if (windowExpressions == null || windowExpressions.isEmpty())
+      if (windowExpressions == null || windowExpressions.isEmpty()) {
         return null;
+      }
 
       RowResolver inputRR = this.relToHiveRR.get(srcRel);
       // 2. Get RexNodes for original Projections from below
@@ -4376,7 +4400,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
       String selClauseName = qbp.getClauseNames().iterator().next();
       Tree selExpr0 = qbp.getSelForClause(selClauseName).getChild(0);
 
-      if (selExpr0.getType() != HiveParser.QUERY_HINT) return;
+      if (selExpr0.getType() != HiveParser.QUERY_HINT) {
+        return;
+      }
       String hint = ctx.getTokenRewriteStream().toString(
           selExpr0.getTokenStartIndex(), selExpr0.getTokenStopIndex());
       LOG.debug("Handling query hints: " + hint);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
index a2dd554..357439a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
@@ -331,6 +331,9 @@ public class TypeCheckProcFactory {
           // Literal decimal
           String strVal = expr.getText().substring(0, expr.getText().length() - 2);
           return createDecimal(strVal, false);
+        } else if (expr.getText().endsWith("F")) {
+          // Literal float.
+          v = Float.valueOf(expr.getText().substring(0, expr.getText().length() - 1));
         } else if (expr.getText().endsWith("D")) {
           // Literal double.
           v = Double.valueOf(expr.getText().substring(0, expr.getText().length() - 1));
diff --git a/ql/src/test/queries/clientpositive/druidmini_expressions.q b/ql/src/test/queries/clientpositive/druidmini_expressions.q
index e491986..c1c0ff3 100644
--- a/ql/src/test/queries/clientpositive/druidmini_expressions.q
+++ b/ql/src/test/queries/clientpositive/druidmini_expressions.q
@@ -36,11 +36,31 @@ EXPLAIN SELECT cstring1 || '_'|| cstring2, substring(cstring2, 2, 3) as concat ,
 
 explain extended select count(*) from (select `__time` from druid_table_alltypesorc limit 1) as src ;
 
+
+
+explain
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE (`__time` BETWEEN '1968-01-01 00:00:00' AND '1970-01-01 00:00:00')
+    OR (`__time` BETWEEN '1968-02-01 00:00:00' AND '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10;
+
 SELECT `__time`
 FROM druid_table_alltypesorc
 WHERE (`__time` BETWEEN '1968-01-01 00:00:00' AND '1970-01-01 00:00:00')
     OR (`__time` BETWEEN '1968-02-01 00:00:00' AND '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10;
 
+
+explain
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE ('1968-01-01 00:00:00' <= `__time` AND `__time` <= '1970-01-01 00:00:00')
+    OR ('1968-02-01 00:00:00' <= `__time` AND `__time` <= '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10;
+
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE ('1968-01-01 00:00:00' <= `__time` AND `__time` <= '1970-01-01 00:00:00')
+    OR ('1968-02-01 00:00:00' <= `__time` AND `__time` <= '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10;
+
 -- COUNT DISTINCT TESTS
 -- AS PART OF https://issues.apache.org/jira/browse/HIVE-19586
 
@@ -213,4 +233,4 @@ explain select max(cint * cfloat) from (select `cfloat`, `cstring1`, `cint`, `cd
 
 explain select count(distinct `__time`, cint) from (select * from druid_table_alltypesorc) as src;
 
-select count(distinct `__time`, cint) from (select * from druid_table_alltypesorc) as src;
\ No newline at end of file
+select count(distinct `__time`, cint) from (select * from druid_table_alltypesorc) as src;
diff --git a/ql/src/test/queries/clientpositive/join_constraints_optimization.q b/ql/src/test/queries/clientpositive/join_constraints_optimization.q
index 5981b04..5dbfe05 100644
--- a/ql/src/test/queries/clientpositive/join_constraints_optimization.q
+++ b/ql/src/test/queries/clientpositive/join_constraints_optimization.q
@@ -122,7 +122,7 @@ FROM `lineorder_removal_n0`
 LEFT OUTER JOIN `customer_removal_n0` ON `lo_custkey` = `c_custkey`
 LEFT OUTER JOIN `dates_removal_n0` ON `lo_orderdate` = `d_datekey`;
 
--- NOT TRANFORM EITHER
+-- REMOVE SECOND OUTER AND NOT TRANFORM FIRST OUTER
 EXPLAIN
 SELECT `lo_linenumber`
 FROM `lineorder_removal_n0`
diff --git a/ql/src/test/queries/clientpositive/subquery_multi.q b/ql/src/test/queries/clientpositive/subquery_multi.q
index 81a9187..03459ac 100644
--- a/ql/src/test/queries/clientpositive/subquery_multi.q
+++ b/ql/src/test/queries/clientpositive/subquery_multi.q
@@ -63,6 +63,10 @@ explain select * from part_null where p_name IN (select p_name from part_null) A
 select * from part_null where p_name IN (select p_name from part_null) AND NOT EXISTS (select c from tempty);
 
 -- corr, mix of IN/NOT IN
+explain cbo select * from part_null where 
+        p_brand NOT IN (select p_container from part where part.p_type = part_null.p_type
+                                 AND p_brand IN (select p_brand from part pp where part.p_type = pp.p_type));
+
 explain select * from part_null where p_name IN ( select p_name from part where part.p_type = part_null.p_type)
         AND p_brand NOT IN (select p_container from part where part.p_type = part_null.p_type
                                 AND p_brand IN (select p_brand from part pp where part.p_type = pp.p_type));
diff --git a/ql/src/test/results/clientpositive/allcolref_in_udf.q.out b/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
index b635f67..eb37c91 100644
--- a/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
+++ b/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
@@ -104,10 +104,10 @@ STAGE PLANS:
                   value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
           TableScan
             alias: b
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), concat(key, value) (type: string), UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/alter_partition_coltype.q.out b/ql/src/test/results/clientpositive/alter_partition_coltype.q.out
index 1fbc213..cd7681c 100644
--- a/ql/src/test/results/clientpositive/alter_partition_coltype.q.out
+++ b/ql/src/test/results/clientpositive/alter_partition_coltype.q.out
@@ -571,6 +571,9 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: pt@alterdynamic_part_table
 POSTHOOK: Input: pt@alterdynamic_part_table@partcol1=2/partcol2=1
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `intcol`
+FROM `pt`.`alterdynamic_part_table`
+WHERE ROW(`partcol1`, `partcol2`) IN (ROW(2, '1'), ROW(1, '__HIVE_DEFAULT_PARTITION__'))
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
 
diff --git a/ql/src/test/results/clientpositive/annotate_stats_filter.q.out b/ql/src/test/results/clientpositive/annotate_stats_filter.q.out
index 44f77b8..957fd12 100644
--- a/ql/src/test/results/clientpositive/annotate_stats_filter.q.out
+++ b/ql/src/test/results/clientpositive/annotate_stats_filter.q.out
@@ -845,18 +845,18 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: loc_orc
-            filterExpr: (((year = 2001) and year is null) or (state = 'CA')) (type: boolean)
+            filterExpr: (state = 'CA') (type: boolean)
             Statistics: Num rows: 8 Data size: 816 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (((year = 2001) and year is null) or (state = 'CA')) (type: boolean)
-              Statistics: Num rows: 2 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: (state = 'CA') (type: boolean)
+              Statistics: Num rows: 1 Data size: 102 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
-                expressions: state (type: string), locid (type: int), zip (type: bigint), year (type: int)
+                expressions: 'CA' (type: string), locid (type: int), zip (type: bigint), year (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3
-                Statistics: Num rows: 2 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 1 Data size: 102 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 2 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 102 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out b/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
index 2cf5b0c..cce87c4 100644
--- a/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
+++ b/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
@@ -467,10 +467,10 @@ STAGE PLANS:
                   Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
           TableScan
             alias: ss
-            filterExpr: ss_store_sk is not null (type: boolean)
+            filterExpr: UDFToLong(ss_store_sk) is not null (type: boolean)
             Statistics: Num rows: 1000 Data size: 3860 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: ss_store_sk is not null (type: boolean)
+              predicate: UDFToLong(ss_store_sk) is not null (type: boolean)
               Statistics: Num rows: 964 Data size: 3720 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: UDFToLong(ss_store_sk) (type: bigint)
diff --git a/ql/src/test/results/clientpositive/auto_join2.q.out b/ql/src/test/results/clientpositive/auto_join2.q.out
index f154680..25ee73f 100644
--- a/ql/src/test/results/clientpositive/auto_join2.q.out
+++ b/ql/src/test/results/clientpositive/auto_join2.q.out
@@ -39,10 +39,10 @@ STAGE PLANS:
         $hdt$_0:src1 
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -55,10 +55,10 @@ STAGE PLANS:
         $hdt$_2:src3 
           TableScan
             alias: src3
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: value (type: string), UDFToDouble(key) (type: double)
@@ -74,10 +74,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/auto_join33.q.out b/ql/src/test/results/clientpositive/auto_join33.q.out
index 27fe10a..8af7e79 100644
--- a/ql/src/test/results/clientpositive/auto_join33.q.out
+++ b/ql/src/test/results/clientpositive/auto_join33.q.out
@@ -32,10 +32,10 @@ STAGE PLANS:
         $hdt$_0:src 
           TableScan
             alias: src
-            filterExpr: (((UDFToDouble(key) + 1.0D) < 10.0D) and key is not null) (type: boolean)
+            filterExpr: (((UDFToDouble(key) + 1.0D) < 10.0D) and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (((UDFToDouble(key) + 1.0D) < 10.0D) and key is not null) (type: boolean)
+              predicate: (((UDFToDouble(key) + 1.0D) < 10.0D) and UDFToDouble(key) is not null) (type: boolean)
               Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string)
@@ -51,10 +51,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (((UDFToDouble(key) + 2.0D) < 10.0D) and key is not null) (type: boolean)
+            filterExpr: (((UDFToDouble(key) + 2.0D) < 10.0D) and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (((UDFToDouble(key) + 2.0D) < 10.0D) and key is not null) (type: boolean)
+              predicate: (((UDFToDouble(key) + 2.0D) < 10.0D) and UDFToDouble(key) is not null) (type: boolean)
               Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string)
diff --git a/ql/src/test/results/clientpositive/auto_join_stats.q.out b/ql/src/test/results/clientpositive/auto_join_stats.q.out
index dc1338a..06448f4 100644
--- a/ql/src/test/results/clientpositive/auto_join_stats.q.out
+++ b/ql/src/test/results/clientpositive/auto_join_stats.q.out
@@ -57,10 +57,10 @@ STAGE PLANS:
         $hdt$_1:src2 
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -76,10 +76,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -113,10 +113,10 @@ STAGE PLANS:
         $hdt$_2:smalltable_n0 
           TableScan
             alias: smalltable_n0
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 6 Data size: 1104 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 1104 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -164,10 +164,10 @@ STAGE PLANS:
         $hdt$_0:src1 
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -183,10 +183,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -215,10 +215,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -232,10 +232,10 @@ STAGE PLANS:
                   value expressions: _col1 (type: double)
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -342,10 +342,10 @@ STAGE PLANS:
         $hdt$_2:src2 
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -361,10 +361,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -401,10 +401,10 @@ STAGE PLANS:
         $hdt$_0:smalltable_n0 
           TableScan
             alias: smalltable_n0
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 6 Data size: 1104 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 1104 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -417,10 +417,10 @@ STAGE PLANS:
         $hdt$_3:smalltable2_n0 
           TableScan
             alias: smalltable2_n0
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: UDFToDouble(key) (type: double)
@@ -476,10 +476,10 @@ STAGE PLANS:
         $hdt$_1:src1 
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -495,10 +495,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -527,10 +527,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -544,10 +544,10 @@ STAGE PLANS:
                   value expressions: _col1 (type: double)
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/auto_join_stats2.q.out b/ql/src/test/results/clientpositive/auto_join_stats2.q.out
index 6962347..8eb4b2e 100644
--- a/ql/src/test/results/clientpositive/auto_join_stats2.q.out
+++ b/ql/src/test/results/clientpositive/auto_join_stats2.q.out
@@ -44,10 +44,10 @@ STAGE PLANS:
         $hdt$_1:smalltable 
           TableScan
             alias: smalltable
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -60,10 +60,10 @@ STAGE PLANS:
         $hdt$_2:src1 
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -79,10 +79,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -199,10 +199,10 @@ STAGE PLANS:
         $hdt$_0:smalltable 
           TableScan
             alias: smalltable
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 6 Data size: 1104 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 1104 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -215,10 +215,10 @@ STAGE PLANS:
         $hdt$_1:src1 
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -231,10 +231,10 @@ STAGE PLANS:
         $hdt$_3:smalltable2 
           TableScan
             alias: smalltable2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: UDFToDouble(key) (type: double)
@@ -250,10 +250,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/cbo_rp_simple_select.q.out b/ql/src/test/results/clientpositive/cbo_rp_simple_select.q.out
index cb22b61..96ac125 100644
--- a/ql/src/test/results/clientpositive/cbo_rp_simple_select.q.out
+++ b/ql/src/test/results/clientpositive/cbo_rp_simple_select.q.out
@@ -761,18 +761,18 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: (c_int = c_int) (type: boolean)
+            filterExpr: c_int is not null (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (c_int = c_int) (type: boolean)
-              Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: c_int is not null (type: boolean)
+              Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
                 outputColumnNames: key, value, c_int, c_float, c_boolean, dt
-                Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -853,18 +853,18 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: (c_int = c_int) (type: boolean)
+            filterExpr: c_int is not null (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (c_int = c_int) (type: boolean)
-              Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: c_int is not null (type: boolean)
+              Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
                 outputColumnNames: key, value, c_int, c_float, c_boolean, dt
-                Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -881,47 +881,31 @@ PREHOOK: query: -- c_int is not null
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (NULL)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t2
-PREHOOK: Input: default@cbo_t2@dt=2014
 #### A masked pattern was here ####
 POSTHOOK: query: -- c_int is not null
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (NULL)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t2
-POSTHOOK: Input: default@cbo_t2@dt=2014
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
+  Stage-0 is a root stage
 
 STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: cbo_t2
-            filterExpr: (c_int = null) (type: boolean)
-            Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
-            Filter Operator
-              predicate: (c_int = null) (type: boolean)
-              Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
-              Select Operator
-                expressions: key (type: string), value (type: string), null (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
-                outputColumnNames: key, value, c_int, c_float, c_boolean, dt
-                Statistics: Num rows: 10 Data size: 3624 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 10 Data size: 3624 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-      Execution mode: vectorized
-
   Stage: Stage-0
     Fetch Operator
       limit: -1
       Processor Tree:
-        ListSink
+        TableScan
+          alias: cbo_t2
+          Statistics: Num rows: 1 Data size: 564 Basic stats: COMPLETE Column stats: PARTIAL
+          Filter Operator
+            predicate: false (type: boolean)
+            Statistics: Num rows: 1 Data size: 564 Basic stats: COMPLETE Column stats: PARTIAL
+            Select Operator
+              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
+              outputColumnNames: key, value, c_int, c_float, c_boolean, dt
+              Statistics: Num rows: 1 Data size: 564 Basic stats: COMPLETE Column stats: PARTIAL
+              ListSink
 
 PREHOOK: query: -- rewrite to NULL
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (cbo_t2.c_int, 2*cbo_t2.c_int)
@@ -945,10 +929,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: ((c_int = c_int) or (c_int = (2 * c_int))) (type: boolean)
+            filterExpr: (c_int is not null or (c_int = (2 * c_int))) (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: ((c_int = (2 * c_int)) or (c_int = c_int)) (type: boolean)
+              predicate: ((c_int = (2 * c_int)) or c_int is not null) (type: boolean)
               Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
@@ -991,10 +975,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: ((c_int = c_int) or (c_int = 0)) (type: boolean)
+            filterExpr: (c_int is not null or (c_int = 0)) (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: ((c_int = 0) or (c_int = c_int)) (type: boolean)
+              predicate: ((c_int = 0) or c_int is not null) (type: boolean)
               Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
diff --git a/ql/src/test/results/clientpositive/cbo_simple_select.q.out b/ql/src/test/results/clientpositive/cbo_simple_select.q.out
index 32e6920..8beaecf 100644
--- a/ql/src/test/results/clientpositive/cbo_simple_select.q.out
+++ b/ql/src/test/results/clientpositive/cbo_simple_select.q.out
@@ -761,18 +761,18 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: (c_int = c_int) (type: boolean)
+            filterExpr: c_int is not null (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (c_int = c_int) (type: boolean)
-              Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: c_int is not null (type: boolean)
+              Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -853,18 +853,18 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: (c_int = c_int) (type: boolean)
+            filterExpr: c_int is not null (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (c_int = c_int) (type: boolean)
-              Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: c_int is not null (type: boolean)
+              Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 18 Data size: 6406 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -881,47 +881,31 @@ PREHOOK: query: -- c_int is not null
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (NULL)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t2
-PREHOOK: Input: default@cbo_t2@dt=2014
 #### A masked pattern was here ####
 POSTHOOK: query: -- c_int is not null
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (NULL)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t2
-POSTHOOK: Input: default@cbo_t2@dt=2014
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
+  Stage-0 is a root stage
 
 STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: cbo_t2
-            filterExpr: (c_int = null) (type: boolean)
-            Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
-            Filter Operator
-              predicate: (c_int = null) (type: boolean)
-              Statistics: Num rows: 10 Data size: 3660 Basic stats: COMPLETE Column stats: COMPLETE
-              Select Operator
-                expressions: key (type: string), value (type: string), null (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 10 Data size: 3624 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 10 Data size: 3624 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-      Execution mode: vectorized
-
   Stage: Stage-0
     Fetch Operator
       limit: -1
       Processor Tree:
-        ListSink
+        TableScan
+          alias: cbo_t2
+          Statistics: Num rows: 1 Data size: 564 Basic stats: COMPLETE Column stats: PARTIAL
+          Filter Operator
+            predicate: false (type: boolean)
+            Statistics: Num rows: 1 Data size: 564 Basic stats: COMPLETE Column stats: PARTIAL
+            Select Operator
+              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              Statistics: Num rows: 1 Data size: 564 Basic stats: COMPLETE Column stats: PARTIAL
+              ListSink
 
 PREHOOK: query: -- rewrite to NULL
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (cbo_t2.c_int, 2*cbo_t2.c_int)
@@ -945,10 +929,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: ((c_int = c_int) or (c_int = (2 * c_int))) (type: boolean)
+            filterExpr: (c_int is not null or (c_int = (2 * c_int))) (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: ((c_int = (2 * c_int)) or (c_int = c_int)) (type: boolean)
+              predicate: ((c_int = (2 * c_int)) or c_int is not null) (type: boolean)
               Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
@@ -991,10 +975,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: cbo_t2
-            filterExpr: ((c_int = c_int) or (c_int = 0)) (type: boolean)
+            filterExpr: (c_int is not null or (c_int = 0)) (type: boolean)
             Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: ((c_int = 0) or (c_int = c_int)) (type: boolean)
+              predicate: ((c_int = 0) or c_int is not null) (type: boolean)
               Statistics: Num rows: 20 Data size: 7138 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
diff --git a/ql/src/test/results/clientpositive/char_udf1.q.out b/ql/src/test/results/clientpositive/char_udf1.q.out
index 09fb697..a2b4bed 100644
--- a/ql/src/test/results/clientpositive/char_udf1.q.out
+++ b/ql/src/test/results/clientpositive/char_udf1.q.out
@@ -357,7 +357,7 @@ from char_udf_1 limit 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@char_udf_1
 #### A masked pattern was here ####
-{"a":"1","b":"2","c":"3"}	{"a":"1","b":"2","c":"3"}
+{"a":"1","b":"2","c":"3"}	{"a":"1","b":"2","c":"3         "}
 PREHOOK: query: select
   substr(c2, 1, 3),
   substr(c4, 1, 3),
diff --git a/ql/src/test/results/clientpositive/complex_alias.q.out b/ql/src/test/results/clientpositive/complex_alias.q.out
index a808513..af5c86f 100644
--- a/ql/src/test/results/clientpositive/complex_alias.q.out
+++ b/ql/src/test/results/clientpositive/complex_alias.q.out
@@ -148,10 +148,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: agg1
-            filterExpr: (col0 = col0) (type: boolean)
+            filterExpr: col0 is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (col0 = col0) (type: boolean)
+              predicate: col0 is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: '42' (type: string), col0 (type: int)
@@ -172,10 +172,10 @@ STAGE PLANS:
                       Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE
           TableScan
             alias: agg1
-            filterExpr: (col0 = col0) (type: boolean)
+            filterExpr: col0 is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (col0 = col0) (type: boolean)
+              predicate: col0 is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: '41' (type: string), col0 (type: int)
diff --git a/ql/src/test/results/clientpositive/constantPropWhen.q.out b/ql/src/test/results/clientpositive/constantPropWhen.q.out
index 1684cb6..3c42b68 100644
--- a/ql/src/test/results/clientpositive/constantPropWhen.q.out
+++ b/ql/src/test/results/clientpositive/constantPropWhen.q.out
@@ -40,7 +40,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: (not COALESCE((id = id2),false)) (type: boolean)
+              expressions: (id = id2) is not true (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
@@ -90,7 +90,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: (not COALESCE((id = id2),false)) (type: boolean)
+              expressions: (id = id2) is not true (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
@@ -140,7 +140,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: COALESCE((id = id2),false) (type: boolean)
+              expressions: (id = id2) is true (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
@@ -190,7 +190,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: COALESCE((id = id2),false) (type: boolean)
+              expressions: (id = id2) is true (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
diff --git a/ql/src/test/results/clientpositive/constant_prop_3.q.out b/ql/src/test/results/clientpositive/constant_prop_3.q.out
index db73902..c95a56a 100644
--- a/ql/src/test/results/clientpositive/constant_prop_3.q.out
+++ b/ql/src/test/results/clientpositive/constant_prop_3.q.out
@@ -284,7 +284,7 @@ STAGE PLANS:
             outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col9
             Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: ((_col6 = 0L) or (_col9 is null and _col1 is not null and (_col7 >= _col6))) (type: boolean)
+              predicate: (((_col7 >= _col6) or (_col6 = 0L) or _col9 is not null or _col1 is null) and (_col1 is not null or (_col6 = 0L) or _col9 is not null) and (_col9 is null or (_col6 = 0L))) (type: boolean)
               Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: _col1 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int)
diff --git a/ql/src/test/results/clientpositive/constprog_when_case.q.out b/ql/src/test/results/clientpositive/constprog_when_case.q.out
index 958e05e..f75fa1c 100644
--- a/ql/src/test/results/clientpositive/constprog_when_case.q.out
+++ b/ql/src/test/results/clientpositive/constprog_when_case.q.out
@@ -50,7 +50,7 @@ STAGE PLANS:
             alias: src_orc
             Statistics: Num rows: 1000 Data size: 269000 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: if(CASE WHEN (bool0) THEN (true) WHEN ((not bool0)) THEN (false) ELSE (null) END, key0, if(CASE WHEN (bool0) THEN (false) WHEN ((not bool0)) THEN (true) ELSE (null) END, key1, key2)) (type: string)
+              expressions: if((bool0 is true or (null and bool0 is not true and bool0 is not false)), key0, if((((not bool0) is true and bool0 is not true) or (null and bool0 is not true and bool0 is not false)), key1, key2)) (type: string)
               outputColumnNames: _col0
               Statistics: Num rows: 1000 Data size: 184000 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
diff --git a/ql/src/test/results/clientpositive/cte_mat_5.q.out b/ql/src/test/results/clientpositive/cte_mat_5.q.out
index 5beaada..92f25fe 100644
--- a/ql/src/test/results/clientpositive/cte_mat_5.q.out
+++ b/ql/src/test/results/clientpositive/cte_mat_5.q.out
@@ -115,10 +115,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: a
-            filterExpr: colnum is not null (type: boolean)
+            filterExpr: UDFToDouble(colnum) is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: colnum is not null (type: boolean)
+              predicate: UDFToDouble(colnum) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: colnum (type: int), UDFToDouble(colnum) (type: double)
@@ -132,10 +132,10 @@ STAGE PLANS:
                   value expressions: _col0 (type: int)
           TableScan
             alias: b
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/decimal_udf.q.out b/ql/src/test/results/clientpositive/decimal_udf.q.out
index b2a5837..d46caff 100644
--- a/ql/src/test/results/clientpositive/decimal_udf.q.out
+++ b/ql/src/test/results/clientpositive/decimal_udf.q.out
@@ -991,14 +991,14 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: decimal_udf
-          Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 1 Data size: 3590 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: (UDFToDouble(key) / null) (type: double)
+            expressions: null (type: double)
             outputColumnNames: _col0
-            Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
             Limit
               Number of rows: 1
-              Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
               ListSink
 
 PREHOOK: query: SELECT key / NULL FROM DECIMAL_UDF limit 1
diff --git a/ql/src/test/results/clientpositive/druid/druidmini_expressions.q.out b/ql/src/test/results/clientpositive/druid/druidmini_expressions.q.out
index 071a0f7..a094f32 100644
--- a/ql/src/test/results/clientpositive/druid/druidmini_expressions.q.out
+++ b/ql/src/test/results/clientpositive/druid/druidmini_expressions.q.out
@@ -144,7 +144,7 @@ STAGE PLANS:
           properties:
             druid.fieldNames $f0,_o__c1,_o__c2,_o__c3,$f4,$f5
             druid.fieldTypes double,int,bigint,double,bigint,bigint
-            druid.query.json {"queryType":"timeseries","dataSource":"default.druid_table_alltypesorc","descending":false,"granularity":"all","filter":{"type":"and","fields":[{"type":"or","fields":[{"type":"expression","expression":"((floor(\"cdouble\") * 2) < 1000)"},{"type":"expression","expression":"((log(\"cdouble\") / 1.0) > 0)"},{"type":"expression","expression":"(sin(\"cdouble\") > 1)"}]},{"type":"or","fields":[{"type":"and","fields":[{"type":"expression","expression":"(ceil(\"cflo [...]
+            druid.query.json {"queryType":"timeseries","dataSource":"default.druid_table_alltypesorc","descending":false,"granularity":"all","filter":{"type":"and","fields":[{"type":"or","fields":[{"type":"expression","expression":"((floor(\"cdouble\") * 2) < 1000)"},{"type":"expression","expression":"((log(\"cdouble\") / 1.0) > 0)"},{"type":"expression","expression":"(sin(\"cdouble\") > 1)"}]},{"type":"or","fields":[{"type":"and","fields":[{"type":"expression","expression":"(ceil(\"cflo [...]
             druid.query.type timeseries
           Select Operator
             expressions: $f0 (type: double), _o__c1 (type: int), _o__c2 (type: bigint), _o__c3 (type: double), $f4 (type: bigint), $f5 (type: bigint)
@@ -340,6 +340,79 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
+PREHOOK: query: explain
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE (`__time` BETWEEN '1968-01-01 00:00:00' AND '1970-01-01 00:00:00')
+    OR (`__time` BETWEEN '1968-02-01 00:00:00' AND '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@druid_table_alltypesorc
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: explain
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE (`__time` BETWEEN '1968-01-01 00:00:00' AND '1970-01-01 00:00:00')
+    OR (`__time` BETWEEN '1968-02-01 00:00:00' AND '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@druid_table_alltypesorc
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: druid_table_alltypesorc
+                  properties:
+                    druid.fieldNames vc
+                    druid.fieldTypes timestamp with local time zone
+                    druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1968-01-01T08:00:00.000Z/1970-04-01T08:00:00.001Z"],"virtualColumns":[{"type":"expression","name":"vc","expression":"\"__time\"","outputType":"LONG"}],"columns":["vc"],"resultFormat":"compactedList"}
+                    druid.query.type scan
+                  Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: vc (type: timestamp with local time zone)
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: timestamp with local time zone)
+                      sort order: +
+                      Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                      TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: timestamp with local time zone)
+                outputColumnNames: _col0
+                Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 380 Basic stats: COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 380 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 10
+      Processor Tree:
+        ListSink
+
 PREHOOK: query: SELECT `__time`
 FROM druid_table_alltypesorc
 WHERE (`__time` BETWEEN '1968-01-01 00:00:00' AND '1970-01-01 00:00:00')
@@ -364,6 +437,103 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 1969-12-31 15:59:00.0 US/Pacific
 1969-12-31 15:59:00.0 US/Pacific
 1969-12-31 15:59:00.0 US/Pacific
+PREHOOK: query: explain
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE ('1968-01-01 00:00:00' <= `__time` AND `__time` <= '1970-01-01 00:00:00')
+    OR ('1968-02-01 00:00:00' <= `__time` AND `__time` <= '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@druid_table_alltypesorc
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: explain
+SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE ('1968-01-01 00:00:00' <= `__time` AND `__time` <= '1970-01-01 00:00:00')
+    OR ('1968-02-01 00:00:00' <= `__time` AND `__time` <= '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@druid_table_alltypesorc
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: druid_table_alltypesorc
+                  properties:
+                    druid.fieldNames vc
+                    druid.fieldTypes timestamp with local time zone
+                    druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1968-01-01T08:00:00.000Z/1970-04-01T08:00:00.001Z"],"virtualColumns":[{"type":"expression","name":"vc","expression":"\"__time\"","outputType":"LONG"}],"columns":["vc"],"resultFormat":"compactedList"}
+                    druid.query.type scan
+                  Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: vc (type: timestamp with local time zone)
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: timestamp with local time zone)
+                      sort order: +
+                      Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                      TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: timestamp with local time zone)
+                outputColumnNames: _col0
+                Statistics: Num rows: 9173 Data size: 348640 Basic stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 380 Basic stats: COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 380 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 10
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE ('1968-01-01 00:00:00' <= `__time` AND `__time` <= '1970-01-01 00:00:00')
+    OR ('1968-02-01 00:00:00' <= `__time` AND `__time` <= '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@druid_table_alltypesorc
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT `__time`
+FROM druid_table_alltypesorc
+WHERE ('1968-01-01 00:00:00' <= `__time` AND `__time` <= '1970-01-01 00:00:00')
+    OR ('1968-02-01 00:00:00' <= `__time` AND `__time` <= '1970-04-01 00:00:00') ORDER BY `__time` ASC LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@druid_table_alltypesorc
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
+1969-12-31 15:59:00.0 US/Pacific
 PREHOOK: query: EXPLAIN select count(DISTINCT cstring2), sum(cdouble) FROM druid_table_alltypesorc GROUP  BY `__time`, `cstring1`
 PREHOOK: type: QUERY
 PREHOOK: Input: default@druid_table_alltypesorc
@@ -535,7 +705,7 @@ STAGE PLANS:
                   properties:
                     druid.fieldNames extract,cstring1,cstring2,$f3
                     druid.fieldTypes timestamp with local time zone,string,string,double
-                    druid.query.json {"queryType":"groupBy","dataSource":"default.druid_table_alltypesorc","granularity":"all","dimensions":[{"type":"extraction","dimension":"__time","outputName":"extract","extractionFn":{"type":"timeFormat","format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},{"type":"default","dimension":"cstring1","outputName":"cstring1","outputType":"STRING"},{"type":"default","dimension":"cstring2","outputName":"cstring2","outputType":"STRING"}],"limitSpec":{" [...]
+                    druid.query.json {"queryType":"groupBy","dataSource":"default.druid_table_alltypesorc","granularity":"all","dimensions":[{"type":"extraction","dimension":"__time","outputName":"extract","extractionFn":{"type":"timeFormat","format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},{"type":"default","dimension":"cstring1","outputName":"cstring1","outputType":"STRING"},{"type":"default","dimension":"cstring2","outputName":"cstring2","outputType":"STRING"}],"limitSpec":{" [...]
                     druid.query.type groupBy
                   Statistics: Num rows: 9173 Data size: 3625856 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -1652,7 +1822,7 @@ STAGE PLANS:
                   properties:
                     druid.fieldNames vc,vc0
                     druid.fieldTypes date,date
-                    druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"virtualColumns":[{"type":"expression","name":"vc","expression":"timestamp_shift(timestamp_floor(timestamp_parse(timestamp_format(\"__time\",'yyyy-MM-dd\\u0027T\\u0027HH:mm:ss.SSS\\u0027Z\\u0027','US/Pacific'),'','UTC'),'P1D','','UTC'),'P1D',CAST((\"cdouble\" / CAST(1000, 'DOUBLE')), 'LONG'),'UTC')","outputType":"LONG"}, [...]
+                    druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"virtualColumns":[{"type":"expression","name":"vc","expression":"timestamp_shift(timestamp_floor(timestamp_parse(timestamp_format(\"__time\",'yyyy-MM-dd\\u0027T\\u0027HH:mm:ss.SSS\\u0027Z\\u0027','US/Pacific'),'','UTC'),'P1D','','UTC'),'P1D',CAST((\"cdouble\" / 1000), 'LONG'),'UTC')","outputType":"LONG"},{"type":"express [...]
                     druid.query.type scan
                   Statistics: Num rows: 9173 Data size: 976192 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
diff --git a/ql/src/test/results/clientpositive/druid/druidmini_extractTime.q.out b/ql/src/test/results/clientpositive/druid/druidmini_extractTime.q.out
index 4ea95f6..7ae55e9 100644
--- a/ql/src/test/results/clientpositive/druid/druidmini_extractTime.q.out
+++ b/ql/src/test/results/clientpositive/druid/druidmini_extractTime.q.out
@@ -589,7 +589,7 @@ STAGE PLANS:
           properties:
             druid.fieldNames vc,vc0,vc1
             druid.fieldTypes double,int,string
-            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"},{"type":"bound","dimension":"__time","lower":"11","lowerStrict":false,"upper":"12","upperStrict":false,"ordering":"numeric","extractionFn":{"type":"timeFormat","format":"M"," [...]
+            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"},{"type":"bound","dimension":"__time","lower":"11","lowerStrict":false,"upper":"12","upperStrict":false,"ordering":"numeric","extractionFn":{"type":"timeFormat","format":"M"," [...]
             druid.query.type scan
           Select Operator
             expressions: vc (type: double), vc0 (type: int), vc1 (type: string)
@@ -630,7 +630,7 @@ STAGE PLANS:
           properties:
             druid.fieldNames vc,vc0
             druid.fieldTypes int,double
-            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(timestamp_extract(\"__time\",'QUARTER','US/Pacific') >= 4)"},{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"}]},"virtualColumns":[{"type":"expression","name":"vc","expression":"timestamp_ [...]
+            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(timestamp_extract(\"__time\",'QUARTER','US/Pacific') >= 4)"},{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"}]},"virtualColumns":[{"type":"expression","name":"vc","expression":"timestamp_ [...]
             druid.query.type scan
           Select Operator
             expressions: vc (type: int), vc0 (type: double)
diff --git a/ql/src/test/results/clientpositive/druid/druidmini_floorTime.q.out b/ql/src/test/results/clientpositive/druid/druidmini_floorTime.q.out
index 8d93824..685f85e 100644
--- a/ql/src/test/results/clientpositive/druid/druidmini_floorTime.q.out
+++ b/ql/src/test/results/clientpositive/druid/druidmini_floorTime.q.out
@@ -590,7 +590,7 @@ STAGE PLANS:
           properties:
             druid.fieldNames vc,vc0,vc1
             druid.fieldTypes double,int,string
-            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"},{"type":"bound","dimension":"__time","lower":"11","lowerStrict":false,"upper":"12","upperStrict":false,"ordering":"numeric","extractionFn":{"type":"timeFormat","format":"M"," [...]
+            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"},{"type":"bound","dimension":"__time","lower":"11","lowerStrict":false,"upper":"12","upperStrict":false,"ordering":"numeric","extractionFn":{"type":"timeFormat","format":"M"," [...]
             druid.query.type scan
           Select Operator
             expressions: vc (type: double), vc0 (type: int), vc1 (type: string)
@@ -631,7 +631,7 @@ STAGE PLANS:
           properties:
             druid.fieldNames vc,vc0
             druid.fieldTypes int,double
-            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(timestamp_extract(\"__time\",'QUARTER','US/Pacific') >= 4)"},{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"}]},"virtualColumns":[{"type":"expression","name":"vc","expression":"timestamp_ [...]
+            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"],"filter":{"type":"and","fields":[{"type":"expression","expression":"(timestamp_extract(\"__time\",'QUARTER','US/Pacific') >= 4)"},{"type":"expression","expression":"(((CAST(timestamp_extract(\"__time\",'MONTH','US/Pacific'), 'DOUBLE') / 4) + 1) == 4)"}]},"virtualColumns":[{"type":"expression","name":"vc","expression":"timestamp_ [...]
             druid.query.type scan
           Select Operator
             expressions: vc (type: int), vc0 (type: double)
diff --git a/ql/src/test/results/clientpositive/druid/druidmini_test_ts.q.out b/ql/src/test/results/clientpositive/druid/druidmini_test_ts.q.out
index 358e98b..917e22a 100644
--- a/ql/src/test/results/clientpositive/druid/druidmini_test_ts.q.out
+++ b/ql/src/test/results/clientpositive/druid/druidmini_test_ts.q.out
@@ -406,18 +406,15 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: druid_table_alltypesorc
-          filterExpr: (vc BETWEEN TIMESTAMPLOCALTZ'2010-01-01 00:00:00.0 US/Pacific' AND TIMESTAMPLOCALTZ'2011-01-01 00:00:00.0 US/Pacific' or vc BETWEEN TIMESTAMPLOCALTZ'2012-01-01 00:00:00.0 US/Pacific' AND TIMESTAMPLOCALTZ'2013-01-01 00:00:00.0 US/Pacific') (type: boolean)
           properties:
             druid.fieldNames vc
             druid.fieldTypes timestamp with local time zone
-            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["1900-01-01T00:00:00.000Z/2013-01-01T08:00:00.001Z"],"virtualColumns":[{"type":"expression","name":"vc","expression":"\"__time\"","outputType":"LONG"}],"columns":["vc"],"resultFormat":"compactedList"}
+            druid.query.json {"queryType":"scan","dataSource":"default.druid_table_alltypesorc","intervals":["2010-01-01T08:00:00.000Z/2011-01-01T08:00:00.001Z","2012-01-01T08:00:00.000Z/2013-01-01T08:00:00.001Z"],"virtualColumns":[{"type":"expression","name":"vc","expression":"\"__time\"","outputType":"LONG"}],"columns":["vc"],"resultFormat":"compactedList"}
             druid.query.type scan
-          Filter Operator
-            predicate: (vc BETWEEN TIMESTAMPLOCALTZ'2010-01-01 00:00:00.0 US/Pacific' AND TIMESTAMPLOCALTZ'2011-01-01 00:00:00.0 US/Pacific' or vc BETWEEN TIMESTAMPLOCALTZ'2012-01-01 00:00:00.0 US/Pacific' AND TIMESTAMPLOCALTZ'2013-01-01 00:00:00.0 US/Pacific') (type: boolean)
-            Select Operator
-              expressions: vc (type: timestamp with local time zone)
-              outputColumnNames: _col0
-              ListSink
+          Select Operator
+            expressions: vc (type: timestamp with local time zone)
+            outputColumnNames: _col0
+            ListSink
 
 PREHOOK: query: EXPLAIN
 SELECT `__time`
diff --git a/ql/src/test/results/clientpositive/dynamic_partition_skip_default.q.out b/ql/src/test/results/clientpositive/dynamic_partition_skip_default.q.out
index 0c2ad97..cd8e9c0 100644
--- a/ql/src/test/results/clientpositive/dynamic_partition_skip_default.q.out
+++ b/ql/src/test/results/clientpositive/dynamic_partition_skip_default.q.out
@@ -214,6 +214,9 @@ POSTHOOK: Input: default@dynamic_part_table
 POSTHOOK: Input: default@dynamic_part_table@partcol1=1/partcol2=1
 POSTHOOK: Input: default@dynamic_part_table@partcol1=1/partcol2=__HIVE_DEFAULT_PARTITION__
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `intcol`
+FROM `default`.`dynamic_part_table`
+WHERE `partcol2` IN ('1', '__HIVE_DEFAULT_PARTITION__') AND `partcol1` = '1'
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
 
diff --git a/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out b/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
index e5e6fd1..feaf814 100644
--- a/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
+++ b/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
@@ -545,10 +545,10 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`, CAST(`key` AS DOUBLE) AS `CAST`
 FROM `default`.`src`
-WHERE `key` IS NOT NULL) AS `t0`
+WHERE CAST(`key` AS DOUBLE) IS NOT NULL) AS `t0`
 INNER JOIN (SELECT `key`, `value`, CAST(`key` AS DOUBLE) AS `CAST`
 FROM `default`.`encrypted_table`
-WHERE `key` IS NOT NULL) AS `t2` ON `t0`.`CAST` = `t2`.`CAST`
+WHERE CAST(`key` AS DOUBLE) IS NOT NULL) AS `t2` ON `t0`.`CAST` = `t2`.`CAST`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -559,12 +559,12 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: t1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Filter Operator
               isSamplingPred: false
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
@@ -581,12 +581,12 @@ STAGE PLANS:
                   auto parallelism: false
           TableScan
             alias: t2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 47500 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Filter Operator
               isSamplingPred: false
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 47500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/except_all.q.out b/ql/src/test/results/clientpositive/except_all.q.out
index 24a7dfb..da862bc 100644
--- a/ql/src/test/results/clientpositive/except_all.q.out
+++ b/ql/src/test/results/clientpositive/except_all.q.out
@@ -318,7 +318,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 250 Data size: 48500 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: ((2 * _col2) - (3 * _col3)) (type: bigint), _col0 (type: string), _col1 (type: string)
+            expressions: ((2L * _col2) - (3L * _col3)) (type: bigint), _col0 (type: string), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 250 Data size: 46500 Basic stats: COMPLETE Column stats: COMPLETE
             UDTF Operator
@@ -505,7 +505,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 250 Data size: 48500 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: ((2 * _col2) - (3 * _col3)) (type: bigint), _col0 (type: string), _col1 (type: string)
+            expressions: ((2L * _col2) - (3L * _col3)) (type: bigint), _col0 (type: string), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 250 Data size: 46500 Basic stats: COMPLETE Column stats: COMPLETE
             UDTF Operator
@@ -609,7 +609,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 125 Data size: 24250 Basic stats: COMPLETE Column stats: COMPLETE
           Filter Operator
-            predicate: (((_col2 * 2) = _col3) and (_col2 > 0L)) (type: boolean)
+            predicate: (((_col2 * 2L) = _col3) and (_col2 > 0L)) (type: boolean)
             Statistics: Num rows: 20 Data size: 3880 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
               expressions: _col0 (type: string), _col1 (type: string)
@@ -683,7 +683,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 135 Data size: 26190 Basic stats: COMPLETE Column stats: COMPLETE
           Filter Operator
-            predicate: (((_col2 * 2) = _col3) and (_col2 > 0L)) (type: boolean)
+            predicate: (((_col2 * 2L) = _col3) and (_col2 > 0L)) (type: boolean)
             Statistics: Num rows: 22 Data size: 4268 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
               expressions: _col0 (type: string), _col1 (type: string)
@@ -950,7 +950,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
           Filter Operator
-            predicate: (((_col1 * 2) = _col2) and (_col1 > 0L)) (type: boolean)
+            predicate: (((_col1 * 2L) = _col2) and (_col1 > 0L)) (type: boolean)
             Statistics: Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
               expressions: _col0 (type: int)
diff --git a/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out b/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
index 8627583..7596543 100644
--- a/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
+++ b/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
@@ -341,7 +341,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col4
           Statistics: Num rows: 6 Data size: 582 Basic stats: COMPLETE Column stats: COMPLETE
           Filter Operator
-            predicate: (((_col1 + _col4) > 2) or _col2) (type: boolean)
+            predicate: (((_col1 + _col4) > 2.0) or _col2) (type: boolean)
             Statistics: Num rows: 5 Data size: 485 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
               expressions: _col0 (type: string)
diff --git a/ql/src/test/results/clientpositive/fold_case.q.out b/ql/src/test/results/clientpositive/fold_case.q.out
index f4ef28d..53d19c5 100644
--- a/ql/src/test/results/clientpositive/fold_case.q.out
+++ b/ql/src/test/results/clientpositive/fold_case.q.out
@@ -76,10 +76,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not COALESCE((key = '238'),false)) (type: boolean)
+            filterExpr: (key = '238') is not true (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (not COALESCE((key = '238'),false)) (type: boolean)
+              predicate: (key = '238') is not true (type: boolean)
               Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
@@ -384,13 +384,13 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not COALESCE((key = '238'),false)) (type: boolean)
+            filterExpr: (key = '238') is not true (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (not COALESCE((key = '238'),false)) (type: boolean)
+              predicate: (key = '238') is not true (type: boolean)
               Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
-                expressions: CASE WHEN ((key = '238')) THEN (null) ELSE (false) END (type: boolean)
+                expressions: ((key = '238') is true and null) (type: boolean)
                 outputColumnNames: _col0
                 Statistics: Num rows: 250 Data size: 1000 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
@@ -473,10 +473,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: CASE WHEN ((key = '238')) THEN (null) ELSE (true) END (type: boolean)
+            filterExpr: (key = '238') is not true (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: CASE WHEN ((key = '238')) THEN (null) ELSE (true) END (type: boolean)
+              predicate: (key = '238') is not true (type: boolean)
               Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
diff --git a/ql/src/test/results/clientpositive/fold_eq_with_case_when.q.out b/ql/src/test/results/clientpositive/fold_eq_with_case_when.q.out
index 7bd756a..2b87d3b 100644
--- a/ql/src/test/results/clientpositive/fold_eq_with_case_when.q.out
+++ b/ql/src/test/results/clientpositive/fold_eq_with_case_when.q.out
@@ -236,18 +236,17 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: CASE WHEN ((key <> '238')) THEN ((key = '238')) WHEN ((key = '23')) THEN ((key = '238')) ELSE (null) END (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: CASE WHEN ((key <> '238')) THEN ((key = '238')) WHEN ((key = '23')) THEN ((key = '238')) ELSE (null) END (type: boolean)
-              Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: false (type: boolean)
+              Statistics: Num rows: 1 Data size: 87 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string)
                 outputColumnNames: _col0
-                Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 1 Data size: 87 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 87 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/fold_to_null.q.out b/ql/src/test/results/clientpositive/fold_to_null.q.out
index 84c379e..5104400 100644
--- a/ql/src/test/results/clientpositive/fold_to_null.q.out
+++ b/ql/src/test/results/clientpositive/fold_to_null.q.out
@@ -161,10 +161,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: t
-            filterExpr: (((a > 5) or null) and ((a * a) < 101) and a is not null) (type: boolean)
+            filterExpr: ((a > 5) and ((a * a) < 101)) (type: boolean)
             Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (((a * a) < 101) and ((a > 5) or null) and a is not null) (type: boolean)
+              predicate: (((a * a) < 101) and (a > 5)) (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: a (type: int)
@@ -177,10 +177,10 @@ STAGE PLANS:
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
           TableScan
             alias: t2
-            filterExpr: (((b > 5) or null) and ((b * b) < 101) and b is not null) (type: boolean)
+            filterExpr: ((b > 5) and ((b * b) < 101)) (type: boolean)
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (((b * b) < 101) and ((b > 5) or null) and b is not null) (type: boolean)
+              predicate: (((b * b) < 101) and (b > 5)) (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: b (type: int)
@@ -218,10 +218,10 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: t3
-            filterExpr: (((c > 5) or null) and ((c * c) < 101) and c is not null) (type: boolean)
+            filterExpr: ((c > 5) and ((c * c) < 101)) (type: boolean)
             Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (((c * c) < 101) and ((c > 5) or null) and c is not null) (type: boolean)
+              predicate: (((c * c) < 101) and (c > 5)) (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: c (type: int)
diff --git a/ql/src/test/results/clientpositive/fold_when.q.out b/ql/src/test/results/clientpositive/fold_when.q.out
index 2cf30b5..2ff8595 100644
--- a/ql/src/test/results/clientpositive/fold_when.q.out
+++ b/ql/src/test/results/clientpositive/fold_when.q.out
@@ -376,10 +376,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not COALESCE((key = '238'),false)) (type: boolean)
+            filterExpr: (key = '238') is not true (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (not COALESCE((key = '238'),false)) (type: boolean)
+              predicate: (key = '238') is not true (type: boolean)
               Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string)
@@ -501,10 +501,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not COALESCE((key = '11'),false)) (type: boolean)
+            filterExpr: (key = '11') is not true (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (not COALESCE((key = '11'),false)) (type: boolean)
+              predicate: (key = '11') is not true (type: boolean)
               Statistics: Num rows: 250 Data size: 21750 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string)
diff --git a/ql/src/test/results/clientpositive/groupby_grouping_sets_grouping.q.out b/ql/src/test/results/clientpositive/groupby_grouping_sets_grouping.q.out
index 33e6888..3d270ec 100644
--- a/ql/src/test/results/clientpositive/groupby_grouping_sets_grouping.q.out
+++ b/ql/src/test/results/clientpositive/groupby_grouping_sets_grouping.q.out
@@ -61,7 +61,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1) (type: bigint), grouping(_col2, 0) (type: bigint)
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4
             Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -148,7 +148,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1) (type: bigint), grouping(_col2, 0) (type: bigint)
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4
             Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -242,7 +242,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (grouping(_col2, 1) = 1) (type: boolean)
+            predicate: (grouping(_col2, 1L) = 1L) (type: boolean)
             Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col0 (type: int), _col1 (type: int)
@@ -334,10 +334,10 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((grouping(_col2, 0) = 1) or (grouping(_col2, 1) = 1)) (type: boolean)
+            predicate: ((grouping(_col2, 0L) = 1L) or (grouping(_col2, 1L) = 1L)) (type: boolean)
             Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: _col0 (type: int), _col1 (type: int), (grouping(_col2, 1) + grouping(_col2, 0)) (type: bigint), CASE WHEN (((grouping(_col2, 1) + grouping(_col2, 0)) = 1)) THEN (_col0) ELSE (null) END (type: int)
+              expressions: _col0 (type: int), _col1 (type: int), (grouping(_col2, 1L) + grouping(_col2, 0L)) (type: bigint), CASE WHEN (((grouping(_col2, 1L) + grouping(_col2, 0L)) = 1L)) THEN (_col0) ELSE (null) END (type: int)
               outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: NONE
               File Output Operator
diff --git a/ql/src/test/results/clientpositive/groupby_rollup_empty.q.out b/ql/src/test/results/clientpositive/groupby_rollup_empty.q.out
index ecfd766..56f30cd 100644
--- a/ql/src/test/results/clientpositive/groupby_rollup_empty.q.out
+++ b/ql/src/test/results/clientpositive/groupby_rollup_empty.q.out
@@ -194,7 +194,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col3 (type: bigint), grouping(_col2, 0) (type: bigint), 'NULL,1' (type: string)
+            expressions: _col3 (type: bigint), grouping(_col2, 0L) (type: bigint), 'NULL,1' (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
diff --git a/ql/src/test/results/clientpositive/groupby_sort_1_23.q.out b/ql/src/test/results/clientpositive/groupby_sort_1_23.q.out
index e4ca83b..d915c07 100644
--- a/ql/src/test/results/clientpositive/groupby_sort_1_23.q.out
+++ b/ql/src/test/results/clientpositive/groupby_sort_1_23.q.out
@@ -2478,9 +2478,9 @@ SELECT key, key + 1, count(1) FROM T1_n80 GROUP BY key, key + 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@t1_n80
 POSTHOOK: Output: default@outputtbl3_n2
-OPTIMIZED SQL: SELECT `key` AS `$f0`, CAST(`key` AS DOUBLE) + CAST(1 AS DOUBLE) AS `$f1`, COUNT(*) AS `$f2`
+OPTIMIZED SQL: SELECT `key` AS `$f0`, CAST(`key` AS DOUBLE) + 1 AS `$f1`, COUNT(*) AS `$f2`
 FROM `default`.`t1_n80`
-GROUP BY `key`, CAST(`key` AS DOUBLE) + CAST(1 AS DOUBLE)
+GROUP BY `key`, CAST(`key` AS DOUBLE) + 1
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/groupby_sort_skew_1_23.q.out b/ql/src/test/results/clientpositive/groupby_sort_skew_1_23.q.out
index 7f1a231..93c98fd 100644
--- a/ql/src/test/results/clientpositive/groupby_sort_skew_1_23.q.out
+++ b/ql/src/test/results/clientpositive/groupby_sort_skew_1_23.q.out
@@ -2618,9 +2618,9 @@ SELECT key, key + 1, count(1) FROM T1_n56 GROUP BY key, key + 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@t1_n56
 POSTHOOK: Output: default@outputtbl3_n1
-OPTIMIZED SQL: SELECT `key` AS `$f0`, CAST(`key` AS DOUBLE) + CAST(1 AS DOUBLE) AS `$f1`, COUNT(*) AS `$f2`
+OPTIMIZED SQL: SELECT `key` AS `$f0`, CAST(`key` AS DOUBLE) + 1 AS `$f1`, COUNT(*) AS `$f2`
 FROM `default`.`t1_n56`
-GROUP BY `key`, CAST(`key` AS DOUBLE) + CAST(1 AS DOUBLE)
+GROUP BY `key`, CAST(`key` AS DOUBLE) + 1
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/in_typecheck_char.q.out b/ql/src/test/results/clientpositive/in_typecheck_char.q.out
index 464aad5..cb9e777 100644
--- a/ql/src/test/results/clientpositive/in_typecheck_char.q.out
+++ b/ql/src/test/results/clientpositive/in_typecheck_char.q.out
@@ -211,10 +211,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: ax
-            filterExpr: (((s = 'a') and (t = 'a         ')) or ((s = null) and (t = 'bb        '))) is null (type: boolean)
+            filterExpr: (((s = 'a') and (t = 'a         ')) or (null and (t = 'bb        '))) is null (type: boolean)
             Statistics: Num rows: 3 Data size: 510 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: (((s = 'a') and (t = 'a         ')) or ((s = null) and (t = 'bb        '))) is null (type: boolean)
+              predicate: (((s = 'a') and (t = 'a         ')) or (null and (t = 'bb        '))) is null (type: boolean)
               Statistics: Num rows: 1 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 Statistics: Num rows: 1 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
diff --git a/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out b/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
index cd9fb27..b892d2e 100644
--- a/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
+++ b/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
@@ -286,7 +286,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 316 Data size: 30020 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: _col1 is not null (type: boolean)
+                  predicate: UDFToDouble(_col1) is not null (type: boolean)
                   Statistics: Num rows: 316 Data size: 30020 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: bigint), UDFToDouble(_col1) (type: double)
@@ -300,10 +300,10 @@ STAGE PLANS:
                       value expressions: _col0 (type: string), _col1 (type: bigint)
           TableScan
             alias: src
-            filterExpr: value is not null (type: boolean)
+            filterExpr: UDFToDouble(value) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: value is not null (type: boolean)
+              predicate: UDFToDouble(value) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: UDFToDouble(value) (type: double)
diff --git a/ql/src/test/results/clientpositive/infer_join_preds.q.out b/ql/src/test/results/clientpositive/infer_join_preds.q.out
index 0afdd02..185d0f8 100644
--- a/ql/src/test/results/clientpositive/infer_join_preds.q.out
+++ b/ql/src/test/results/clientpositive/infer_join_preds.q.out
@@ -1179,7 +1179,7 @@ STAGE PLANS:
               predicate: prid is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 668 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: idp_warehouse_id (type: bigint), prid (type: bigint), concat(CAST( prid AS STRING), ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (CAST( prtypecodeid AS STRING)) END, ',', CASE WHEN (practsum is null) THEN (1) ELSE (practsum) END, [...]
+                expressions: idp_warehouse_id (type: bigint), prid (type: bigint), concat(CAST( CASE WHEN (prid is null) THEN (1) ELSE (prid) END AS STRING), ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (CAST( prtypecodeid AS STRING)) END, ',', CASE WHEN (pr [...]
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 668 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
@@ -1238,7 +1238,7 @@ STAGE PLANS:
               predicate: prid is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 776 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: prid (type: bigint), concat(CASE WHEN (length(pruid) is null) THEN ('') ELSE (pruid) END, ',', prid, ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (CAST( prtypecodeid AS STRING)) END, ',', CASE WHEN (practsum is null) THEN (1) ELS [...]
+                expressions: prid (type: bigint), concat(CASE WHEN (length(pruid) is null) THEN ('') ELSE (pruid) END, ',', CASE WHEN (prid is null) THEN (1) ELSE (prid) END, ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (CAST( prtypecodeid AS STRING)) END, ' [...]
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 776 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
diff --git a/ql/src/test/results/clientpositive/innerjoin1.q.out b/ql/src/test/results/clientpositive/innerjoin1.q.out
index cfc2c06..7a1f105 100644
--- a/ql/src/test/results/clientpositive/innerjoin1.q.out
+++ b/ql/src/test/results/clientpositive/innerjoin1.q.out
@@ -82,37 +82,37 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: c1
-            filterExpr: CASE WHEN (a1 is not null) THEN (a1 is not null) ELSE (a2 is not null) END (type: boolean)
+            filterExpr: (a1 is not null or a2 is not null) (type: boolean)
             Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: CASE WHEN (a1 is not null) THEN (a1 is not null) ELSE (a2 is not null) END (type: boolean)
-              Statistics: Num rows: 1 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: (a1 is not null or a2 is not null) (type: boolean)
+              Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: a1 (type: string), a2 (type: string), CASE WHEN (a1 is not null) THEN (a1) ELSE (a2) END (type: string)
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col2 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col2 (type: string)
-                  Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
             alias: c2
-            filterExpr: CASE WHEN (b1 is not null) THEN (b1 is not null) ELSE (b2 is not null) END (type: boolean)
+            filterExpr: (b1 is not null or b2 is not null) (type: boolean)
             Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: CASE WHEN (b1 is not null) THEN (b1 is not null) ELSE (b2 is not null) END (type: boolean)
-              Statistics: Num rows: 1 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: (b1 is not null or b2 is not null) (type: boolean)
+              Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: b1 (type: string), b2 (type: string), CASE WHEN (b1 is not null) THEN (b1) ELSE (b2) END (type: string)
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col2 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col2 (type: string)
-                  Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
@@ -122,14 +122,14 @@ STAGE PLANS:
             0 _col2 (type: string)
             1 _col2 (type: string)
           outputColumnNames: _col0, _col1, _col3, _col4
-          Statistics: Num rows: 1 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+          Statistics: Num rows: 2 Data size: 680 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
             expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 1 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+            Statistics: Num rows: 2 Data size: 680 Basic stats: COMPLETE Column stats: COMPLETE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 1 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+              Statistics: Num rows: 2 Data size: 680 Basic stats: COMPLETE Column stats: COMPLETE
               table:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -173,37 +173,37 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: c1
-            filterExpr: CASE WHEN (a1 is not null) THEN (a1 is not null) ELSE (a2 is not null) END (type: boolean)
+            filterExpr: (a1 is not null or a2 is not null) (type: boolean)
             Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: CASE WHEN (a1 is not null) THEN (a1 is not null) ELSE (a2 is not null) END (type: boolean)
-              Statistics: Num rows: 1 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: (a1 is not null or a2 is not null) (type: boolean)
+              Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: a1 (type: string), a2 (type: string), CASE WHEN (a1 is not null) THEN (a1) ELSE (a2) END (type: string)
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col2 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col2 (type: string)
-                  Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
             alias: c2
-            filterExpr: CASE WHEN (b1 is not null) THEN (b1 is not null) ELSE (b2 is not null) END (type: boolean)
+            filterExpr: (b1 is not null or b2 is not null) (type: boolean)
             Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: CASE WHEN (b1 is not null) THEN (b1 is not null) ELSE (b2 is not null) END (type: boolean)
-              Statistics: Num rows: 1 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
+              predicate: (b1 is not null or b2 is not null) (type: boolean)
+              Statistics: Num rows: 2 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: b1 (type: string), b2 (type: string), CASE WHEN (b1 is not null) THEN (b1) ELSE (b2) END (type: string)
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col2 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col2 (type: string)
-                  Statistics: Num rows: 1 Data size: 354 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 2 Data size: 708 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
@@ -213,14 +213,14 @@ STAGE PLANS:
             0 _col2 (type: string)
             1 _col2 (type: string)
           outputColumnNames: _col0, _col1, _col3, _col4
-          Statistics: Num rows: 1 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+          Statistics: Num rows: 2 Data size: 680 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
             expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 1 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+            Statistics: Num rows: 2 Data size: 680 Basic stats: COMPLETE Column stats: COMPLETE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 1 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+              Statistics: Num rows: 2 Data size: 680 Basic stats: COMPLETE Column stats: COMPLETE
               table:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/input8.q.out b/ql/src/test/results/clientpositive/input8.q.out
index 32daa05..781fb96 100644
--- a/ql/src/test/results/clientpositive/input8.q.out
+++ b/ql/src/test/results/clientpositive/input8.q.out
@@ -34,14 +34,14 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src1
-            Statistics: Num rows: 25 Data size: 2150 Basic stats: COMPLETE Column stats: COMPLETE
+            Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: null (type: string), UDFToInteger((UDFToDouble(key) - null)) (type: int), null (type: double)
+              expressions: null (type: string), null (type: int), null (type: double)
               outputColumnNames: _col0, _col1, _col2
-              Statistics: Num rows: 25 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+              Statistics: Num rows: 25 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
                 compressed: false
-                Statistics: Num rows: 25 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 25 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
                 table:
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -50,7 +50,7 @@ STAGE PLANS:
               Select Operator
                 expressions: _col0 (type: string), _col1 (type: int), _col2 (type: double)
                 outputColumnNames: c1, c2, c3
-                Statistics: Num rows: 25 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 25 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
                   aggregations: compute_stats(c1, 'hll'), compute_stats(c2, 'hll'), compute_stats(c3, 'hll')
                   minReductionHashAggr: 0.99
@@ -143,7 +143,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src1
 POSTHOOK: Output: default@dest1_n28
 POSTHOOK: Lineage: dest1_n28.c1 EXPRESSION []
-POSTHOOK: Lineage: dest1_n28.c2 EXPRESSION [(src1)src1.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: dest1_n28.c2 EXPRESSION []
 POSTHOOK: Lineage: dest1_n28.c3 EXPRESSION []
 PREHOOK: query: SELECT dest1_n28.* FROM dest1_n28
 PREHOOK: type: QUERY
diff --git a/ql/src/test/results/clientpositive/join2.q.out b/ql/src/test/results/clientpositive/join2.q.out
index ec9e436..5d4ba81 100644
--- a/ql/src/test/results/clientpositive/join2.q.out
+++ b/ql/src/test/results/clientpositive/join2.q.out
@@ -30,10 +30,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src1
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -47,10 +47,10 @@ STAGE PLANS:
                   value expressions: _col1 (type: double)
           TableScan
             alias: src2
-            filterExpr: key is not null (type: boolean)
+            filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
             Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: key (type: string), UDFToDouble(key) (type: double)
@@ -90,10 +90,10 @@ STAGE PLANS:
               value expressions: _col0 (type: string)
           TableScan
             alias: src3
-            filterExpr: key is not null (type: boolean)
+            filterExpr: UDFToDouble(key) is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
-              predicate: key is not null (type: boolean)
+              predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
                 expressions: value (type: string), UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/join_filters_overlap.q.out b/ql/src/test/results/clientpositive/join_filters_overlap.q.out
index 6cd17d1..41ebfcc 100644
--- a/ql/src/test/results/clientpositive/join_filters_overlap.q.out
+++ b/ql/src/test/results/clientpositive/join_filters_overlap.q.out
@@ -18,6 +18,15 @@ POSTHOOK: query: explain extended select * from a_n4 left outer join a_n4 b on (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `t`.`key`, `t`.`value`, `t1`.`key` AS `key1`, `t1`.`value` AS `value1`, `t3`.`key` AS `key2`, `t3`.`value` AS `value2`
+FROM (SELECT `key`, `value`, `value` = 60 AS `=`, `value` = 50 AS `=3`
+FROM `default`.`a_n4`) AS `t`
+LEFT JOIN (SELECT `key`, CAST(50 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 50) AS `t1` ON `t`.`key` = `t1`.`key` AND `t`.`=3`
+LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 60) AS `t3` ON `t`.`key` = `t3`.`key` AND `t`.`=`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -343,6 +352,15 @@ POSTHOOK: query: explain extended select * from a_n4 right outer join a_n4 b on
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t1`.`key` AS `key1`, `t1`.`value` AS `value1`, `t3`.`key` AS `key2`, `t3`.`value` AS `value2`
+FROM (SELECT `key`, CAST(50 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 50) AS `t0`
+RIGHT JOIN (SELECT `key`, `value`, `value` = 60 AS `=`, `value` = 50 AS `=3`
+FROM `default`.`a_n4`) AS `t1` ON `t0`.`key` = `t1`.`key` AND `t1`.`=3`
+LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 60) AS `t3` ON `t1`.`key` = `t3`.`key` AND `t1`.`=`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -668,6 +686,15 @@ POSTHOOK: query: explain extended select * from a_n4 right outer join a_n4 b on
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t1`.`key` AS `key1`, `t1`.`value` AS `value1`, `t3`.`key` AS `key2`, `t3`.`value` AS `value2`
+FROM (SELECT `key`, CAST(50 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 50) AS `t0`
+RIGHT JOIN (SELECT `key`, `value`, `value` = 60 AS `=`, `value` = 50 AS `=3`
+FROM `default`.`a_n4`) AS `t1` ON `t0`.`key` = `t1`.`key` AND `t1`.`=3`
+LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 60) AS `t3` ON `t1`.`key` = `t3`.`key` AND `t1`.`=`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -993,6 +1020,17 @@ POSTHOOK: query: explain extended select * from a_n4 full outer join a_n4 b on (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `t`.`key`, `t`.`value`, `t0`.`key` AS `key1`, `t0`.`value` AS `value1`, `t2`.`key` AS `key2`, `t2`.`value` AS `value2`, `t4`.`key` AS `key3`, `t4`.`value` AS `value3`
+FROM (SELECT `key`, `value`, `value` = 40 AS `=`, `value` = 50 AS `=3`
+FROM `default`.`a_n4`) AS `t`
+FULL JOIN (SELECT `key`, `value`, `value` = 60 AS `=`, `value` = 50 AS `=3`
+FROM `default`.`a_n4`) AS `t0` ON `t`.`key` = `t0`.`key` AND `t`.`=3` AND `t0`.`=3`
+LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 60) AS `t2` ON `t0`.`key` = `t2`.`key` AND `t0`.`=`
+LEFT JOIN (SELECT `key`, CAST(40 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 40) AS `t4` ON `t`.`key` = `t4`.`key` AND `t`.`=`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -1452,6 +1490,18 @@ POSTHOOK: query: explain extended select * from a_n4 left outer join a_n4 b on (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `t`.`key`, `t`.`value`, `t1`.`key` AS `key1`, `t1`.`value` AS `value1`, `t3`.`key` AS `key2`, `t3`.`value` AS `value2`, `t5`.`key` AS `key3`, `t5`.`value` AS `value3`
+FROM (SELECT `key`, `value`, `value` = 40 AS `=`, `value` = 60 AS `=3`, `value` = 50 AS `=4`
+FROM `default`.`a_n4`) AS `t`
+LEFT JOIN (SELECT `key`, CAST(50 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 50) AS `t1` ON `t`.`key` = `t1`.`key` AND `t`.`=4`
+LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 60) AS `t3` ON `t`.`key` = `t3`.`key` AND `t`.`=3`
+LEFT JOIN (SELECT `key`, CAST(40 AS INTEGER) AS `value`
+FROM `default`.`a_n4`
+WHERE `value` = 40) AS `t5` ON `t`.`key` = `t5`.`key` AND `t`.`=`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/list_bucket_dml_6.q.out b/ql/src/test/results/clientpositive/list_bucket_dml_6.q.out
index da36c45..40a110d 100644
--- a/ql/src/test/results/clientpositive/list_bucket_dml_6.q.out
+++ b/ql/src/test/results/clientpositive/list_bucket_dml_6.q.out
@@ -29,7 +29,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-OPTIMIZED SQL: SELECT `key`, `value`, IF(MOD(CAST(`key` AS DOUBLE), CAST(100 AS DOUBLE)) = 0, 'a1', 'b1') AS `_o__c2`
+OPTIMIZED SQL: SELECT `key`, `value`, IF(CAST(`key` AS DOUBLE) % 100 = 0, 'a1', 'b1') AS `_o__c2`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
@@ -405,7 +405,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-OPTIMIZED SQL: SELECT `key`, `value`, IF(MOD(CAST(`key` AS DOUBLE), CAST(100 AS DOUBLE)) = 0, 'a1', 'b1') AS `_o__c2`
+OPTIMIZED SQL: SELECT `key`, `value`, IF(CAST(`key` AS DOUBLE) % 100 = 0, 'a1', 'b1') AS `_o__c2`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
diff --git a/ql/src/test/results/clientpositive/list_bucket_dml_7.q.out b/ql/src/test/results/clientpositive/list_bucket_dml_7.q.out
index 68664a7..cdcbbf5 100644
--- a/ql/src/test/results/clientpositive/list_bucket_dml_7.q.out
+++ b/ql/src/test/results/clientpositive/list_bucket_dml_7.q.out
@@ -29,7 +29,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-OPTIMIZED SQL: SELECT `key`, `value`, IF(MOD(CAST(`key` AS DOUBLE), CAST(100 AS DOUBLE)) = 0, 'a1', 'b1') AS `_o__c2`
+OPTIMIZED SQL: SELECT `key`, `value`, IF(CAST(`key` AS DOUBLE) % 100 = 0, 'a1', 'b1') AS `_o__c2`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
@@ -405,7 +405,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-OPTIMIZED SQL: SELECT `key`, `value`, IF(MOD(CAST(`key` AS DOUBLE), CAST(100 AS DOUBLE)) = 0, 'a1', 'b1') AS `_o__c2`
+OPTIMIZED SQL: SELECT `key`, `value`, IF(CAST(`key` AS DOUBLE) % 100 = 0, 'a1', 'b1') AS `_o__c2`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
diff --git a/ql/src/test/results/clientpositive/list_bucket_dml_8.q.out b/ql/src/test/results/clientpositive/list_bucket_dml_8.q.out
index 6521e0f..29e45dc 100644
--- a/ql/src/test/results/clientpositive/list_bucket_dml_8.q.out
+++ b/ql/src/test/results/clientpositive/list_bucket_dml_8.q.out
@@ -29,7 +29,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-OPTIMIZED SQL: SELECT `key`, `value`, IF(MOD(CAST(`key` AS DOUBLE), CAST(100 AS DOUBLE)) = 0, 'a1', 'b1') AS `_o__c2`
+OPTIMIZED SQL: SELECT `key`, `value`, IF(CAST(`key` AS DOUBLE) % 100 = 0, 'a1', 'b1') AS `_o__c2`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
diff --git a/ql/src/test/results/clientpositive/list_bucket_query_multiskew_2.q.out b/ql/src/test/results/clientpositive/list_bucket_query_multiskew_2.q.out
index c6a3c1f..04ddcfe 100644
--- a/ql/src/test/results/clientpositive/list_bucket_query_multiskew_2.q.out
+++ b/ql/src/test/results/clientpositive/list_bucket_query_multiskew_2.q.out
@@ -397,6 +397,9 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@fact_daily_n2
 POSTHOOK: Input: default@fact_daily_n2@ds=1/hr=4
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`
+FROM `default`.`fact_daily_n2`
+WHERE ROW(`key`, `value`) IN (ROW('484', 'val_484'), ROW('238', 'val_238')) AND `ds` = '1' AND `hr` = '4'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_12.q.out b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_12.q.out
index 30f8f05..f88896d 100644
--- a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_12.q.out
+++ b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_12.q.out
@@ -134,7 +134,7 @@ POSTHOOK: query: load data local inpath '../../data/files/auto_sortmerge_join/sm
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@bucket_medium@ds=2008-04-08
-Warning: Shuffle Join MERGEJOIN[60][tables = [$hdt$_0, $hdt$_1, $hdt$_2, $hdt$_3]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[63][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: explain extended select count(*) FROM bucket_small_n15 a JOIN bucket_medium b ON a.key = b.key JOIN bucket_big_n15 c ON c.key = b.key JOIN bucket_medium d ON c.key = b.key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@bucket_big_n15
@@ -156,17 +156,20 @@ POSTHOOK: Input: default@bucket_small_n15
 POSTHOOK: Input: default@bucket_small_n15@ds=2008-04-08
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT COUNT(*) AS `$f0`
+FROM (SELECT 0 AS `DUMMY`
+FROM `default`.`bucket_medium`) AS `t`,
+(SELECT 0 AS `DUMMY`
+FROM (SELECT `t5`.`key`, `t3`.`key` AS `key0`, `t1`.`key` AS `key1`
 FROM (SELECT `key`
 FROM `default`.`bucket_big_n15`
-WHERE `key` IS NOT NULL) AS `t0`
+WHERE `key` IS NOT NULL) AS `t1`
 INNER JOIN (SELECT `key`
 FROM `default`.`bucket_medium`
-WHERE `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
+WHERE `key` IS NOT NULL) AS `t3` ON `t1`.`key` = `t3`.`key`
 INNER JOIN (SELECT `key`
 FROM `default`.`bucket_small_n15`
-WHERE `key` IS NOT NULL) AS `t4` ON `t2`.`key` = `t4`.`key`,
-(SELECT 0 AS `DUMMY`
-FROM `default`.`bucket_medium`) AS `t5`
+WHERE `key` IS NOT NULL) AS `t5` ON `t3`.`key` = `t5`.`key`) AS `t6`
+WHERE `t6`.`key1` = `t6`.`key0`) AS `t8`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -176,14 +179,85 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
-        Reducer 3 <- Map 7 (XPROD_EDGE), Reducer 2 (XPROD_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (XPROD_EDGE), Reducer 5 (XPROD_EDGE)
+        Reducer 3 <- Reducer 2 (CUSTOM_SIMPLE_EDGE)
+        Reducer 5 <- Map 4 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
+                  alias: d
+                  Statistics: Num rows: 3 Data size: 1724 Basic stats: PARTIAL Column stats: COMPLETE
+                  GatherStats: false
+                  Select Operator
+                    Statistics: Num rows: 3 Data size: 1724 Basic stats: PARTIAL Column stats: COMPLETE
+                    Reduce Output Operator
+                      null sort order: 
+                      sort order: 
+                      Statistics: Num rows: 3 Data size: 1724 Basic stats: PARTIAL Column stats: COMPLETE
+                      tag: 0
+                      auto parallelism: false
+            Execution mode: vectorized, llap
+            LLAP IO: no inputs
+            Path -> Alias:
+#### A masked pattern was here ####
+            Path -> Partition:
+#### A masked pattern was here ####
+                Partition
+                  base file name: ds=2008-04-08
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  partition values:
+                    ds 2008-04-08
+                  properties:
+                    bucket_count 3
+                    bucket_field_name key
+                    column.name.delimiter ,
+                    columns key,value
+                    columns.comments 
+                    columns.types string:string
+#### A masked pattern was here ####
+                    name default.bucket_medium
+                    numFiles 3
+                    numRows 0
+                    partition_columns ds
+                    partition_columns.types string
+                    rawDataSize 0
+                    serialization.ddl struct bucket_medium { string key, string value}
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    totalSize 170
+#### A masked pattern was here ####
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                
+                    input format: org.apache.hadoop.mapred.TextInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                    properties:
+                      SORTBUCKETCOLSPREFIX TRUE
+                      bucket_count 3
+                      bucket_field_name key
+                      bucketing_version 2
+                      column.name.delimiter ,
+                      columns key,value
+                      columns.comments 
+                      columns.types string:string
+#### A masked pattern was here ####
+                      name default.bucket_medium
+                      partition_columns ds
+                      partition_columns.types string
+                      serialization.ddl struct bucket_medium { string key, string value}
+                      serialization.format 1
+                      serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+#### A masked pattern was here ####
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    name: default.bucket_medium
+                  name: default.bucket_medium
+            Truncated Path -> Alias:
+              /bucket_medium/ds=2008-04-08 [d]
+        Map 4 
+            Map Operator Tree:
+                TableScan
                   alias: b
                   filterExpr: key is not null (type: boolean)
                   Statistics: Num rows: 3 Data size: 552 Basic stats: PARTIAL Column stats: NONE
@@ -270,7 +344,7 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col1
+                        outputColumnNames: _col0, _col1
                         Position of Big Table: 0
                         Statistics: Num rows: 232 Data size: 37723 Basic stats: PARTIAL Column stats: NONE
                         Reduce Output Operator
@@ -280,6 +354,7 @@ STAGE PLANS:
                           Map-reduce partition columns: _col1 (type: string)
                           Statistics: Num rows: 232 Data size: 37723 Basic stats: PARTIAL Column stats: NONE
                           tag: 0
+                          value expressions: _col0 (type: string)
                           auto parallelism: true
             Execution mode: llap
             Path -> Alias:
@@ -386,7 +461,7 @@ STAGE PLANS:
             Truncated Path -> Alias:
               /bucket_big_n15/ds=2008-04-08 [c]
               /bucket_big_n15/ds=2008-04-09 [c]
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
                   alias: a
@@ -466,77 +541,6 @@ STAGE PLANS:
                   name: default.bucket_small_n15
             Truncated Path -> Alias:
               /bucket_small_n15/ds=2008-04-08 [a]
-        Map 7 
-            Map Operator Tree:
-                TableScan
-                  alias: d
-                  Statistics: Num rows: 3 Data size: 1724 Basic stats: PARTIAL Column stats: COMPLETE
-                  GatherStats: false
-                  Select Operator
-                    Statistics: Num rows: 3 Data size: 1724 Basic stats: PARTIAL Column stats: COMPLETE
-                    Reduce Output Operator
-                      null sort order: 
-                      sort order: 
-                      Statistics: Num rows: 3 Data size: 1724 Basic stats: PARTIAL Column stats: COMPLETE
-                      tag: 1
-                      auto parallelism: false
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-            Path -> Alias:
-#### A masked pattern was here ####
-            Path -> Partition:
-#### A masked pattern was here ####
-                Partition
-                  base file name: ds=2008-04-08
-                  input format: org.apache.hadoop.mapred.TextInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                  partition values:
-                    ds 2008-04-08
-                  properties:
-                    bucket_count 3
-                    bucket_field_name key
-                    column.name.delimiter ,
-                    columns key,value
-                    columns.comments 
-                    columns.types string:string
-#### A masked pattern was here ####
-                    name default.bucket_medium
-                    numFiles 3
-                    numRows 0
-                    partition_columns ds
-                    partition_columns.types string
-                    rawDataSize 0
-                    serialization.ddl struct bucket_medium { string key, string value}
-                    serialization.format 1
-                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                    totalSize 170
-#### A masked pattern was here ####
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                
-                    input format: org.apache.hadoop.mapred.TextInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                    properties:
-                      SORTBUCKETCOLSPREFIX TRUE
-                      bucket_count 3
-                      bucket_field_name key
-                      bucketing_version 2
-                      column.name.delimiter ,
-                      columns key,value
-                      columns.comments 
-                      columns.types string:string
-#### A masked pattern was here ####
-                      name default.bucket_medium
-                      partition_columns ds
-                      partition_columns.types string
-                      serialization.ddl struct bucket_medium { string key, string value}
-                      serialization.format 1
-                      serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-#### A masked pattern was here ####
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                    name: default.bucket_medium
-                  name: default.bucket_medium
-            Truncated Path -> Alias:
-              /bucket_medium/ds=2008-04-08 [d]
         Reducer 2 
             Execution mode: llap
             Needs Tagging: false
@@ -545,28 +549,10 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: string)
-                  1 _col0 (type: string)
-                Position of Big Table: 0
-                Statistics: Num rows: 255 Data size: 41495 Basic stats: PARTIAL Column stats: NONE
-                Reduce Output Operator
-                  null sort order: 
-                  sort order: 
-                  Statistics: Num rows: 255 Data size: 41495 Basic stats: PARTIAL Column stats: NONE
-                  tag: 0
-                  auto parallelism: false
-        Reducer 3 
-            Execution mode: llap
-            Needs Tagging: false
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
                   0 
                   1 
                 Position of Big Table: 0
-                Statistics: Num rows: 765 Data size: 564870 Basic stats: PARTIAL Column stats: NONE
+                Statistics: Num rows: 381 Data size: 281327 Basic stats: PARTIAL Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   minReductionHashAggr: 0.99
@@ -580,7 +566,7 @@ STAGE PLANS:
                     tag: -1
                     value expressions: _col0 (type: bigint)
                     auto parallelism: false
-        Reducer 4 
+        Reducer 3 
             Execution mode: vectorized, llap
             Needs Tagging: false
             Reduce Operator Tree:
@@ -611,6 +597,35 @@ STAGE PLANS:
                   TotalFiles: 1
                   GatherStats: false
                   MultiFileSpray: false
+        Reducer 5 
+            Execution mode: llap
+            Needs Tagging: false
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: string)
+                  1 _col0 (type: string)
+                outputColumnNames: _col0, _col1
+                Position of Big Table: 0
+                Statistics: Num rows: 255 Data size: 41495 Basic stats: PARTIAL Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: string), _col0 (type: string)
+                  outputColumnNames: _col1, _col2
+                  Statistics: Num rows: 255 Data size: 41495 Basic stats: PARTIAL Column stats: NONE
+                  Filter Operator
+                    isSamplingPred: false
+                    predicate: (_col2 = _col1) (type: boolean)
+                    Statistics: Num rows: 127 Data size: 20666 Basic stats: PARTIAL Column stats: NONE
+                    Select Operator
+                      Statistics: Num rows: 127 Data size: 20666 Basic stats: PARTIAL Column stats: NONE
+                      Reduce Output Operator
+                        null sort order: 
+                        sort order: 
+                        Statistics: Num rows: 127 Data size: 20666 Basic stats: PARTIAL Column stats: NONE
+                        tag: 1
+                        auto parallelism: false
 
   Stage: Stage-0
     Fetch Operator
@@ -618,7 +633,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join MERGEJOIN[60][tables = [$hdt$_0, $hdt$_1, $hdt$_2, $hdt$_3]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[63][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: select count(*) FROM bucket_small_n15 a JOIN bucket_medium b ON a.key = b.key JOIN bucket_big_n15 c ON c.key = b.key JOIN bucket_medium d ON c.key = b.key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@bucket_big_n15
diff --git a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_16.q.out b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_16.q.out
index 2c6d7ca..4e15692 100644
--- a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_16.q.out
+++ b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_16.q.out
@@ -222,7 +222,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: bucket_small_n17
-                  filterExpr: pri BETWEEN 1 AND 2 (type: boolean)
+                  filterExpr: pri BETWEEN 1L AND 2L (type: boolean)
                   Statistics: Num rows: 236 Data size: 45636 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: bigint), value (type: string)
@@ -370,7 +370,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: bucket_small_n17
-                  filterExpr: pri BETWEEN 1 AND 2 (type: boolean)
+                  filterExpr: pri BETWEEN 1L AND 2L (type: boolean)
                   Statistics: Num rows: 236 Data size: 45636 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: bigint), value (type: string)
@@ -626,7 +626,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: bucket_small_n17
-                  filterExpr: pri BETWEEN 1 AND 2 (type: boolean)
+                  filterExpr: pri BETWEEN 1L AND 2L (type: boolean)
                   Statistics: Num rows: 236 Data size: 45636 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: bigint), value (type: string)
diff --git a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
index f61a6ed..72a3a3a 100644
--- a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
+++ b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
@@ -573,10 +573,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
                   Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
                     Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int)
@@ -585,10 +585,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
                   Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
                     Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), UDFToDouble(key) (type: double)
@@ -612,10 +612,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: c
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(key) (type: double)
@@ -1167,10 +1167,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
                   Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
                     Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int)
@@ -1179,10 +1179,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: (key is not null and UDFToDouble(key) is not null) (type: boolean)
                   Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: (UDFToDouble(key) is not null and key is not null) (type: boolean)
                     Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), UDFToDouble(key) (type: double)
@@ -1206,10 +1206,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: c
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(key) (type: double)
diff --git a/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out b/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
index 2d48b9f..48076e5 100644
--- a/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
@@ -488,10 +488,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
@@ -509,10 +509,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string), UDFToDouble(key) (type: double)
@@ -578,10 +578,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
@@ -599,10 +599,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string), UDFToDouble(key) (type: double)
@@ -1370,10 +1370,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: tab_n10
-                  filterExpr: value is not null (type: boolean)
+                  filterExpr: UDFToDouble(value) is not null (type: boolean)
                   Statistics: Num rows: 242 Data size: 22022 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: value is not null (type: boolean)
+                    predicate: UDFToDouble(value) is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22022 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       keys: value (type: string)
@@ -1392,10 +1392,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string), UDFToDouble(key) (type: double)
@@ -1483,10 +1483,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: tab_n10
-                  filterExpr: value is not null (type: boolean)
+                  filterExpr: UDFToDouble(value) is not null (type: boolean)
                   Statistics: Num rows: 242 Data size: 22022 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: value is not null (type: boolean)
+                    predicate: UDFToDouble(value) is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22022 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       keys: value (type: string)
@@ -1505,10 +1505,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToDouble(key) is not null (type: boolean)
                   Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToDouble(key) is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string), UDFToDouble(key) (type: double)
@@ -2366,6 +2366,13 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@my_dim
 POSTHOOK: Input: default@my_fact
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `t0`.`bucket_col`, `t2`.`join_col` AS `account1`, `t0`.`accounting_period`
+FROM (SELECT `bucket_col`, `join_col`, `accounting_period`
+FROM `default`.`my_fact`
+WHERE `fiscal_year` = '2015' AND `accounting_period` = 10 AND `join_col` IS NOT NULL) AS `t0`
+INNER JOIN (SELECT `join_col`
+FROM `default`.`my_dim`
+WHERE `filter_col` IN ('VAL1', 'VAL2') AND `join_col` IS NOT NULL) AS `t2` ON `t0`.`join_col` = `t2`.`join_col`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/llap/bucketpruning1.q.out b/ql/src/test/results/clientpositive/llap/bucketpruning1.q.out
index 934b383..3772157 100644
--- a/ql/src/test/results/clientpositive/llap/bucketpruning1.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketpruning1.q.out
@@ -576,6 +576,9 @@ select * from srcbucket_pruned where key in (2,3)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (2, 3)
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -642,6 +645,9 @@ select * from srcbucket_pruned where key in (2,3) and ds='2008-04-08'
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (2, 3) AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -708,6 +714,9 @@ select * from srcbucket_pruned where key in (2,3) and ds='2008-04-08' and value=
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, CAST('One' AS STRING) AS `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (2, 3) AND `ds` = '2008-04-08' AND `value` = 'One'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -774,6 +783,9 @@ select * from srcbucket_pruned where value='One' and key in (2,3) and ds='2008-0
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, CAST('One' AS STRING) AS `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (2, 3) AND `value` = 'One' AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -840,6 +852,9 @@ select * from srcbucket_pruned where (key=1 or key=2) and ds='2008-04-08'
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2) AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -906,6 +921,9 @@ select * from srcbucket_pruned where (key=1 or key=2) and value = 'One' and ds='
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, CAST('One' AS STRING) AS `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2) AND `value` = 'One' AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1041,6 +1059,9 @@ select * from srcbucket_pruned where key in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1107,6 +1128,9 @@ select * from srcbucket_pruned where key in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17) AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1173,6 +1197,9 @@ select * from srcbucket_pruned where key in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, CAST('One' AS STRING) AS `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17) AND `ds` = '2008-04-08' AND `value` = 'One'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1239,6 +1266,9 @@ select * from srcbucket_pruned where value='One' and key in (1,2,3,4,5,6,7,8,9,1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, CAST('One' AS STRING) AS `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17) AND `value` = 'One' AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1373,6 +1403,9 @@ select * from srcbucket_pruned where key = 1 and ds='2008-04-08' and (value='One
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT CAST(1 AS INTEGER) AS `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `value` IN ('One', 'Two') AND `key` = 1 AND `ds` = '2008-04-08'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1509,7 +1542,7 @@ POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT `key`, `value`, `ds`
 FROM `default`.`srcbucket_pruned`
-WHERE NULL
+WHERE FALSE
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1642,6 +1675,9 @@ select * from srcbucket_pruned where key = 1 or value = "One" or key = 2
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_pruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, `ds`
+FROM `default`.`srcbucket_pruned`
+WHERE `key` IN (1, 2) OR `value` = 'One'
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -1707,6 +1743,9 @@ select * from srcbucket_unpruned where key in (3, 5)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@srcbucket_unpruned
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `key`, `value`, `ds`
+FROM `default`.`srcbucket_unpruned`
+WHERE `key` IN (3, 5)
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/llap/cbo_simple_select.q.out b/ql/src/test/results/clientpositive/llap/cbo_simple_select.q.out
index acf91bf..3aa929d 100644
--- a/ql/src/test/results/clientpositive/llap/cbo_simple_select.q.out
+++ b/ql/src/test/results/clientpositive/llap/cbo_simple_select.q.out
@@ -761,9 +761,9 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: cbo_t2
-          filterExpr: (c_int = c_int) (type: boolean)
+          filterExpr: c_int is not null (type: boolean)
           Filter Operator
-            predicate: (c_int = c_int) (type: boolean)
+            predicate: c_int is not null (type: boolean)
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
@@ -821,9 +821,9 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: cbo_t2
-          filterExpr: (c_int = c_int) (type: boolean)
+          filterExpr: c_int is not null (type: boolean)
           Filter Operator
-            predicate: (c_int = c_int) (type: boolean)
+            predicate: c_int is not null (type: boolean)
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
@@ -833,13 +833,11 @@ PREHOOK: query: -- c_int is not null
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (NULL)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t2
-PREHOOK: Input: default@cbo_t2@dt=2014
 #### A masked pattern was here ####
 POSTHOOK: query: -- c_int is not null
 EXPLAIN select * from cbo_t2 where (cbo_t2.c_int) IN (NULL)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t2
-POSTHOOK: Input: default@cbo_t2@dt=2014
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
@@ -851,11 +849,10 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: cbo_t2
-          filterExpr: (c_int = null) (type: boolean)
           Filter Operator
-            predicate: (c_int = null) (type: boolean)
+            predicate: false (type: boolean)
             Select Operator
-              expressions: key (type: string), value (type: string), null (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
+              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
               ListSink
 
@@ -881,9 +878,9 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: cbo_t2
-          filterExpr: ((c_int = c_int) or (c_int = (2 * c_int))) (type: boolean)
+          filterExpr: (c_int is not null or (c_int = (2 * c_int))) (type: boolean)
           Filter Operator
-            predicate: ((c_int = (2 * c_int)) or (c_int = c_int)) (type: boolean)
+            predicate: ((c_int = (2 * c_int)) or c_int is not null) (type: boolean)
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
@@ -911,9 +908,9 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: cbo_t2
-          filterExpr: ((c_int = c_int) or (c_int = 0)) (type: boolean)
+          filterExpr: (c_int is not null or (c_int = 0)) (type: boolean)
           Filter Operator
-            predicate: ((c_int = 0) or (c_int = c_int)) (type: boolean)
+            predicate: ((c_int = 0) or c_int is not null) (type: boolean)
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
diff --git a/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out b/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
index afcf53f..c32f30f 100644
--- a/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
+++ b/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
@@ -2296,7 +2296,7 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
       HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
           HiveTableScan(table=[[default, customer]], table:alias=[customer])
-        HiveProject(ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), CAST(2):DECIMAL(10, 0))])
+        HiveProject(ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), 2:DECIMAL(10, 0))])
           HiveFilter(condition=[IS NOT NULL($3)])
             HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
 
@@ -2371,7 +2371,7 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
       HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
           HiveTableScan(table=[[default, customer]], table:alias=[customer])
-        HiveProject(ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), CAST(2):DECIMAL(10, 0))])
+        HiveProject(ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), 2:DECIMAL(10, 0))])
           HiveFilter(condition=[IS NOT NULL($3)])
             HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
 
@@ -2533,20 +2533,20 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
             HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
               HiveTableScan(table=[[default, customer]], table:alias=[customer])
             HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), CAST(2):DECIMAL(10, 0))])
+              HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), 2:DECIMAL(10, 0))])
                 HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
               HiveProject(d_date_sk=[$0])
                 HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
       HiveProject($f0=[$0])
-        HiveFilter(condition=[>($1, 0)])
+        HiveFilter(condition=[>($1, 0:DECIMAL(1, 0))])
           HiveAggregate(group=[{1}], agg#0=[sum($10)])
             HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
                 HiveTableScan(table=[[default, customer]], table:alias=[customer])
               HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), CAST(2):DECIMAL(10, 0))])
+                HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), 2:DECIMAL(10, 0))])
                   HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
                 HiveProject(d_date_sk=[$0])
diff --git a/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out b/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
index 7acc8ee..f5ef440 100644
--- a/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
+++ b/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
@@ -78,7 +78,7 @@ Stage-3
             Select Operator [SEL_35] (rows=1 width=12)
               Output:["_col0","_col1"]
               Filter Operator [FIL_34] (rows=1 width=4)
-                predicate:colnum is not null
+                predicate:UDFToDouble(colnum) is not null
                 TableScan [TS_8] (rows=1 width=4)
                   mydb@q1,a,Tbl:COMPLETE,Col:COMPLETE,Output:["colnum"]
         <-Map 4 [SIMPLE_EDGE] vectorized, llap
@@ -87,7 +87,7 @@ Stage-3
             Select Operator [SEL_38] (rows=1 width=184)
               Output:["_col0"]
               Filter Operator [FIL_37] (rows=1 width=184)
-                predicate:key is not null
+                predicate:UDFToDouble(key) is not null
                 TableScan [TS_11] (rows=1 width=184)
                   default@q1,b,Tbl:COMPLETE,Col:NONE,Output:["key"]
         Stage-2
diff --git a/ql/src/test/results/clientpositive/llap/current_date_timestamp.q.out b/ql/src/test/results/clientpositive/llap/current_date_timestamp.q.out
index 5424467..12c0a6e 100644
--- a/ql/src/test/results/clientpositive/llap/current_date_timestamp.q.out
+++ b/ql/src/test/results/clientpositive/llap/current_date_timestamp.q.out
@@ -20,7 +20,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
 CBO PLAN:
-HiveProject($f0=[CAST(2012-01-01 01:02:03):TIMESTAMP(9)])
+HiveProject($f0=[CAST(2012-01-01 01:02:03:TIMESTAMP(9)):TIMESTAMP(9)])
   HiveTableScan(table=[[default, alltypesorc]], table:alias=[alltypesorc])
 
 PREHOOK: query: select count(*) from (select current_timestamp() from alltypesorc union select current_timestamp() from src limit 5 ) subq
diff --git a/ql/src/test/results/clientpositive/llap/default_constraint.q.out b/ql/src/test/results/clientpositive/llap/default_constraint.q.out
index 5d716eb..e7c060c 100644
--- a/ql/src/test/results/clientpositive/llap/default_constraint.q.out
+++ b/ql/src/test/results/clientpositive/llap/default_constraint.q.out
@@ -97,28 +97,28 @@ STAGE PLANS:
                   Row Limit Per Split: 1
                   Statistics: Num rows: 1 Data size: ###Masked### Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: array(const struct(3)) (type: array<struct<col1:int>>)
+                    expressions: array(const struct(3Y)) (type: array<struct<col1:tinyint>>)
                     outputColumnNames: _col0
                     Statistics: Num rows: 1 Data size: ###Masked### Basic stats: COMPLETE Column stats: COMPLETE
                     UDTF Operator
                       Statistics: Num rows: 1 Data size: ###Masked### Basic stats: COMPLETE Column stats: COMPLETE
                       function name: inline
                       Select Operator
-                        expressions: col1 (type: int), 32767S (type: smallint), 2147483647 (type: int), 9223372036854775807L (type: bigint), 3.4E38D (type: double), 1234567.89 (type: decimal(9,2))
+                        expressions: col1 (type: tinyint), 32767S (type: smallint), 2147483647 (type: int), 9223372036854775807L (type: bigint), 3.4E38D (type: double), 1234567.89 (type: decimal(9,2))
                         outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 1 Data size: ###Masked### Basic stats: COMPLETE Column stats: COMPLETE
                         Reduce Output Operator
                           sort order: 
-                          Map-reduce partition columns: UDFToByte(_col0) (type: tinyint)
+                          Map-reduce partition columns: _col0 (type: tinyint)
                           Statistics: Num rows: 1 Data size: ###Masked### Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: int), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: double), _col5 (type: decimal(9,2))
+                          value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: double), _col5 (type: decimal(9,2))
             Execution mode: llap
             LLAP IO: no inputs
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Select Operator
-                expressions: UDFToByte(VALUE._col0) (type: tinyint), VALUE._col1 (type: smallint), VALUE._col2 (type: int), VALUE._col3 (type: bigint), VALUE._col4 (type: double), VALUE._col5 (type: decimal(9,2))
+                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), VALUE._col2 (type: int), VALUE._col3 (type: bigint), VALUE._col4 (type: double), VALUE._col5 (type: decimal(9,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                 Statistics: Num rows: 1 Data size: ###Masked### Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out b/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
index 1679d57..87450c5 100644
--- a/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
@@ -569,27 +569,30 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: ds is not null (type: boolean)
+                  filterExpr: CAST( ds AS DATE) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: day(CAST( ds AS DATE)) (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
+                  Filter Operator
+                    predicate: CAST( ds AS DATE) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: day(CAST( ds AS DATE)) (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_date_n2
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  filterExpr: ((date = '2008-04-08') and CAST( ds AS DATE) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 376 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    predicate: ((date = '2008-04-08') and CAST( ds AS DATE) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: day(CAST( ds AS DATE)) (type: int)
@@ -714,27 +717,30 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: ds is not null (type: boolean)
+                  filterExpr: CAST( ds AS DATE) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: day(CAST( ds AS DATE)) (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
+                  Filter Operator
+                    predicate: CAST( ds AS DATE) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: day(CAST( ds AS DATE)) (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_date_n2
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  filterExpr: ((date = '2008-04-08') and CAST( ds AS DATE) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 376 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    predicate: ((date = '2008-04-08') and CAST( ds AS DATE) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: day(CAST( ds AS DATE)) (type: int)
@@ -1818,27 +1824,30 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n0
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
@@ -1963,17 +1972,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: (UDFToDouble(hr) * 2.0D) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -2108,27 +2120,30 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n0
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
@@ -2237,17 +2252,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: (UDFToDouble(hr) * 2.0D) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -2379,27 +2397,30 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) (type: string)
-                    outputColumnNames: _col0
+                  Filter Operator
+                    predicate: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) is not null (type: boolean)
                     Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    Select Operator
+                      expressions: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n0
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and CAST( hr AS STRING) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and CAST( hr AS STRING) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: CAST( hr AS STRING) (type: string)
@@ -4602,41 +4623,44 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: ds is not null (type: boolean)
+                  filterExpr: CAST( ds AS DATE) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: day(CAST( ds AS DATE)) (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: int)
-                        1 _col0 (type: int)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 64 Data size: 512 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: CAST( ds AS DATE) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: day(CAST( ds AS DATE)) (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: int)
+                          1 _col0 (type: int)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 64 Data size: 512 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: llap
             LLAP IO: no inputs
         Map 3 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_date_n2
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  filterExpr: ((date = '2008-04-08') and CAST( ds AS DATE) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 376 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    predicate: ((date = '2008-04-08') and CAST( ds AS DATE) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: day(CAST( ds AS DATE)) (type: int)
@@ -5248,41 +5272,44 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: double)
-                        1 _col0 (type: double)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: double)
+                          1 _col0 (type: double)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: llap
             LLAP IO: no inputs
         Map 3 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n0
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
@@ -5387,31 +5414,34 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: double)
-                        1 _col0 (type: double)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: (UDFToDouble(hr) * 2.0D) (type: double)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: double)
+                          1 _col0 (type: double)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: llap
             LLAP IO: no inputs
         Map 3 
@@ -6590,40 +6620,44 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart_orc
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 564000 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: ds (type: string), UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 2000 Data size: 384000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: string), _col1 (type: double)
-                        1 _col0 (type: string), _col1 (type: double)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 376000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: ds (type: string), UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 2000 Data size: 384000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: string), _col1 (type: double)
+                          1 _col0 (type: string), _col1 (type: double)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: llap
             LLAP IO: all inputs
         Map 3 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_date_hour_n0
-                  filterExpr: ((date) IN ('2008-04-08', '2008-04-09') and (UDFToDouble(hour) = 11.0D) and ds is not null and hr is not null) (type: boolean)
+                  filterExpr: ((date) IN ('2008-04-08', '2008-04-09') and (UDFToDouble(hour) = 11.0D) and ds is not null and UDFToDouble(hr) is not null) (type: boolean)
                   Statistics: Num rows: 4 Data size: 1440 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and (date) IN ('2008-04-08', '2008-04-09') and ds is not null and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and (date) IN ('2008-04-08', '2008-04-09') and UDFToDouble(hr) is not null and ds is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 720 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ds (type: string), UDFToDouble(hr) (type: double)
diff --git a/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out b/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
index 9813b8f..96d3ccc 100644
--- a/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
@@ -151,10 +151,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: t2
-                  filterExpr: (tinyint_col_15 is not null and decimal2709_col_9 is not null and tinyint_col_20 is not null and smallint_col_19 is not null) (type: boolean)
+                  filterExpr: (UDFToLong(tinyint_col_15) is not null and decimal2709_col_9 is not null and tinyint_col_20 is not null and UDFToInteger(smallint_col_19) is not null) (type: boolean)
                   Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (decimal2709_col_9 is not null and smallint_col_19 is not null and tinyint_col_15 is not null and tinyint_col_20 is not null) (type: boolean)
+                    predicate: (UDFToInteger(smallint_col_19) is not null and UDFToLong(tinyint_col_15) is not null and decimal2709_col_9 is not null and tinyint_col_20 is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: tinyint_col_15 (type: tinyint), decimal2709_col_9 (type: decimal(27,9)), tinyint_col_20 (type: tinyint), smallint_col_19 (type: smallint)
diff --git a/ql/src/test/results/clientpositive/llap/except_distinct.q.out b/ql/src/test/results/clientpositive/llap/except_distinct.q.out
index d54dda9..bc98b28 100644
--- a/ql/src/test/results/clientpositive/llap/except_distinct.q.out
+++ b/ql/src/test/results/clientpositive/llap/except_distinct.q.out
@@ -311,7 +311,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 250 Data size: 48500 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (((_col2 * 2) = _col3) and (_col2 > 0L)) (type: boolean)
+                  predicate: (((_col2 * 2L) = _col3) and (_col2 > 0L)) (type: boolean)
                   Statistics: Num rows: 41 Data size: 7954 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string)
@@ -557,7 +557,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 250 Data size: 48500 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (((_col2 * 2) = _col3) and (_col2 > 0L)) (type: boolean)
+                  predicate: (((_col2 * 2L) = _col3) and (_col2 > 0L)) (type: boolean)
                   Statistics: Num rows: 41 Data size: 7954 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string)
@@ -600,7 +600,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 145 Data size: 28130 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (((_col2 * 2) = _col3) and (_col2 > 0L)) (type: boolean)
+                  predicate: (((_col2 * 2L) = _col3) and (_col2 > 0L)) (type: boolean)
                   Statistics: Num rows: 24 Data size: 4656 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string)
@@ -643,7 +643,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 137 Data size: 26578 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (((_col2 * 2) = _col3) and (_col2 > 0L)) (type: boolean)
+                  predicate: (((_col2 * 2L) = _col3) and (_col2 > 0L)) (type: boolean)
                   Statistics: Num rows: 22 Data size: 4268 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string)
@@ -820,7 +820,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (((_col1 * 2) = _col2) and (_col1 > 0L)) (type: boolean)
+                  predicate: (((_col1 * 2L) = _col2) and (_col1 > 0L)) (type: boolean)
                   Statistics: Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
index 1ea8fdc..7c45ac2 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
@@ -562,7 +562,7 @@ Stage-0
                         FORWARD [RS_20]
                           PartitionCols:_col5
                           Merge Join Operator [MERGEJOIN_63] (rows=1 width=117)
-                            Conds:RS_17._col0=RS_18._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7"],residual filter predicates:{((_col6 > 0) or _col2)} {(_col3 or (_col7 >= 1L))} {((_col4 + _col7) >= 0)}
+                            Conds:RS_17._col0=RS_18._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7"],residual filter predicates:{((_col6 > 0) or _col2)} {(_col3 or (_col7 >= 1L))} {((_col4 + _col7) >= 0L)}
                           <-Map 1 [SIMPLE_EDGE] llap
                             SHUFFLE [RS_17]
                               PartitionCols:_col0
@@ -585,7 +585,7 @@ Stage-0
                                     Group By Operator [GBY_6] (rows=1 width=101)
                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                       Filter Operator [FIL_38] (rows=2 width=93)
-                                        predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                                        predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                                         TableScan [TS_3] (rows=20 width=88)
                                           default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
                       <-Reducer 9 [SIMPLE_EDGE] llap
@@ -601,7 +601,7 @@ Stage-0
                                 Group By Operator [GBY_13] (rows=1 width=93)
                                   Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
                                   Filter Operator [FIL_39] (rows=2 width=93)
-                                    predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                                    predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                                     TableScan [TS_10] (rows=20 width=88)
                                       default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
@@ -674,7 +674,7 @@ Stage-0
                               Group By Operator [GBY_6] (rows=1 width=101)
                                 Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                 Filter Operator [FIL_35] (rows=2 width=93)
-                                  predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                                  predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                                   TableScan [TS_3] (rows=20 width=88)
                                     default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
                 <-Reducer 8 [SIMPLE_EDGE] llap
@@ -690,7 +690,7 @@ Stage-0
                           Group By Operator [GBY_13] (rows=1 width=93)
                             Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
                             Filter Operator [FIL_36] (rows=2 width=93)
-                              predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                              predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                               TableScan [TS_10] (rows=20 width=88)
                                 default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
@@ -745,7 +745,7 @@ Stage-0
                       FORWARD [RS_20]
                         PartitionCols:_col5
                         Merge Join Operator [MERGEJOIN_62] (rows=1 width=117)
-                          Conds:RS_17._col0=RS_18._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7"],residual filter predicates:{((_col6 > 0) or _col2)} {(_col3 or (_col7 >= 1L))} {((_col4 + _col7) >= 0)}
+                          Conds:RS_17._col0=RS_18._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7"],residual filter predicates:{((_col6 > 0) or _col2)} {(_col3 or (_col7 >= 1L))} {((_col4 + _col7) >= 0L)}
                         <-Map 1 [SIMPLE_EDGE] llap
                           SHUFFLE [RS_17]
                             PartitionCols:_col0
@@ -768,7 +768,7 @@ Stage-0
                                   Group By Operator [GBY_6] (rows=1 width=101)
                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                     Filter Operator [FIL_37] (rows=2 width=93)
-                                      predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                                      predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                                       TableScan [TS_3] (rows=20 width=88)
                                         default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
                     <-Reducer 9 [SIMPLE_EDGE] llap
@@ -784,7 +784,7 @@ Stage-0
                               Group By Operator [GBY_13] (rows=1 width=93)
                                 Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
                                 Filter Operator [FIL_38] (rows=2 width=93)
-                                  predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                                  predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                                   TableScan [TS_10] (rows=20 width=88)
                                     default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
@@ -857,7 +857,7 @@ Stage-0
                               Group By Operator [GBY_6] (rows=1 width=101)
                                 Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                 Filter Operator [FIL_35] (rows=2 width=93)
-                                  predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                                  predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                                   TableScan [TS_3] (rows=20 width=88)
                                     default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
                 <-Reducer 8 [SIMPLE_EDGE] llap
@@ -873,7 +873,7 @@ Stage-0
                           Group By Operator [GBY_13] (rows=1 width=93)
                             Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
                             Filter Operator [FIL_36] (rows=2 width=93)
-                              predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
+                              predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (c_float > 0.0) and key is not null)
                               TableScan [TS_10] (rows=20 width=88)
                                 default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
@@ -1930,7 +1930,7 @@ Stage-0
                                       Group By Operator [GBY_3] (rows=1 width=101)
                                         Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                         Filter Operator [FIL_42] (rows=1 width=93)
-                                          predicate:((((c_int + 1) + 1) >= 0) and (((c_int + 1) > 0) or (UDFToDouble(key) >= 0.0D)) and ((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (UDFToDouble(key) > 0.0D) and (c_float > 0.0))
+                                          predicate:((((c_int + 1) + 1) >= 0) and (((c_int + 1) > 0) or UDFToDouble(key) is not null) and ((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (UDFToDouble(key) > 0.0D) and (c_float > 0.0))
                                           TableScan [TS_0] (rows=20 width=88)
                                             default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
                         <-Reducer 8 [SIMPLE_EDGE] llap
@@ -1948,7 +1948,7 @@ Stage-0
                                     Group By Operator [GBY_12] (rows=1 width=93)
                                       Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
                                       Filter Operator [FIL_43] (rows=1 width=93)
-                                        predicate:(((UDFToFloat(c_int) + c_float) >= 0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (UDFToDouble(key) > 0.0D) and (c_float > 0.0))
+                                        predicate:(((UDFToFloat(c_int) + c_float) >= 0.0) and ((c_int + 1) >= 0) and ((c_int > 0) or c_float is not null) and ((c_int >= 1) or (c_float >= 1.0)) and (UDFToDouble(key) > 0.0D) and (c_float > 0.0))
                                         TableScan [TS_9] (rows=20 width=88)
                                           default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
@@ -2624,7 +2624,7 @@ Stage-0
             Select Operator [SEL_24] (rows=631 width=178)
               Output:["_col0","_col1"]
               Filter Operator [FIL_23] (rows=631 width=194)
-                predicate:((_col2 = 0L) or (_col5 is null and _col0 is not null and (_col3 >= _col2)))
+                predicate:(((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col0 is null) and (_col0 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L)))
                 Select Operator [SEL_22] (rows=631 width=194)
                   Output:["_col0","_col1","_col2","_col3","_col5"]
                   Merge Join Operator [MERGEJOIN_37] (rows=631 width=194)
@@ -2702,10 +2702,10 @@ Stage-0
     Stage-1
       Reducer 3 llap
       File Output Operator [FS_24]
-        Select Operator [SEL_23] (rows=19 width=223)
+        Select Operator [SEL_23] (rows=38 width=223)
           Output:["_col0","_col1","_col2"]
-          Filter Operator [FIL_22] (rows=19 width=234)
-            predicate:CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END
+          Filter Operator [FIL_22] (rows=38 width=234)
+            predicate:(((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col0 is null) and (_col0 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null))
             Merge Join Operator [MERGEJOIN_45] (rows=38 width=234)
               Conds:RS_19._col0, _col1=RS_20._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5","_col8"]
             <-Reducer 2 [SIMPLE_EDGE] llap
@@ -2794,7 +2794,7 @@ Stage-0
             Select Operator [SEL_29] (rows=27 width=125)
               Output:["_col0","_col1"]
               Filter Operator [FIL_28] (rows=27 width=141)
-                predicate:((_col2 = 0L) or (_col5 is null and _col1 is not null and (_col3 >= _col2)))
+                predicate:(((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col1 is null) and (_col1 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L)))
                 Select Operator [SEL_27] (rows=27 width=141)
                   Output:["_col0","_col1","_col2","_col3","_col5"]
                   Merge Join Operator [MERGEJOIN_38] (rows=27 width=141)
@@ -2874,14 +2874,14 @@ Stage-0
     Stage-1
       Reducer 5 llap
       File Output Operator [FS_36]
-        Select Operator [SEL_35] (rows=3 width=106)
+        Select Operator [SEL_35] (rows=7 width=106)
           Output:["_col0","_col1"]
         <-Reducer 4 [SIMPLE_EDGE] llap
           SHUFFLE [RS_34]
-            Select Operator [SEL_33] (rows=3 width=106)
+            Select Operator [SEL_33] (rows=7 width=106)
               Output:["_col0","_col1"]
-              Filter Operator [FIL_32] (rows=3 width=118)
-                predicate:CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END
+              Filter Operator [FIL_32] (rows=7 width=114)
+                predicate:(((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col0 is null) and (_col0 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null))
                 Merge Join Operator [MERGEJOIN_48] (rows=7 width=114)
                   Conds:RS_29._col0, _col1=RS_30._col0, _col1(Left Outer),Output:["_col0","_col1","_col3","_col4","_col7"]
                 <-Reducer 3 [SIMPLE_EDGE] llap
@@ -6260,13 +6260,13 @@ Stage-0
                     Select Operator [SEL_2] (rows=1 width=368)
                       Output:["_col0","_col1","_col2"]
                       Filter Operator [FIL_18] (rows=1 width=368)
-                        predicate:key is not null
+                        predicate:UDFToDouble(key) is not null
                         TableScan [TS_0] (rows=1 width=368)
                           default@t1_n119,a,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
                 <-Select Operator [SEL_5] (rows=500 width=12)
                     Output:["_col0","_col1"]
                     Filter Operator [FIL_19] (rows=500 width=87)
-                      predicate:key is not null
+                      predicate:UDFToDouble(key) is not null
                       TableScan [TS_3] (rows=500 width=87)
                         default@src,c,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
 
diff --git a/ql/src/test/results/clientpositive/llap/groupby_rollup_empty.q.out b/ql/src/test/results/clientpositive/llap/groupby_rollup_empty.q.out
index e7c0ab9..45d2a4d 100644
--- a/ql/src/test/results/clientpositive/llap/groupby_rollup_empty.q.out
+++ b/ql/src/test/results/clientpositive/llap/groupby_rollup_empty.q.out
@@ -203,7 +203,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col3 (type: bigint), grouping(_col2, 0) (type: bigint), 'NULL,1' (type: string)
+                  expressions: _col3 (type: bigint), grouping(_col2, 0L) (type: bigint), 'NULL,1' (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/join_constraints_optimization.q.out b/ql/src/test/results/clientpositive/llap/join_constraints_optimization.q.out
index 1098bb4..087db3c 100644
--- a/ql/src/test/results/clientpositive/llap/join_constraints_optimization.q.out
+++ b/ql/src/test/results/clientpositive/llap/join_constraints_optimization.q.out
@@ -694,28 +694,27 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 4 (SIMPLE_EDGE)
-        Reducer 3 <- Map 5 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
                   alias: lineorder_removal_n0
-                  Statistics: Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: lo_linenumber (type: int), lo_custkey (type: bigint), lo_orderdate (type: bigint)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: NONE
+                    expressions: lo_linenumber (type: int), lo_orderdate (type: bigint)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col2 (type: bigint)
+                      key expressions: _col1 (type: bigint)
                       sort order: +
-                      Map-reduce partition columns: _col2 (type: bigint)
-                      Statistics: Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: bigint)
+                      Map-reduce partition columns: _col1 (type: bigint)
+                      Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col0 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Map 4 
+        Map 3 
             Map Operator Tree:
                 TableScan
                   alias: dates_removal_n0
@@ -731,22 +730,6 @@ STAGE PLANS:
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Map 5 
-            Map Operator Tree:
-                TableScan
-                  alias: customer_removal_n0
-                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    expressions: c_custkey (type: bigint)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: bigint)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: bigint)
-                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
         Reducer 2 
             Execution mode: llap
             Reduce Operator Tree:
@@ -754,30 +737,13 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 keys:
-                  0 _col2 (type: bigint)
-                  1 _col0 (type: bigint)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 1 Data size: 22 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col1 (type: bigint)
-                  sort order: +
-                  Map-reduce partition columns: _col1 (type: bigint)
-                  Statistics: Num rows: 1 Data size: 22 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int)
-        Reducer 3 
-            Execution mode: llap
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Left Outer Join 0 to 1
-                keys:
                   0 _col1 (type: bigint)
                   1 _col0 (type: bigint)
                 outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 24 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 13 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 1 Data size: 24 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 13 Basic stats: COMPLETE Column stats: NONE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/llap/kryo.q.out b/ql/src/test/results/clientpositive/llap/kryo.q.out
index 7e10d64..5641e8f 100644
--- a/ql/src/test/results/clientpositive/llap/kryo.q.out
+++ b/ql/src/test/results/clientpositive/llap/kryo.q.out
@@ -54,7 +54,7 @@ STAGE PLANS:
                     predicate: (id) IN (1, 2, 3, 4, 5, 6) (type: boolean)
                     Statistics: Num rows: 1 Data size: 372 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: if((id) IN (1, 2), if((id = 1), date_, date_), if((id = 3), CASE WHEN ((date_ is null or to_date(CAST( datetime AS TIMESTAMP)) is null)) THEN (null) WHEN ((CAST( date_ AS DATE) > to_date(CAST( datetime AS TIMESTAMP)))) THEN (date_) ELSE (CAST( to_date(CAST( datetime AS TIMESTAMP)) AS STRING)) END, null)) (type: string), id (type: int), CASE WHEN ((id = 6)) THEN (CASE WHEN ((concat(date_, ' 00:00:00') is null or datetime is null)) THEN (null) WHEN ((conc [...]
+                      expressions: if((id) IN (1, 2), if((id = 1), date_, date_), if((id = 3), CASE WHEN ((date_ is null or to_date(CAST( datetime AS TIMESTAMP)) is null)) THEN (null) WHEN ((CAST( date_ AS DATE) > to_date(CAST( datetime AS TIMESTAMP)))) THEN (date_) ELSE (CAST( to_date(CAST( datetime AS TIMESTAMP)) AS STRING)) END, null)) (type: string), id (type: int), CASE WHEN ((id = 6)) THEN (CASE WHEN ((concat(date_, ' 00:00:00') is null or datetime is null)) THEN (null) WHEN ((conc [...]
                       outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 1 Data size: 372 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
diff --git a/ql/src/test/results/clientpositive/llap/lineage3.q.out b/ql/src/test/results/clientpositive/llap/lineage3.q.out
index 11e6904..b9ef761 100644
--- a/ql/src/test/results/clientpositive/llap/lineage3.q.out
+++ b/ql/src/test/results/clientpositive/llap/lineage3.q.out
@@ -10,7 +10,7 @@ insert into table d1 select x + length(y)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: default@d1
-{"version":"1.0","engine":"tez","database":"default","hash":"a1d51634883428cbc72084be0ec2e641","queryText":"from (select a.ctinyint x, b.cstring1 y\nfrom alltypesorc a join alltypesorc b on a.cint = b.cbigint) t_n20\ninsert into table d1 select x + length(y)","edges":[{"sources":[1,2],"targets":[0],"expression":"(UDFToInteger(a.ctinyint) + length(b.cstring1))","edgeType":"PROJECTION"},{"sources":[3],"targets":[0],"expression":"a.cint is not null","edgeType":"PREDICATE"},{"sources":[3,4], [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"a1d51634883428cbc72084be0ec2e641","queryText":"from (select a.ctinyint x, b.cstring1 y\nfrom alltypesorc a join alltypesorc b on a.cint = b.cbigint) t_n20\ninsert into table d1 select x + length(y)","edges":[{"sources":[1,2],"targets":[0],"expression":"(UDFToInteger(a.ctinyint) + length(b.cstring1))","edgeType":"PROJECTION"},{"sources":[3],"targets":[0],"expression":"UDFToLong(a.cint) is not null","edgeType":"PREDICATE"},{"sour [...]
 PREHOOK: query: drop table if exists d2
 PREHOOK: type: DROPTABLE
 PREHOOK: query: create table d2(b varchar(128))
@@ -25,7 +25,7 @@ PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: default@d1
 PREHOOK: Output: default@d2
-{"version":"1.0","engine":"tez","database":"default","hash":"84e3cdc38011da5842162df175b2a494","queryText":"from (select a.ctinyint x, b.cstring1 y\nfrom alltypesorc a join alltypesorc b on a.cint = b.cbigint) t_n20\ninsert into table d1 select x where y is null\ninsert into table d2 select y where x > 0","edges":[{"sources":[2],"targets":[0],"expression":"UDFToInteger(x)","edgeType":"PROJECTION"},{"sources":[3],"targets":[0,1],"expression":"a.cint is not null","edgeType":"PREDICATE"},{" [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"84e3cdc38011da5842162df175b2a494","queryText":"from (select a.ctinyint x, b.cstring1 y\nfrom alltypesorc a join alltypesorc b on a.cint = b.cbigint) t_n20\ninsert into table d1 select x where y is null\ninsert into table d2 select y where x > 0","edges":[{"sources":[2],"targets":[0],"expression":"UDFToInteger(x)","edgeType":"PROJECTION"},{"sources":[3],"targets":[0,1],"expression":"UDFToLong(a.cint) is not null","edgeType":"PRE [...]
 PREHOOK: query: drop table if exists t_n20
 PREHOOK: type: DROPTABLE
 PREHOOK: query: create table t_n20 as
@@ -86,7 +86,7 @@ order by a.ctinyint, a.cint
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"5e30ab16eecf1f308b78f727a59292c7","queryText":"select a.ctinyint, a.cint, count(a.cdouble)\n  over(partition by a.ctinyint order by a.cint desc\n    rows between 1 preceding and 1 following)\nfrom alltypesorc a inner join alltypesorc b on a.cint = b.cbigint\norder by a.ctinyint, a.cint","edges":[{"sources":[3],"targets":[0],"edgeType":"PROJECTION"},{"sources":[4],"targets":[1],"edgeType":"PROJECTION"},{"sources":[3,4,5,6],"targ [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"5e30ab16eecf1f308b78f727a59292c7","queryText":"select a.ctinyint, a.cint, count(a.cdouble)\n  over(partition by a.ctinyint order by a.cint desc\n    rows between 1 preceding and 1 following)\nfrom alltypesorc a inner join alltypesorc b on a.cint = b.cbigint\norder by a.ctinyint, a.cint","edges":[{"sources":[3],"targets":[0],"edgeType":"PROJECTION"},{"sources":[4],"targets":[1],"edgeType":"PROJECTION"},{"sources":[3,4,5,6],"targ [...]
 PREHOOK: query: with v2 as
   (select cdouble, count(cint) over() a,
     sum(cint + cbigint) over(partition by cboolean1) b
@@ -135,7 +135,7 @@ and x.ctinyint + length(c.cstring2) < 1000
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"15e00f9e88c1ad6b2f53a33a0c147f0e","queryText":"select x.ctinyint, x.cint, c.cbigint-100, c.cstring1\nfrom alltypesorc c\njoin (\n   select a.ctinyint ctinyint, b.cint cint\n   from (select * from alltypesorc a where cboolean1=false) a\n   join alltypesorc b on (a.cint = b.cbigint - 224870380)\n ) x on (x.cint = c.cint)\nwhere x.ctinyint > 10\nand x.cint < 4.5\nand x.ctinyint + length(c.cstring2) < 1000","edges":[{"sources":[4], [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"15e00f9e88c1ad6b2f53a33a0c147f0e","queryText":"select x.ctinyint, x.cint, c.cbigint-100, c.cstring1\nfrom alltypesorc c\njoin (\n   select a.ctinyint ctinyint, b.cint cint\n   from (select * from alltypesorc a where cboolean1=false) a\n   join alltypesorc b on (a.cint = b.cbigint - 224870380)\n ) x on (x.cint = c.cint)\nwhere x.ctinyint > 10\nand x.cint < 4.5\nand x.ctinyint + length(c.cstring2) < 1000","edges":[{"sources":[4], [...]
 11	-654374827	857266369	OEfPnHnIYueoup
 PREHOOK: query: select c1, x2, x3
 from (
@@ -166,7 +166,7 @@ where key in (select key+18 from src1) order by key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src1
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"06c63ecdebcc1ca975a34b0fe1b4bf38","queryText":"select key, value from src1\nwhere key in (select key+18 from src1) order by key","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"src1.key is not null","edgeType":"PREDICATE"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(src1.key) = (UDFToDouble(src1.key) + [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"06c63ecdebcc1ca975a34b0fe1b4bf38","queryText":"select key, value from src1\nwhere key in (select key+18 from src1) order by key","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"UDFToDouble(src1.key) is not null","edgeType":"PREDICATE"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(src1.key) = (UDFToDoubl [...]
 146	val_146
 273	val_273
 PREHOOK: query: select * from src1 a
@@ -178,7 +178,7 @@ PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Input: default@src1
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"94e9cc0a67801fe1503a3cb0c5029d59","queryText":"select * from src1 a\nwhere exists\n  (select cint from alltypesorc b\n   where a.key = b.ctinyint + 300)\nand key > 300","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(a.key) > 300.0D)","edgeType":"PREDICATE"},{"sources":[2],"targets":[0,1],"expression":" [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"94e9cc0a67801fe1503a3cb0c5029d59","queryText":"select * from src1 a\nwhere exists\n  (select cint from alltypesorc b\n   where a.key = b.ctinyint + 300)\nand key > 300","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(a.key) > 300.0D)","edgeType":"PREDICATE"},{"sources":[2],"targets":[0,1],"expression":" [...]
 311	val_311
 Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: select key, value from src1
@@ -186,7 +186,7 @@ where key not in (select key+18 from src1) order by key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src1
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"cbc4367150807328dda0f1cf4c74b811","queryText":"select key, value from src1\nwhere key not in (select key+18 from src1) order by key","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(src1.key) = (UDFToDouble(src1.key) + 18.0D))","edgeType":"PREDICATE"},{"sources":[4,2],"targets":[0,1],"expression":"((coun [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"cbc4367150807328dda0f1cf4c74b811","queryText":"select key, value from src1\nwhere key not in (select key+18 from src1) order by key","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(src1.key) = (UDFToDouble(src1.key) + 18.0D))","edgeType":"PREDICATE"},{"sources":[4,2],"targets":[0,1],"expression":"((true [...]
 PREHOOK: query: select * from src1 a
 where not exists
   (select cint from alltypesorc b
@@ -196,7 +196,7 @@ PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Input: default@src1
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"723e79692e1de404c4ffb702097586da","queryText":"select * from src1 a\nwhere not exists\n  (select cint from alltypesorc b\n   where a.key = b.ctinyint + 300)\nand key > 300","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(a.key) > 300.0D)","edgeType":"PREDICATE"},{"sources":[2],"targets":[0,1],"expressio [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"723e79692e1de404c4ffb702097586da","queryText":"select * from src1 a\nwhere not exists\n  (select cint from alltypesorc b\n   where a.key = b.ctinyint + 300)\nand key > 300","edges":[{"sources":[2],"targets":[0],"edgeType":"PROJECTION"},{"sources":[3],"targets":[1],"edgeType":"PROJECTION"},{"sources":[2],"targets":[0,1],"expression":"(UDFToDouble(a.key) > 300.0D)","edgeType":"PREDICATE"},{"sources":[2],"targets":[0,1],"expressio [...]
 369	
 401	val_401
 406	val_406
@@ -297,7 +297,7 @@ PREHOOK: type: CREATEVIEW
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: database:default
 PREHOOK: Output: default@dest_v3
-{"version":"1.0","engine":"tez","database":"default","hash":"9848a9a38a4f6f031dc669e7e495f9ee","queryText":"create view dest_v3 (a1, a2, a3, a4, a5, a6, a7) as\n  select x.csmallint, x.cbigint bint1, x.ctinyint, c.cbigint bint2, x.cint, x.cfloat, c.cstring1\n  from alltypesorc c\n  join (\n     select a.csmallint csmallint, a.ctinyint ctinyint, a.cstring2 cstring2,\n           a.cint cint, a.cstring1 ctring1, b.cfloat cfloat, b.cbigint cbigint\n     from ( select * from alltypesorc a whe [...]
+{"version":"1.0","engine":"tez","database":"default","hash":"9848a9a38a4f6f031dc669e7e495f9ee","queryText":"create view dest_v3 (a1, a2, a3, a4, a5, a6, a7) as\n  select x.csmallint, x.cbigint bint1, x.ctinyint, c.cbigint bint2, x.cint, x.cfloat, c.cstring1\n  from alltypesorc c\n  join (\n     select a.csmallint csmallint, a.ctinyint ctinyint, a.cstring2 cstring2,\n           a.cint cint, a.cstring1 ctring1, b.cfloat cfloat, b.cbigint cbigint\n     from ( select * from alltypesorc a whe [...]
 PREHOOK: query: alter view dest_v3 as
   select * from (
     select sum(a.ctinyint) over (partition by a.csmallint order by a.csmallint) a,
diff --git a/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out b/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
index 9350fcb..a147854 100644
--- a/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
+++ b/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
@@ -449,8 +449,8 @@ POSTHOOK: Lineage: part_null_n1.p_partkey SCRIPT []
 POSTHOOK: Lineage: part_null_n1.p_retailprice SCRIPT []
 POSTHOOK: Lineage: part_null_n1.p_size SCRIPT []
 POSTHOOK: Lineage: part_null_n1.p_type SCRIPT []
-Warning: Shuffle Join MERGEJOIN[26][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
-Warning: Shuffle Join MERGEJOIN[27][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 4' is a cross product
+Warning: Shuffle Join MERGEJOIN[25][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[26][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: explain select /*+ mapjoin(None)*/ * from part where p_name = (select p_name from part_null_n1 where p_name is null)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@part
@@ -470,73 +470,55 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
-        Reducer 3 <- Map 1 (XPROD_EDGE), Reducer 2 (XPROD_EDGE)
-        Reducer 4 <- Map 5 (XPROD_EDGE), Reducer 3 (XPROD_EDGE)
+        Reducer 2 <- Map 1 (XPROD_EDGE), Reducer 5 (XPROD_EDGE)
+        Reducer 3 <- Map 4 (XPROD_EDGE), Reducer 2 (XPROD_EDGE)
+        Reducer 5 <- Map 4 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: part_null_n1
-                  filterExpr: p_name is null (type: boolean)
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                  alias: part
+                  Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: p_name is null (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                    predicate: false (type: boolean)
+                    Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.99
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          sort order: 
-                          Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col0 (type: bigint)
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                      Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Map 5 
+        Map 4 
             Map Operator Tree:
                 TableScan
-                  alias: part
-                  filterExpr: (p_name = null) (type: boolean)
-                  Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
-                  Filter Operator
-                    predicate: (p_name = null) (type: boolean)
-                    Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
-                    Select Operator
-                      expressions: p_partkey (type: int), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                      Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
+                  alias: part_null_n1
+                  Statistics: Num rows: 1 Data size: 32560 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    Filter Operator
+                      predicate: false (type: boolean)
+                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: count(0)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: bigint)
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
+                        Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                aggregations: count(VALUE._col0)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (sq_count_check(_col0) <= 1) (type: boolean)
-                  Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      sort order: 
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Merge Join Operator
@@ -545,11 +527,13 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                Statistics: Num rows: 1 Data size: 377 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 1 Data size: 377 Basic stats: COMPLETE Column stats: NONE
-        Reducer 4 
+                  Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Merge Join Operator
@@ -558,19 +542,28 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
-                Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 5 
+            Execution mode: vectorized, llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: count(VALUE._col0)
+                mode: mergepartial
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col2 (type: int), null (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: double), _col9 (type: string)
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -578,8 +571,8 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[26][bigTable=?] in task 'Reducer 2' is a cross product
-Warning: Map Join MAPJOIN[27][bigTable=?] in task 'Map 4' is a cross product
+Warning: Map Join MAPJOIN[26][bigTable=?] in task 'Map 1' is a cross product
+Warning: Map Join MAPJOIN[25][bigTable=?] in task 'Map 1' is a cross product
 PREHOOK: query: explain select * from part where p_name = (select p_name from part_null_n1 where p_name is null)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@part
@@ -599,110 +592,89 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Map 4 <- Reducer 2 (BROADCAST_EDGE)
-        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 3 (BROADCAST_EDGE)
+        Map 1 <- Map 2 (BROADCAST_EDGE), Reducer 3 (BROADCAST_EDGE)
+        Reducer 3 <- Map 2 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: part_null_n1
-                  filterExpr: p_name is null (type: boolean)
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: p_name is null (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.99
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          sort order: 
-                          Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col0 (type: bigint)
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 3 
-            Map Operator Tree:
-                TableScan
-                  alias: part_null_n1
-                  filterExpr: p_name is null (type: boolean)
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: p_name is null (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 4 
-            Map Operator Tree:
-                TableScan
                   alias: part
-                  filterExpr: (p_name = null) (type: boolean)
                   Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (p_name = null) (type: boolean)
+                    predicate: false (type: boolean)
                     Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                      Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                      Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 
                           1 
-                        outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                         input vertices:
-                          0 Reducer 2
-                        Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
-                        Select Operator
-                          expressions: _col2 (type: int), null (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: double), _col9 (type: string)
+                          1 Reducer 3
+                        Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map Join Operator
+                          condition map:
+                               Inner Join 0 to 1
+                          keys:
+                            0 
+                            1 
                           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                          Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
+                          input vertices:
+                            1 Map 2
+                          Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                           File Output Operator
                             compressed: false
-                            Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
+                            Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                             table:
                                 input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                                 output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                                 serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Reducer 2 
+        Map 2 
+            Map Operator Tree:
+                TableScan
+                  alias: part_null_n1
+                  Statistics: Num rows: 1 Data size: 32560 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    Filter Operator
+                      predicate: false (type: boolean)
+                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: count(0)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: bigint)
+                      Reduce Output Operator
+                        sort order: 
+                        Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: vectorized, llap
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator
                 aggregations: count(VALUE._col0)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (sq_count_check(_col0) <= 1) (type: boolean)
-                  Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 
-                        1 
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 1 Data size: 377 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 1 Data size: 377 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
index e0efe3c..93e852b 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
@@ -524,10 +524,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 1) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 1L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
index 6c3ba6c..585b2e7 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
@@ -755,10 +755,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2_n2
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 1) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 1L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2)), d (type: int)
@@ -1726,10 +1726,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2_n2
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 4) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 4L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 4) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 4L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2)), d (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
index d3e494d..4091dd3 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
@@ -250,10 +250,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2_n3
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 1) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 1L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
@@ -976,10 +976,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2_n3
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 4) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 4L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 4) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 4L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
index b55287d..2d2f5bb 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
@@ -524,10 +524,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2_n0
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 1) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 1L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
index cf6a6ba..f910057 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
@@ -644,10 +644,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: cmv_basetable_2_n1
-                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1) and a is not null) (type: boolean)
+                  filterExpr: ((c > 10) and (ROW__ID.writeid > 1L) and a is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((ROW__ID.writeid > 1) and (c > 10) and a is not null) (type: boolean)
+                    predicate: ((ROW__ID.writeid > 1L) and (c > 10) and a is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out
index d8aab03..b405c08 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out
@@ -1103,7 +1103,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: 'Sales' (type: varchar(256)), COALESCE(_col1,0) (type: bigint)
+                  expressions: 'Sales' (type: varchar(256)), COALESCE(_col1,0L) (type: bigint)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -1229,7 +1229,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), 'Sales' (type: varchar(256)), COALESCE(_col1,0) (type: bigint)
+                  expressions: _col0 (type: int), 'Sales' (type: varchar(256)), COALESCE(_col1,0L) (type: bigint)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_10.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_10.q.out
index de13bea..b97b876 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_10.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_10.q.out
@@ -335,7 +335,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: (UDFToDouble(_col0) / COALESCE(_col1,0)) (type: double)
+                  expressions: (UDFToDouble(_col0) / COALESCE(_col1,0L)) (type: double)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_4.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_4.q.out
index 8566402..3bf2cb3 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_4.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_4.q.out
@@ -206,7 +206,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 2 Data size: 212 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: varchar(256)), COALESCE(_col1,0) (type: bigint), _col2 (type: bigint)
+                  expressions: _col0 (type: varchar(256)), COALESCE(_col1,0L) (type: bigint), _col2 (type: bigint)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 2 Data size: 212 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -396,7 +396,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), COALESCE(_col1,0) (type: bigint), _col2 (type: bigint)
+                  expressions: _col0 (type: int), COALESCE(_col1,0L) (type: bigint), _col2 (type: bigint)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_7.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_7.q.out
index 4d7b983..ee96d28 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_7.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_7.q.out
@@ -658,7 +658,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), COALESCE(_col1,0) (type: bigint)
+                  expressions: _col0 (type: int), COALESCE(_col1,0L) (type: bigint)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                   Group By Operator
@@ -747,7 +747,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), (COALESCE(_col1,0) + 1L) (type: bigint)
+                  expressions: _col0 (type: int), (COALESCE(_col1,0L) + 1L) (type: bigint)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_no_join_opt.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_no_join_opt.q.out
index 9197bb6..36a2b4d 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_no_join_opt.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_no_join_opt.q.out
@@ -353,7 +353,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), COALESCE(_col1,0) (type: bigint), _col2 (type: bigint)
+                  expressions: _col0 (type: int), COALESCE(_col1,0L) (type: bigint), _col2 (type: bigint)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/mergejoin.q.out b/ql/src/test/results/clientpositive/llap/mergejoin.q.out
index f1153e7..61d50b0 100644
--- a/ql/src/test/results/clientpositive/llap/mergejoin.q.out
+++ b/ql/src/test/results/clientpositive/llap/mergejoin.q.out
@@ -4053,8 +4053,7 @@ POSTHOOK: Input: default@tab_part_n10@ds=2008-04-08
 #### A masked pattern was here ####
 NULL	NULL	NULL	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08
-Warning: Shuffle Join MERGEJOIN[20][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
-Warning: Shuffle Join MERGEJOIN[21][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[23][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: select * from
 (select * from tab_n9 where tab_n9.key = 0)a
 full outer join
@@ -4623,8 +4622,7 @@ NULL	NULL	NULL	NULL	NULL	NULL	97	val_97	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	97	val_97	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	98	val_98	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	98	val_98	2008-04-08
-Warning: Shuffle Join MERGEJOIN[19][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 4' is a cross product
-Warning: Shuffle Join MERGEJOIN[20][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: select * from
 (select * from tab_n9 where tab_n9.key = 0)a
 join
diff --git a/ql/src/test/results/clientpositive/llap/optimize_join_ptp.q.out b/ql/src/test/results/clientpositive/llap/optimize_join_ptp.q.out
index abd7dbd..7778102 100644
--- a/ql/src/test/results/clientpositive/llap/optimize_join_ptp.q.out
+++ b/ql/src/test/results/clientpositive/llap/optimize_join_ptp.q.out
@@ -62,10 +62,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: t1_n97
-                  filterExpr: (k < 15) (type: boolean)
+                  filterExpr: ((k < 15) and UDFToDouble(k) is not null) (type: boolean)
                   Statistics: Num rows: 3 Data size: 285 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (k < 15) (type: boolean)
+                    predicate: ((k < 15) and UDFToDouble(k) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 95 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: v (type: string), k (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/orc_ppd_varchar.q.out b/ql/src/test/results/clientpositive/llap/orc_ppd_varchar.q.out
index 12d6f67..7ab1ab8 100644
--- a/ql/src/test/results/clientpositive/llap/orc_ppd_varchar.q.out
+++ b/ql/src/test/results/clientpositive/llap/orc_ppd_varchar.q.out
@@ -26,7 +26,7 @@ POSTHOOK: query: select sum(hash(*)) from newtypesorc_n1 where v="bee"
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypesorc_n1
 #### A masked pattern was here ####
--252951929000
+-267266504500
 PREHOOK: query: select sum(hash(*)) from newtypesorc_n1 where v="bee"
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypesorc_n1
@@ -35,7 +35,7 @@ POSTHOOK: query: select sum(hash(*)) from newtypesorc_n1 where v="bee"
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypesorc_n1
 #### A masked pattern was here ####
--252951929000
+-267266504500
 PREHOOK: query: select sum(hash(*)) from newtypesorc_n1 where v!="bee"
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypesorc_n1
diff --git a/ql/src/test/results/clientpositive/llap/sharedwork.q.out b/ql/src/test/results/clientpositive/llap/sharedwork.q.out
index 9bd73f9..09c10b8 100644
--- a/ql/src/test/results/clientpositive/llap/sharedwork.q.out
+++ b/ql/src/test/results/clientpositive/llap/sharedwork.q.out
@@ -119,12 +119,12 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: table__323
-                  filterExpr: ((col_20) IN ('part1', 'part2', 'part3') and CAST( col_3 AS DATE) BETWEEN DATE'2018-07-01' AND DATE'2019-01-23') (type: boolean)
+                  filterExpr: ((col_20) IN ('part1', 'part2', 'part3') and (UDFToDouble(col_7) is not null or col_7 is null) and CAST( col_3 AS DATE) BETWEEN DATE'2018-07-01' AND DATE'2019-01-23') (type: boolean)
                   Statistics: Num rows: 1 Data size: 592 Basic stats: COMPLETE Column stats: NONE
                   GatherStats: false
                   Filter Operator
                     isSamplingPred: false
-                    predicate: ((col_20) IN ('part1', 'part2', 'part3') and CAST( col_3 AS DATE) BETWEEN DATE'2018-07-01' AND DATE'2019-01-23') (type: boolean)
+                    predicate: ((UDFToDouble(col_7) is not null or col_7 is null) and (col_20) IN ('part1', 'part2', 'part3') and CAST( col_3 AS DATE) BETWEEN DATE'2018-07-01' AND DATE'2019-01-23') (type: boolean)
                     Statistics: Num rows: 1 Data size: 592 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: col_1 (type: string), col_7 (type: string), col_20 (type: string), CAST( col_3 AS DATE) (type: date)
diff --git a/ql/src/test/results/clientpositive/llap/subquery_in.q.out b/ql/src/test/results/clientpositive/llap/subquery_in.q.out
index afcbddc..84611ce 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_in.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_in.q.out
@@ -295,10 +295,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: part
-                  filterExpr: p_size is not null (type: boolean)
+                  filterExpr: UDFToDouble(p_size) is not null (type: boolean)
                   Statistics: Num rows: 26 Data size: 3250 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: p_size is not null (type: boolean)
+                    predicate: UDFToDouble(p_size) is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 3250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: p_name (type: string), p_size (type: int)
@@ -397,7 +397,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (_col0 is not null and _col1 is not null) (type: boolean)
+                  predicate: (UDFToDouble(_col0) is not null and _col1 is not null) (type: boolean)
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: (UDFToDouble(_col0) / _col1) (type: double)
@@ -2153,9 +2153,7 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
-        Reducer 4 <- Map 3 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
-        Reducer 6 <- Map 5 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2183,43 +2181,26 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: p
-                  filterExpr: (p_size is not null and p_partkey is not null and p_name is not null) (type: boolean)
+                  filterExpr: (((p_size + 121150) = p_partkey) and p_size is not null and p_name is not null) (type: boolean)
                   Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (p_name is not null and p_partkey is not null and p_size is not null) (type: boolean)
-                    Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: (((p_size + 121150) = p_partkey) and p_name is not null and p_size is not null) (type: boolean)
+                    Statistics: Num rows: 13 Data size: 1677 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_size (type: int)
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col2 (type: int), _col0 (type: int)
-                        sort order: ++
-                        Map-reduce partition columns: _col2 (type: int), _col0 (type: int)
-                        Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 5 
-            Map Operator Tree:
-                TableScan
-                  alias: part
-                  filterExpr: p_size is not null (type: boolean)
-                  Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                  Filter Operator
-                    predicate: p_size is not null (type: boolean)
-                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      keys: p_size (type: int)
-                      minReductionHashAggr: 0.0
-                      mode: hash
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_name (type: string), p_size (type: int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: string), _col1 (type: int)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0, _col1
+                        Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string), _col1 (type: int)
+                          sort order: ++
+                          Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
+                          Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -2240,49 +2221,6 @@ STAGE PLANS:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                       serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-        Reducer 4 
-            Execution mode: llap
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col2 (type: int), _col0 (type: int)
-                  1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col3
-                Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col1 (type: string), _col3 (type: int)
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
-                  Group By Operator
-                    keys: _col0 (type: string), _col1 (type: int)
-                    minReductionHashAggr: 0.0
-                    mode: hash
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: int)
-                      sort order: ++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-                      Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 6 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col0 (type: int), (_col0 + 121150) (type: int)
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -3997,12 +3935,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: p_name (type: string), p_type (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 26 Data size: 5850 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 26 Data size: 5850 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -4054,10 +3992,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col3
+                outputColumnNames: _col0, _col4
                 Statistics: Num rows: 28 Data size: 3500 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col3 (type: int)
+                  expressions: _col0 (type: string), _col4 (type: int)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 28 Data size: 3500 Basic stats: COMPLETE Column stats: COMPLETE
                   Group By Operator
@@ -4451,10 +4389,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: part
-                  filterExpr: (p_type is not null and p_size is not null) (type: boolean)
+                  filterExpr: (p_type is not null and UDFToLong(p_size) is not null) (type: boolean)
                   Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (p_size is not null and p_type is not null) (type: boolean)
+                    predicate: (UDFToLong(p_size) is not null and p_type is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
@@ -4515,7 +4453,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10
                 Statistics: Num rows: 40 Data size: 24880 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (sq_count_check(CASE WHEN (_col10 is null) THEN (0) ELSE (_col10) END, true) > 0) (type: boolean)
+                  predicate: (sq_count_check(CASE WHEN (_col10 is null) THEN (0L) ELSE (_col10) END, true) > 0) (type: boolean)
                   Statistics: Num rows: 13 Data size: 8095 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -4631,10 +4569,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: part
-                  filterExpr: (p_partkey is not null and p_size is not null) (type: boolean)
+                  filterExpr: (p_partkey is not null and UDFToDouble(p_size) is not null) (type: boolean)
                   Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (p_partkey is not null and p_size is not null) (type: boolean)
+                    predicate: (UDFToDouble(p_size) is not null and p_partkey is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
@@ -4700,7 +4638,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 13 Data size: 260 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (_col1 is not null and _col2 is not null) (type: boolean)
+                  predicate: (UDFToDouble(_col1) is not null and _col2 is not null) (type: boolean)
                   Statistics: Num rows: 13 Data size: 260 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), (UDFToDouble(_col1) / _col2) (type: double)
@@ -5043,7 +4981,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10
                 Statistics: Num rows: 40 Data size: 24880 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (sq_count_check(CASE WHEN (_col10 is null) THEN (0) ELSE (_col10) END, true) > 0) (type: boolean)
+                  predicate: (sq_count_check(CASE WHEN (_col10 is null) THEN (0L) ELSE (_col10) END, true) > 0) (type: boolean)
                   Statistics: Num rows: 13 Data size: 8095 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -5084,15 +5022,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 13 Data size: 8307 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col5 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 6 Data size: 3834 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col5 is null) and (_col14 is null or (_col10 = 0L) or _col10 is null) and (_col5 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null)) (type: boolean)
+                  Statistics: Num rows: 1 Data size: 639 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 6 Data size: 3714 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 6 Data size: 3714 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -5297,7 +5235,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10
                 Statistics: Num rows: 39 Data size: 24253 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (sq_count_check(CASE WHEN (_col10 is null) THEN (0) ELSE (_col10) END, true) > 0) (type: boolean)
+                  predicate: (sq_count_check(CASE WHEN (_col10 is null) THEN (0L) ELSE (_col10) END, true) > 0) (type: boolean)
                   Statistics: Num rows: 13 Data size: 8087 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -5338,15 +5276,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 13 Data size: 8307 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col5 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 6 Data size: 3834 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col5 is null) and (_col14 is null or (_col10 = 0L) or _col10 is null) and (_col5 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null)) (type: boolean)
+                  Statistics: Num rows: 1 Data size: 639 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 6 Data size: 3714 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 6 Data size: 3714 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -5397,7 +5335,7 @@ STAGE PLANS:
                       Statistics: Num rows: 13 Data size: 260 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: bigint), _col2 (type: bigint)
                 Filter Operator
-                  predicate: (_col1 is not null and _col2 is not null) (type: boolean)
+                  predicate: (UDFToDouble(_col1) is not null and _col2 is not null) (type: boolean)
                   Statistics: Num rows: 13 Data size: 260 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: (UDFToDouble(_col1) / _col2) (type: double), _col0 (type: int), true (type: boolean)
@@ -5485,10 +5423,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: t_n22
-                  filterExpr: i is not null (type: boolean)
+                  filterExpr: UDFToLong(i) is not null (type: boolean)
                   Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: i is not null (type: boolean)
+                    predicate: UDFToLong(i) is not null (type: boolean)
                     Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: i (type: int)
@@ -5707,10 +5645,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: t_n22
-                  filterExpr: (j is not null and i is not null) (type: boolean)
+                  filterExpr: (j is not null and UDFToLong(i) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (i is not null and j is not null) (type: boolean)
+                    predicate: (UDFToLong(i) is not null and j is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: i (type: int), j (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/subquery_in_having.q.out b/ql/src/test/results/clientpositive/llap/subquery_in_having.q.out
index ddb7b42..a905927 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_in_having.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_in_having.q.out
@@ -1827,7 +1827,7 @@ STAGE PLANS:
                         1 Reducer 9
                       Statistics: Num rows: 1 Data size: 668 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col2 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
+                        predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col2 is null) and (_col2 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
                         Statistics: Num rows: 1 Data size: 668 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
                           expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
diff --git a/ql/src/test/results/clientpositive/llap/subquery_multi.q.out b/ql/src/test/results/clientpositive/llap/subquery_multi.q.out
index e04b2a6..a6b8885 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_multi.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_multi.q.out
@@ -386,7 +386,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col13
                   Statistics: Num rows: 1 Data size: 1355 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col10 = 0L) or (_col13 is null and _col3 is not null and (_col11 >= _col10))) (type: boolean)
+                    predicate: (((_col11 >= _col10) or (_col10 = 0L) or _col13 is not null or _col3 is null) and (_col13 is null or (_col10 = 0L)) and (_col3 is not null or (_col10 = 0L) or _col13 is not null)) (type: boolean)
                     Statistics: Num rows: 1 Data size: 1355 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -608,7 +608,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col13
                   Statistics: Num rows: 1 Data size: 1355 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col10 = 0L) or (_col13 is null and _col3 is not null and (_col11 >= _col10))) (type: boolean)
+                    predicate: (((_col11 >= _col10) or (_col10 = 0L) or _col13 is not null or _col3 is null) and (_col13 is null or (_col10 = 0L)) and (_col3 is not null or (_col10 = 0L) or _col13 is not null)) (type: boolean)
                     Statistics: Num rows: 1 Data size: 1355 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -859,7 +859,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col13
                   Statistics: Num rows: 1 Data size: 1355 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col10 = 0L) or (_col13 is null and (_col11 >= _col10))) (type: boolean)
+                    predicate: (((_col11 >= _col10) or (_col10 = 0L) or _col13 is not null or _col3 is null) and (_col13 is null or (_col10 = 0L))) (type: boolean)
                     Statistics: Num rows: 1 Data size: 1355 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -1084,7 +1084,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 1 Data size: 1335 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col12 is null and _col1 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
+                    predicate: (((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col1 is null) and (_col1 is not null or (_col9 = 0L) or _col12 is not null) and (_col12 is null or (_col9 = 0L))) (type: boolean)
                     Statistics: Num rows: 1 Data size: 1335 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -1745,6 +1745,46 @@ POSTHOOK: Input: default@tempty
 85768	almond antique chartreuse lavender yellow	Manufacturer#1	Brand#12	LARGE BRUSHED STEEL	34	SM BAG	1753.76	refull
 86428	almond aquamarine burnished black steel	Manufacturer#1	Brand#12	STANDARD ANODIZED STEEL	28	WRAP BAG	1414.42	arefully 
 90681	almond antique chartreuse khaki white	Manufacturer#3	Brand#31	MEDIUM BURNISHED TIN	17	SM CASE	1671.68	are slyly after the sl
+PREHOOK: query: explain cbo select * from part_null where 
+        p_brand NOT IN (select p_container from part where part.p_type = part_null.p_type
+                                 AND p_brand IN (select p_brand from part pp where part.p_type = pp.p_type))
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+PREHOOK: Input: default@part_null
+#### A masked pattern was here ####
+POSTHOOK: query: explain cbo select * from part_null where 
+        p_brand NOT IN (select p_container from part where part.p_type = part_null.p_type
+                                 AND p_brand IN (select p_brand from part pp where part.p_type = pp.p_type))
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+POSTHOOK: Input: default@part_null
+#### A masked pattern was here ####
+CBO PLAN:
+HiveProject(p_partkey=[$0], p_name=[$1], p_mfgr=[$2], p_brand=[$3], p_type=[$4], p_size=[$5], p_container=[$6], p_retailprice=[$7], p_comment=[$8])
+  HiveFilter(condition=[AND(OR(IS NULL($14), =($10, 0), IS NULL($10)), OR(IS NOT NULL($3), =($10, 0), IS NULL($10), IS NOT NULL($14)), OR(IS NOT TRUE(<($11, $10)), =($10, 0), IS NULL($10), IS NOT NULL($14), IS NULL($3)))])
+    HiveJoin(condition=[AND(=($3, $12), =($13, $4))], joinType=[left], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[=($9, $4)], joinType=[left], algorithm=[none], cost=[not available])
+        HiveProject(p_partkey=[$0], p_name=[$1], p_mfgr=[$2], p_brand=[$3], p_type=[$4], p_size=[$5], p_container=[$6], p_retailprice=[$7], p_comment=[$8])
+          HiveTableScan(table=[[default, part_null]], table:alias=[part_null])
+        HiveProject(p_type=[$0], c=[$1], ck=[$2])
+          HiveAggregate(group=[{1}], c=[COUNT()], ck=[COUNT($2)])
+            HiveSemiJoin(condition=[AND(=($1, $4), =($0, $3))], joinType=[inner])
+              HiveProject(p_brand=[$3], p_type=[$4], p_container=[$6])
+                HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($3))])
+                  HiveTableScan(table=[[default, part]], table:alias=[part])
+              HiveProject(p_brand=[$3], p_type=[$4])
+                HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($3))])
+                  HiveTableScan(table=[[default, part]], table:alias=[pp])
+      HiveProject(p_container=[$1], p_type=[$0], $f2=[true])
+        HiveAggregate(group=[{1, 2}])
+          HiveSemiJoin(condition=[AND(=($1, $4), =($0, $3))], joinType=[inner])
+            HiveProject(p_brand=[$3], p_type=[$4], p_container=[$6])
+              HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($3), IS NOT NULL($6))])
+                HiveTableScan(table=[[default, part]], table:alias=[part])
+            HiveProject(p_brand=[$3], p_type=[$4])
+              HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($3))])
+                HiveTableScan(table=[[default, part]], table:alias=[pp])
+
 PREHOOK: query: explain select * from part_null where p_name IN ( select p_name from part where part.p_type = part_null.p_type)
         AND p_brand NOT IN (select p_container from part where part.p_type = part_null.p_type
                                 AND p_brand IN (select p_brand from part pp where part.p_type = pp.p_type))
@@ -1953,15 +1993,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col3 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 8 Data size: 1945 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col3 is null) and (_col14 is null or (_col10 = 0L) or _col10 is null) and (_col3 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null)) (type: boolean)
+                  Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 8 Data size: 1945 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 8 Data size: 1945 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -2462,15 +2502,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 16 Data size: 5484 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col3 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 8 Data size: 2742 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col3 is null) and (_col14 is null or (_col10 = 0L) or _col10 is null) and (_col3 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null)) (type: boolean)
+                  Statistics: Num rows: 16 Data size: 5484 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 8 Data size: 2742 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 16 Data size: 5484 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 8 Data size: 2742 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 16 Data size: 5484 Basic stats: COMPLETE Column stats: NONE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -2736,15 +2776,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col3 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 8 Data size: 1945 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col3 is null) and (_col14 is null or (_col10 = 0L) or _col10 is null) and (_col3 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null)) (type: boolean)
+                  Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 8 Data size: 1945 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 8 Data size: 1945 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 16 Data size: 3891 Basic stats: COMPLETE Column stats: NONE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -3197,7 +3237,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col2, _col4, _col5, _col7
                   Statistics: Num rows: 2 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col4 = 0L) or (_col7 is null and _col2 is not null and (_col5 >= _col4))) (type: boolean)
+                    predicate: (((_col5 >= _col4) or (_col4 = 0L) or _col7 is not null or _col2 is null) and (_col2 is not null or (_col4 = 0L) or _col7 is not null) and (_col7 is null or (_col4 = 0L))) (type: boolean)
                     Statistics: Num rows: 2 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), 1 (type: int)
@@ -4120,15 +4160,15 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 27 Data size: 17153 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col0 = 3) or CASE WHEN ((_col9 = 0L)) THEN (true) WHEN (_col12 is not null) THEN (false) WHEN (_col5 is null) THEN (null) WHEN ((_col10 < _col9)) THEN (null) ELSE (true) END) (type: boolean)
-                    Statistics: Num rows: 14 Data size: 8898 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: (((_col9 <> 0L) and _col12 is null and (_col10 >= _col9) and _col5 is not null) or (_col0 = 3) or (_col9 = 0L)) (type: boolean)
+                    Statistics: Num rows: 27 Data size: 17153 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 14 Data size: 8666 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 27 Data size: 16713 Basic stats: COMPLETE Column stats: COMPLETE
                       File Output Operator
                         compressed: false
-                        Statistics: Num rows: 14 Data size: 8666 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 27 Data size: 16713 Basic stats: COMPLETE Column stats: COMPLETE
                         table:
                             input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                             output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -4343,7 +4383,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col4, _col5
                 Statistics: Num rows: 631 Data size: 65521 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: ((_col4 is not null and (_col2 <> 0L)) or _col1 is not null or _col5 is not null) (type: boolean)
+                  predicate: (((_col2 <> 0L) and _col4 is not null) or _col1 is not null or _col5 is not null) (type: boolean)
                   Statistics: Num rows: 631 Data size: 65521 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     Statistics: Num rows: 631 Data size: 65521 Basic stats: COMPLETE Column stats: COMPLETE
diff --git a/ql/src/test/results/clientpositive/llap/subquery_notin.q.out b/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
index 37d9253..c21810c 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
@@ -117,7 +117,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col5
                   Statistics: Num rows: 631 Data size: 122942 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col2 = 0L) or (_col5 is null and _col0 is not null and (_col3 >= _col2))) (type: boolean)
+                    predicate: (((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col0 is null) and (_col0 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L))) (type: boolean)
                     Statistics: Num rows: 631 Data size: 122942 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: string), _col1 (type: string)
@@ -406,15 +406,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col8
                 Statistics: Num rows: 38 Data size: 8914 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 19 Data size: 4457 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col0 is null) and (_col0 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
+                  Statistics: Num rows: 38 Data size: 8914 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col1 (type: string), _col0 (type: string), _col2 (type: int)
                     outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 19 Data size: 4237 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 38 Data size: 8474 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 19 Data size: 4237 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 38 Data size: 8474 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -691,7 +691,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col5
                   Statistics: Num rows: 27 Data size: 3815 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col2 = 0L) or (_col5 is null and _col1 is not null and (_col3 >= _col2))) (type: boolean)
+                    predicate: (((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col1 is null) and (_col1 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L))) (type: boolean)
                     Statistics: Num rows: 27 Data size: 3815 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: string), _col1 (type: int)
@@ -964,7 +964,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col4
                 Statistics: Num rows: 33 Data size: 7527 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (sq_count_check(CASE WHEN (_col4 is null) THEN (0) ELSE (_col4) END, true) > 0) (type: boolean)
+                  predicate: (sq_count_check(CASE WHEN (_col4 is null) THEN (0L) ELSE (_col4) END, true) > 0) (type: boolean)
                   Statistics: Num rows: 11 Data size: 2517 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int)
@@ -1005,15 +1005,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col8
                 Statistics: Num rows: 15 Data size: 3605 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col2 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 7 Data size: 1685 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col2 is null) and (_col2 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
+                  Statistics: Num rows: 15 Data size: 3605 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col1 (type: string), _col0 (type: string), _col2 (type: int)
                     outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 7 Data size: 1561 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 15 Data size: 3345 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 7 Data size: 1561 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 15 Data size: 3345 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -1485,7 +1485,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: src
-                  filterExpr: ((key < '11') or ((key < '11') and CASE WHEN ((key > '104')) THEN (null) ELSE ((key < '11')) END)) (type: boolean)
+                  filterExpr: ((key < '11') or ((key < '11') and (key > '104') is not true)) (type: boolean)
                   properties:
                     insideView TRUE
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
@@ -1502,7 +1502,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 166 Data size: 14442 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((key < '11') and CASE WHEN ((key > '104')) THEN (null) ELSE ((key < '11')) END) (type: boolean)
+                    predicate: ((key < '11') and (key > '104') is not true) (type: boolean)
                     Statistics: Num rows: 83 Data size: 7221 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: CASE WHEN ((key > '104')) THEN (null) ELSE (key) END (type: string)
@@ -1569,7 +1569,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col4
                   Statistics: Num rows: 230 Data size: 23950 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col1 = 0L) or (_col4 is null and _col0 is not null and (_col2 >= _col1))) (type: boolean)
+                    predicate: (((_col2 >= _col1) or (_col1 = 0L) or _col4 is not null or _col0 is null) and (_col0 is not null or (_col1 = 0L) or _col4 is not null) and (_col4 is null or (_col1 = 0L))) (type: boolean)
                     Statistics: Num rows: 230 Data size: 23950 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: string)
@@ -1753,15 +1753,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 64 Data size: 40340 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col5 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 32 Data size: 20180 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col5 is null) and (_col14 is null or (_col10 = 0L) or _col10 is null) and (_col5 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null)) (type: boolean)
+                  Statistics: Num rows: 64 Data size: 40340 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 32 Data size: 19808 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 64 Data size: 39616 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 32 Data size: 19808 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 64 Data size: 39616 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -1935,7 +1935,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 33 Data size: 20987 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col12 is null and _col5 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
+                    predicate: (((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col5 is null) and (_col12 is null or (_col9 = 0L)) and (_col5 is not null or (_col9 = 0L) or _col12 is not null)) (type: boolean)
                     Statistics: Num rows: 33 Data size: 20987 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -2153,7 +2153,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 32 Data size: 20348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col12 is null and _col0 is not null and _col5 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
+                    predicate: (((_col0 is not null and _col5 is not null) or (_col9 = 0L) or _col12 is not null) and ((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col0 is null or _col5 is null) and (_col12 is null or (_col9 = 0L))) (type: boolean)
                     Statistics: Num rows: 32 Data size: 20348 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -2417,10 +2417,10 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col3, _col4, _col7
                 Statistics: Num rows: 48 Data size: 660 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN ((_col1 + 100) is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 24 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col1 is null) and (_col1 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 48 Data size: 660 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    Statistics: Num rows: 24 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 48 Data size: 660 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       aggregations: count()
                       minReductionHashAggr: 0.0
@@ -2609,7 +2609,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 32 Data size: 20348 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col12 is null and _col7 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
+                    predicate: (((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col7 is null) and (_col12 is null or (_col9 = 0L)) and (_col7 is not null or (_col9 = 0L) or _col12 is not null)) (type: boolean)
                     Statistics: Num rows: 32 Data size: 20348 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -2720,13 +2720,10 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 10 <- Map 9 (SIMPLE_EDGE)
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 8 (ONE_TO_ONE_EDGE)
-        Reducer 5 <- Map 4 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
-        Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
-        Reducer 7 <- Map 4 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
-        Reducer 8 <- Reducer 7 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (ONE_TO_ONE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
+        Reducer 5 <- Map 4 (SIMPLE_EDGE)
+        Reducer 6 <- Map 4 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2750,80 +2747,48 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: p
-                  filterExpr: ((p_size is not null and p_partkey is not null) or (p_size is not null and p_partkey is not null and p_name is not null)) (type: boolean)
+                  filterExpr: ((((p_size + 121150) = p_partkey) and p_size is not null) or (((p_size + 121150) = p_partkey) and p_size is not null and p_name is not null)) (type: boolean)
                   Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (p_partkey is not null and p_size is not null) (type: boolean)
-                    Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: (((p_size + 121150) = p_partkey) and p_size is not null) (type: boolean)
+                    Statistics: Num rows: 13 Data size: 1677 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_size (type: int)
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col2 (type: int), _col0 (type: int)
-                        sort order: ++
-                        Map-reduce partition columns: _col2 (type: int), _col0 (type: int)
-                        Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
+                      expressions: p_name (type: string), p_size (type: int)
+                      outputColumnNames: p_name, p_size
+                      Statistics: Num rows: 13 Data size: 1677 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: count(), count(p_name)
+                        keys: p_size (type: int)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 6 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: int)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: int)
+                          Statistics: Num rows: 6 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col1 (type: bigint), _col2 (type: bigint)
                   Filter Operator
-                    predicate: (p_name is not null and p_partkey is not null and p_size is not null) (type: boolean)
-                    Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: (((p_size + 121150) = p_partkey) and p_name is not null and p_size is not null) (type: boolean)
+                    Statistics: Num rows: 13 Data size: 1677 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_size (type: int)
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col2 (type: int), _col0 (type: int)
-                        sort order: ++
-                        Map-reduce partition columns: _col2 (type: int), _col0 (type: int)
-                        Statistics: Num rows: 26 Data size: 3354 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 9 
-            Map Operator Tree:
-                TableScan
-                  alias: part
-                  filterExpr: p_size is not null (type: boolean)
-                  Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                  Filter Operator
-                    predicate: p_size is not null (type: boolean)
-                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      keys: p_size (type: int)
-                      minReductionHashAggr: 0.0
-                      mode: hash
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_name (type: string), p_size (type: int)
+                      outputColumnNames: p_name, p_size
+                      Statistics: Num rows: 13 Data size: 1677 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: p_name (type: string), p_size (type: int)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0, _col1
+                        Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string), _col1 (type: int)
+                          sort order: ++
+                          Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
+                          Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Reducer 10 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col0 (type: int), (_col0 + 121150) (type: int)
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 2 
             Execution mode: llap
             Reduce Operator Tree:
@@ -2853,44 +2818,20 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col14
                 Statistics: Num rows: 40 Data size: 25032 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col10 = 0L)) THEN (true) WHEN (_col10 is null) THEN (true) WHEN (_col14 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col11 < _col10)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 20 Data size: 12524 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col11 < _col10) is not true or (_col10 = 0L) or _col10 is null or _col14 is not null or _col1 is null) and (_col1 is not null or (_col10 = 0L) or _col10 is null or _col14 is not null) and (_col14 is null or (_col10 = 0L) or _col10 is null)) (type: boolean)
+                  Statistics: Num rows: 40 Data size: 25032 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 20 Data size: 12380 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 40 Data size: 24760 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 20 Data size: 12380 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 40 Data size: 24760 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                           serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
         Reducer 5 
-            Execution mode: llap
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col2 (type: int), _col0 (type: int)
-                  1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col3
-                Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
-                Group By Operator
-                  aggregations: count(), count(_col1)
-                  keys: _col3 (type: int)
-                  minReductionHashAggr: 0.0
-                  mode: hash
-                  outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 6 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 6 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col1 (type: bigint), _col2 (type: bigint)
-        Reducer 6 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator
@@ -2905,29 +2846,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 6 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col1 (type: bigint), _col2 (type: bigint)
-        Reducer 7 
-            Execution mode: llap
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col2 (type: int), _col0 (type: int)
-                  1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col3
-                Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
-                Group By Operator
-                  keys: _col1 (type: string), _col3 (type: int)
-                  minReductionHashAggr: 0.0
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string), _col1 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-                    Statistics: Num rows: 6 Data size: 750 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 8 
+        Reducer 6 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator
@@ -3091,15 +3010,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col11, _col12, _col16
                 Statistics: Num rows: 59 Data size: 37149 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col11 = 0L)) THEN (true) WHEN (_col11 is null) THEN (true) WHEN (_col16 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col12 < _col11)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 29 Data size: 18267 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col12 < _col11) is not true or (_col11 = 0L) or _col11 is null or _col16 is not null or _col1 is null) and (_col1 is not null or (_col11 = 0L) or _col11 is null or _col16 is not null) and (_col16 is null or (_col11 = 0L) or _col11 is null)) (type: boolean)
+                  Statistics: Num rows: 59 Data size: 37149 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 29 Data size: 17951 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 59 Data size: 36521 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 29 Data size: 17951 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 59 Data size: 36521 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -3196,7 +3115,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: part
-                  filterExpr: (p_brand is not null or (p_brand is not null and p_type is not null)) (type: boolean)
+                  filterExpr: (p_brand is not null or (p_brand is not null and UDFToDouble(p_type) is not null)) (type: boolean)
                   Statistics: Num rows: 26 Data size: 5096 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: p_brand is not null (type: boolean)
@@ -3219,7 +3138,7 @@ STAGE PLANS:
                           Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
                           value expressions: _col1 (type: bigint), _col2 (type: bigint)
                   Filter Operator
-                    predicate: (p_brand is not null and p_type is not null) (type: boolean)
+                    predicate: (UDFToDouble(p_type) is not null and p_brand is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 5096 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: (UDFToDouble(p_type) + 2.0D) (type: double), p_brand (type: string)
@@ -3267,15 +3186,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col4, _col5, _col8
                 Statistics: Num rows: 58 Data size: 13682 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 29 Data size: 6849 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col1 is null) and (_col1 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
+                  Statistics: Num rows: 58 Data size: 13682 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 29 Data size: 3509 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 58 Data size: 7018 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 29 Data size: 3509 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 58 Data size: 7018 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -3505,15 +3424,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col4, _col5, _col8
                 Statistics: Num rows: 46 Data size: 10734 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 23 Data size: 5375 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col1 is null) and (_col1 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
+                  Statistics: Num rows: 46 Data size: 10734 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 23 Data size: 2783 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 46 Data size: 5566 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 23 Data size: 2783 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 46 Data size: 5566 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -3763,7 +3682,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col5
                   Statistics: Num rows: 907 Data size: 177590 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col2 = 0L) or (_col5 is null and _col1 is not null and (_col3 >= _col2))) (type: boolean)
+                    predicate: (((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col1 is null) and (_col1 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L))) (type: boolean)
                     Statistics: Num rows: 907 Data size: 177590 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: string)
@@ -4062,12 +3981,12 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col7
                 Statistics: Num rows: 1623 Data size: 309794 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 811 Data size: 154810 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col1 is null) and (_col1 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 1401 Data size: 267414 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 811 Data size: 154810 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 1401 Data size: 267414 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       aggregations: count()
                       keys: _col0 (type: string)
@@ -4325,7 +4244,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 33 Data size: 20987 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col12 is null and _col5 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
+                    predicate: (((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col5 is null) and (_col12 is null or (_col9 = 0L)) and (_col5 is not null or (_col9 = 0L) or _col12 is not null)) (type: boolean)
                     Statistics: Num rows: 33 Data size: 20987 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -4544,7 +4463,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 33 Data size: 20987 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col12 is null and _col5 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
+                    predicate: (((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col5 is null) and (_col12 is null or (_col9 = 0L)) and (_col5 is not null or (_col9 = 0L) or _col12 is not null)) (type: boolean)
                     Statistics: Num rows: 33 Data size: 20987 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -4833,7 +4752,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col5
                   Statistics: Num rows: 539 Data size: 104726 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col2 = 0L) or (_col5 is null and _col0 is not null and (_col3 >= _col2))) (type: boolean)
+                    predicate: (((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col0 is null) and (_col0 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L))) (type: boolean)
                     Statistics: Num rows: 539 Data size: 104726 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: string), _col1 (type: string)
@@ -5433,7 +5352,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: part
-                  filterExpr: (p_brand is not null or (p_brand is not null and p_type is not null)) (type: boolean)
+                  filterExpr: (p_brand is not null or (p_brand is not null and UDFToDouble(p_type) is not null)) (type: boolean)
                   Statistics: Num rows: 26 Data size: 5096 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: p_brand is not null (type: boolean)
@@ -5452,7 +5371,7 @@ STAGE PLANS:
                         Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: bigint), _col2 (type: bigint)
                   Filter Operator
-                    predicate: (p_brand is not null and p_type is not null) (type: boolean)
+                    predicate: (UDFToDouble(p_type) is not null and p_brand is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 5096 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       keys: p_brand (type: string), p_type (type: string)
@@ -5471,10 +5390,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: e
-                  filterExpr: p_size is not null (type: boolean)
+                  filterExpr: UDFToDouble((p_size + 100)) is not null (type: boolean)
                   Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: p_size is not null (type: boolean)
+                    predicate: UDFToDouble((p_size + 100)) is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       keys: p_size (type: int)
@@ -5532,10 +5451,10 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col3, _col4, _col7
                 Statistics: Num rows: 53 Data size: 780 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN ((_col1 + 100) is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 26 Data size: 388 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col1 is null) and (_col1 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 53 Data size: 780 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    Statistics: Num rows: 26 Data size: 388 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 53 Data size: 780 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       aggregations: count()
                       minReductionHashAggr: 0.0
@@ -5767,7 +5686,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col4
                   Statistics: Num rows: 5 Data size: 108 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col1 = 0L) or (_col4 is null and _col0 is not null and (_col2 >= _col1))) (type: boolean)
+                    predicate: (((_col2 >= _col1) or (_col1 = 0L) or _col4 is not null or _col0 is null) and (_col0 is not null or (_col1 = 0L) or _col4 is not null) and (_col4 is null or (_col1 = 0L))) (type: boolean)
                     Statistics: Num rows: 5 Data size: 108 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int)
@@ -5848,11 +5767,12 @@ STAGE PLANS:
 #### A masked pattern was here ####
       Edges:
         Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 7 (ONE_TO_ONE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 8 (ONE_TO_ONE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 9 (ONE_TO_ONE_EDGE)
         Reducer 5 <- Map 4 (SIMPLE_EDGE)
-        Reducer 6 <- Map 9 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+        Reducer 6 <- Map 10 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
         Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
-        Reducer 8 <- Reducer 6 (SIMPLE_EDGE)
+        Reducer 8 <- Map 10 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+        Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -5872,14 +5792,48 @@ STAGE PLANS:
                       value expressions: _col0 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
+        Map 10 
+            Map Operator Tree:
+                TableScan
+                  alias: t2_n0
+                  filterExpr: (UDFToDouble(c1) is not null or (UDFToDouble(c1) is not null and c1 is not null)) (type: boolean)
+                  Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
+                  Filter Operator
+                    predicate: UDFToDouble(c1) is not null (type: boolean)
+                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: c1 (type: int), UDFToDouble(c1) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col1 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: double)
+                        Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int)
+                  Filter Operator
+                    predicate: (UDFToDouble(c1) is not null and c1 is not null) (type: boolean)
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: c1 (type: int), UDFToDouble(c1) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col1 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: double)
+                        Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int)
+            Execution mode: vectorized, llap
+            LLAP IO: no inputs
         Map 4 
             Map Operator Tree:
                 TableScan
                   alias: t1_n0
-                  filterExpr: c2 is not null (type: boolean)
+                  filterExpr: UDFToDouble(c2) is not null (type: boolean)
                   Statistics: Num rows: 4 Data size: 352 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: c2 is not null (type: boolean)
+                    predicate: UDFToDouble(c2) is not null (type: boolean)
                     Statistics: Num rows: 3 Data size: 264 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       keys: c2 (type: char(100))
@@ -5894,27 +5848,6 @@ STAGE PLANS:
                         Statistics: Num rows: 1 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Map 9 
-            Map Operator Tree:
-                TableScan
-                  alias: t2_n0
-                  filterExpr: c1 is not null (type: boolean)
-                  Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
-                  Filter Operator
-                    predicate: c1 is not null (type: boolean)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                    Select Operator
-                      expressions: c1 (type: int), UDFToDouble(c1) (type: double)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col1 (type: double)
-                        sort order: +
-                        Map-reduce partition columns: _col1 (type: double)
-                        Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int)
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
         Reducer 2 
             Execution mode: llap
             Reduce Operator Tree:
@@ -5944,15 +5877,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col3, _col4, _col7
                 Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col0 is null) and (_col0 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -5975,6 +5908,12 @@ STAGE PLANS:
                     Map-reduce partition columns: _col1 (type: double)
                     Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
                     value expressions: _col0 (type: char(100))
+                  Reduce Output Operator
+                    key expressions: _col1 (type: double)
+                    sort order: +
+                    Map-reduce partition columns: _col1 (type: double)
+                    Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: char(100))
         Reducer 6 
             Execution mode: llap
             Reduce Operator Tree:
@@ -5999,17 +5938,6 @@ STAGE PLANS:
                     Map-reduce partition columns: _col0 (type: char(100))
                     Statistics: Num rows: 1 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                     value expressions: _col1 (type: bigint), _col2 (type: bigint)
-                Group By Operator
-                  keys: _col2 (type: int), _col0 (type: char(100))
-                  minReductionHashAggr: 0.0
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: char(100))
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: char(100))
-                    Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 7 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
@@ -6026,6 +5954,28 @@ STAGE PLANS:
                   Statistics: Num rows: 1 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col1 (type: bigint), _col2 (type: bigint)
         Reducer 8 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: double)
+                  1 _col1 (type: double)
+                outputColumnNames: _col0, _col2
+                Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
+                Group By Operator
+                  keys: _col2 (type: int), _col0 (type: char(100))
+                  minReductionHashAggr: 0.0
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: char(100))
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col1 (type: char(100))
+                    Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
+        Reducer 9 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator
@@ -6225,15 +6175,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col7
                 Statistics: Num rows: 3 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 1 Data size: 28 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col1 is null) and (_col1 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 3 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -6473,15 +6423,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col6
                 Statistics: Num rows: 2 Data size: 56 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col6 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 1 Data size: 28 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col6 is not null or _col1 is null) and (_col1 is not null or (_col3 = 0L) or _col3 is null or _col6 is not null) and (_col6 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 56 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -6724,15 +6674,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col6
                 Statistics: Num rows: 3 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col6 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 1 Data size: 28 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col6 is not null or _col1 is null) and (_col1 is not null or (_col3 = 0L) or _col3 is null or _col6 is not null) and (_col6 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 3 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -6917,15 +6867,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col3, _col4, _col7
                 Statistics: Num rows: 4 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 2 Data size: 44 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col0 is null) and (_col0 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 4 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -7083,7 +7033,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col5
                   Statistics: Num rows: 3 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col2 = 0L) or (_col5 is null and _col1 is not null and (_col3 >= _col2))) (type: boolean)
+                    predicate: (((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col1 is null) and (_col1 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L))) (type: boolean)
                     Statistics: Num rows: 3 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int)
@@ -7258,7 +7208,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col4
                   Statistics: Num rows: 4 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((_col1 = 0L) or (_col4 is null and _col0 is not null and (_col2 >= _col1))) (type: boolean)
+                    predicate: (((_col2 >= _col1) or (_col1 = 0L) or _col4 is not null or _col0 is null) and (_col0 is not null or (_col1 = 0L) or _col4 is not null) and (_col4 is null or (_col1 = 0L))) (type: boolean)
                     Statistics: Num rows: 4 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int)
@@ -7431,15 +7381,15 @@ STAGE PLANS:
                 residual filter predicates: {(_col1 > _col6)}
                 Statistics: Num rows: 1145 Data size: 236851 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 572 Data size: 118384 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col4 < _col3) is not true or (_col3 = 0L) or _col3 is null or _col7 is not null or _col0 is null) and (_col0 is not null or (_col3 = 0L) or _col3 is null or _col7 is not null) and (_col7 is null or (_col3 = 0L) or _col3 is null)) (type: boolean)
+                  Statistics: Num rows: 1145 Data size: 236851 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 572 Data size: 101816 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 1145 Data size: 203810 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 572 Data size: 101816 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1145 Data size: 203810 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/llap/subquery_null_agg.q.out b/ql/src/test/results/clientpositive/llap/subquery_null_agg.q.out
index 2c306da..6de5362 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_null_agg.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_null_agg.q.out
@@ -6,8 +6,8 @@ POSTHOOK: query: CREATE TABLE table_7 (int_col INT)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table_7
-Warning: Shuffle Join MERGEJOIN[29][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
-Warning: Shuffle Join MERGEJOIN[30][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[24][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[25][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: explain
 SELECT
 (t1.int_col) * (t1.int_col) AS int_col
@@ -59,10 +59,9 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Reducer 4 (CUSTOM_SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (XPROD_EDGE), Reducer 5 (XPROD_EDGE)
-        Reducer 4 <- Map 1 (SIMPLE_EDGE)
-        Reducer 5 <- Map 1 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 5 (CUSTOM_SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (XPROD_EDGE), Reducer 4 (XPROD_EDGE)
+        Reducer 4 <- Map 1 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -79,29 +78,35 @@ STAGE PLANS:
                       predicate: false (type: boolean)
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
                       Group By Operator
-                        keys: true (type: boolean)
+                        aggregations: count()
                         minReductionHashAggr: 0.99
                         mode: hash
                         outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
                         Reduce Output Operator
-                          key expressions: _col0 (type: boolean)
-                          sort order: +
-                          Map-reduce partition columns: _col0 (type: boolean)
-                          Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+                          sort order: 
+                          Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
+                          value expressions: _col0 (type: bigint)
+            Execution mode: vectorized, llap
+            LLAP IO: no inputs
+        Map 5 
+            Map Operator Tree:
+                TableScan
+                  alias: table_7
+                  Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+                  Select Operator
+                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
                     Filter Operator
                       predicate: false (type: boolean)
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.99
-                        mode: hash
+                      Select Operator
+                        expressions: true (type: boolean)
                         outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
                         Reduce Output Operator
                           sort order: 
-                          Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+                          value expressions: _col0 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -128,14 +133,14 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 10 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: _col2 (type: bigint), _col1 (type: boolean)
-                  outputColumnNames: _col1, _col2
+                  expressions: _col2 (type: bigint), _col3 (type: bigint), _col1 (type: boolean)
+                  outputColumnNames: _col1, _col2, _col3
                   Statistics: Num rows: 1 Data size: 10 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
-                    predicate: ((_col1 = 0L) or _col2 is null) (type: boolean)
+                    predicate: ((_col1 = 0L) or (_col3 is null and (_col2 >= _col1))) (type: boolean)
                     Statistics: Num rows: 1 Data size: 10 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
                       expressions: null (type: void)
@@ -152,30 +157,18 @@ STAGE PLANS:
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator
-                keys: KEY._col0 (type: boolean)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-                Select Operator
-                  expressions: true (type: boolean)
-                  outputColumnNames: _col0
-                  Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-                  Reduce Output Operator
-                    sort order: 
-                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-                    value expressions: _col0 (type: boolean)
-        Reducer 5 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
                 aggregations: count(VALUE._col0)
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: _col0 (type: bigint), _col0 (type: bigint)
+                  outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
-                  value expressions: _col0 (type: bigint)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: PARTIAL Column stats: COMPLETE
+                    value expressions: _col0 (type: bigint), _col1 (type: bigint)
 
   Stage: Stage-0
     Fetch Operator
diff --git a/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out b/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
index 1016a64..c4f8307 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
@@ -355,8 +355,8 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join MERGEJOIN[26][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
-Warning: Shuffle Join MERGEJOIN[27][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 4' is a cross product
+Warning: Shuffle Join MERGEJOIN[25][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[26][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: explain select * from part where p_name = (select p_name from part_null_n0 where p_name is null)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@part
@@ -376,73 +376,55 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
-        Reducer 3 <- Map 1 (XPROD_EDGE), Reducer 2 (XPROD_EDGE)
-        Reducer 4 <- Map 5 (XPROD_EDGE), Reducer 3 (XPROD_EDGE)
+        Reducer 2 <- Map 1 (XPROD_EDGE), Reducer 5 (XPROD_EDGE)
+        Reducer 3 <- Map 4 (XPROD_EDGE), Reducer 2 (XPROD_EDGE)
+        Reducer 5 <- Map 4 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: part_null_n0
-                  filterExpr: p_name is null (type: boolean)
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                  alias: part
+                  Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: p_name is null (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                    predicate: false (type: boolean)
+                    Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.99
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          sort order: 
-                          Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col0 (type: bigint)
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                      Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
-        Map 5 
+        Map 4 
             Map Operator Tree:
                 TableScan
-                  alias: part
-                  filterExpr: (p_name = null) (type: boolean)
-                  Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
-                  Filter Operator
-                    predicate: (p_name = null) (type: boolean)
-                    Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
-                    Select Operator
-                      expressions: p_partkey (type: int), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                      Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
+                  alias: part_null_n0
+                  Statistics: Num rows: 1 Data size: 32560 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    Filter Operator
+                      predicate: false (type: boolean)
+                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: count(0)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: bigint)
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
+                        Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                aggregations: count(VALUE._col0)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (sq_count_check(_col0) <= 1) (type: boolean)
-                  Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      sort order: 
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
-        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Merge Join Operator
@@ -451,11 +433,13 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                Statistics: Num rows: 1 Data size: 377 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 1 Data size: 377 Basic stats: COMPLETE Column stats: NONE
-        Reducer 4 
+                  Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Merge Join Operator
@@ -464,19 +448,28 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
-                Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 5 
+            Execution mode: vectorized, llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: count(VALUE._col0)
+                mode: mergepartial
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col2 (type: int), null (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: double), _col9 (type: string)
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 1 Data size: 876 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -484,8 +477,8 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join MERGEJOIN[26][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
-Warning: Shuffle Join MERGEJOIN[27][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 4' is a cross product
+Warning: Shuffle Join MERGEJOIN[25][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[26][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: select * from part where p_name = (select p_name from part_null_n0 where p_name is null)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@part
@@ -2480,7 +2473,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 39 Data size: 24309 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN (_col10 is null) THEN ((UDFToLong(_col5) <> 0)) ELSE ((UDFToLong(_col5) <> _col9)) END (type: boolean)
+                  predicate: CASE WHEN (_col10 is null) THEN ((UDFToLong(_col5) <> 0L)) ELSE ((UDFToLong(_col5) <> _col9)) END (type: boolean)
                   Statistics: Num rows: 19 Data size: 11845 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -3595,15 +3588,15 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col13
                   Statistics: Num rows: 7 Data size: 3595 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col10 = 0L) or (_col13 is null and _col3 is not null and (_col11 >= _col10))) (type: boolean)
-                    Statistics: Num rows: 4 Data size: 2054 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (((_col11 >= _col10) or (_col10 = 0L) or _col13 is not null or _col3 is null) and (_col13 is null or (_col10 = 0L)) and (_col3 is not null or (_col10 = 0L) or _col13 is not null)) (type: boolean)
+                    Statistics: Num rows: 6 Data size: 3081 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 4 Data size: 2054 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 6 Data size: 3081 Basic stats: COMPLETE Column stats: NONE
                       File Output Operator
                         compressed: false
-                        Statistics: Num rows: 4 Data size: 2054 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 6 Data size: 3081 Basic stats: COMPLETE Column stats: NONE
                         table:
                             input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                             output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -3845,17 +3838,17 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12
                   Statistics: Num rows: 14 Data size: 2025 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col12 is null and _col3 is not null and (_col10 >= _col9)) or (_col9 = 0L)) (type: boolean)
-                    Statistics: Num rows: 9 Data size: 1301 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (((_col10 >= _col9) or (_col9 = 0L) or _col12 is not null or _col3 is null) and (_col12 is null or (_col9 = 0L)) and (_col3 is not null or (_col9 = 0L) or _col12 is not null)) (type: boolean)
+                    Statistics: Num rows: 14 Data size: 2025 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 9 Data size: 1301 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 14 Data size: 2025 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col4 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col4 (type: string)
-                        Statistics: Num rows: 9 Data size: 1301 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 14 Data size: 2025 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
         Reducer 5 
             Execution mode: llap
@@ -3868,14 +3861,14 @@ STAGE PLANS:
                   1 _col1 (type: string)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                 residual filter predicates: {(not (_col1 like _col9))}
-                Statistics: Num rows: 5 Data size: 795 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 8 Data size: 1187 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 5 Data size: 795 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 8 Data size: 1187 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 5 Data size: 795 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 8 Data size: 1187 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -4955,7 +4948,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 6 Data size: 2025 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN (_col11 is null) THEN ((UDFToLong(_col2) <> 0)) ELSE ((UDFToLong(_col2) <> _col10)) END (type: boolean)
+                  predicate: CASE WHEN (_col11 is null) THEN ((UDFToLong(_col2) <> 0L)) ELSE ((UDFToLong(_col2) <> _col10)) END (type: boolean)
                   Statistics: Num rows: 3 Data size: 1065 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date)
@@ -5231,7 +5224,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 6 Data size: 2025 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN (_col11 is null) THEN ((UDFToLong(_col2) <> 0)) ELSE ((UDFToLong(_col2) <> _col10)) END (type: boolean)
+                  predicate: CASE WHEN (_col11 is null) THEN ((UDFToLong(_col2) <> 0L)) ELSE ((UDFToLong(_col2) <> _col10)) END (type: boolean)
                   Statistics: Num rows: 3 Data size: 1065 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date)
@@ -5255,7 +5248,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col13, _col14
                 Statistics: Num rows: 4 Data size: 1428 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN (_col14 is null) THEN ((UDFToLong(_col0) > 0)) ELSE ((UDFToLong(_col0) > _col13)) END (type: boolean)
+                  predicate: CASE WHEN (_col14 is null) THEN ((UDFToLong(_col0) > 0L)) ELSE ((UDFToLong(_col0) > _col13)) END (type: boolean)
                   Statistics: Num rows: 2 Data size: 714 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date)
@@ -6336,7 +6329,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 40 Data size: 24940 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN (_col10 is null) THEN ((UDFToLong(_col5) <> 0)) ELSE ((UDFToLong(_col5) <> _col9)) END (type: boolean)
+                  predicate: CASE WHEN (_col10 is null) THEN ((UDFToLong(_col5) <> 0L)) ELSE ((UDFToLong(_col5) <> _col9)) END (type: boolean)
                   Statistics: Num rows: 20 Data size: 12476 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -6556,15 +6549,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN (_col3 is null) THEN (true) ELSE ((_col2 = 0L)) END (type: boolean)
-                  Statistics: Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: ((_col2 = 0L) or _col3 is null) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -6900,15 +6893,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 2 Data size: 17 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: CASE WHEN (_col3 is null) THEN (true) ELSE ((_col2 = 0L)) END (type: boolean)
-                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col2 = 0L) or _col3 is null) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 17 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 2 Data size: 17 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2 Data size: 17 Basic stats: COMPLETE Column stats: NONE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/llap/subquery_select.q.out b/ql/src/test/results/clientpositive/llap/subquery_select.q.out
index ab56f90..0a01852 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_select.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_select.q.out
@@ -98,7 +98,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col5
                 Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (false) WHEN (_col3 is not null) THEN (true) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col0 (type: int), ((_col3 is not null and _col4) or ((_col1 or _col5) and null and _col4 and _col3 is null)) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -140,7 +140,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                    expressions: (_col0 <> 0L) (type: boolean), (_col1 < _col0) (type: boolean)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
@@ -298,7 +298,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col9
                 Statistics: Num rows: 48 Data size: 852 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col5) THEN (false) WHEN (_col4 is null) THEN (false) WHEN (_col9 is not null) THEN (true) WHEN (_col2) THEN (null) WHEN (_col6) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col1 (type: int), ((_col9 is not null and (_col5 or _col4 is null) is not true) or ((_col2 or _col6) is true and null and (_col5 or _col4 is null) is not true and _col9 is null)) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 48 Data size: 384 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -434,15 +434,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_size (type: int), p_size is null (type: boolean)
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_size (type: int), p_size is null (type: boolean), p_size is not null (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 26 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: boolean)
+                      Statistics: Num rows: 26 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: boolean), _col2 (type: boolean)
                   Select Operator
                     expressions: p_size (type: int)
                     outputColumnNames: p_size
@@ -482,12 +482,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col3
-                Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col4
+                Statistics: Num rows: 27 Data size: 332 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col1 (type: boolean), _col3 (type: boolean)
+                  Statistics: Num rows: 27 Data size: 332 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: boolean), _col2 (type: boolean), _col4 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -497,10 +497,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col3, _col4, _col5
-                Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 27 Data size: 764 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (true) WHEN (_col3 is not null) THEN (false) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (true) END (type: boolean)
+                  expressions: _col0 (type: int), (_col5 or ((_col1 or _col6) and null and _col7 and _col4 is null) or (_col7 and _col4 is null and _col2 and _col8)) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -542,13 +542,13 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean), (_col0 <> 0L) (type: boolean), (_col1 >= _col0) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: boolean), _col1 (type: boolean)
+                      Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: boolean), _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -727,7 +727,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3
                 Statistics: Num rows: 40 Data size: 4440 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: (sq_count_check(CASE WHEN (_col3 is null) THEN (0) ELSE (_col3) END, true) > 0) (type: boolean)
+                  predicate: (sq_count_check(CASE WHEN (_col3 is null) THEN (0L) ELSE (_col3) END, true) > 0) (type: boolean)
                   Statistics: Num rows: 13 Data size: 1452 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: int), _col1 is null (type: boolean)
@@ -768,7 +768,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col9
                 Statistics: Num rows: 13 Data size: 364 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col5) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col9 is not null) THEN (false) WHEN (_col2) THEN (null) WHEN (_col6) THEN (null) ELSE (true) END (type: boolean)
+                  expressions: _col1 (type: int), ((_col5 or _col4 is null) is true or ((_col2 or _col6) is true and null and (_col5 or _col4 is null) is not true and _col9 is null) or ((_col5 or _col4 is null) is not true and _col9 is null and (_col2 or _col6) is not true)) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -1516,7 +1516,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col3
                 Statistics: Num rows: 37 Data size: 316 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col3 is null) THEN (0) ELSE (_col2) END (type: bigint)
+                  expressions: _col1 (type: int), CASE WHEN (_col3 is null) THEN (0L) ELSE (_col2) END (type: bigint)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 37 Data size: 444 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -2328,7 +2328,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col5
                 Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (false) WHEN (_col3 is not null) THEN (true) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col0 (type: int), ((_col3 is not null and _col4) or ((_col1 or _col5) and null and _col4 and _col3 is null)) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -2365,7 +2365,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                  expressions: (_col0 <> 0L) (type: boolean), (_col1 < _col0) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
@@ -2914,7 +2914,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col3
                 Statistics: Num rows: 36 Data size: 324 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col3 is null) THEN (false) ELSE (_col2 is null) END (type: boolean)
+                  expressions: _col1 (type: int), (_col2 is null and _col3 is not null) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 36 Data size: 288 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -3348,7 +3348,7 @@ STAGE PLANS:
                 outputColumnNames: _col2, _col3, _col4, _col6, _col7, _col8, _col11, _col13, _col14, _col15
                 Statistics: Num rows: 49 Data size: 1476 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col2 (type: int), (CASE WHEN (_col7) THEN (false) WHEN (_col6 is null) THEN (false) WHEN (_col11 is not null) THEN (true) WHEN (_col3) THEN (null) WHEN (_col8) THEN (null) ELSE (false) END and CASE WHEN (_col14) THEN (false) WHEN (_col13 is not null) THEN (true) WHEN (_col4) THEN (null) WHEN (_col15) THEN (null) ELSE (false) END) (type: boolean)
+                  expressions: _col2 (type: int), (((_col11 is not null and (_col7 or _col6 is null) is not true) or ((_col3 or _col8) is true and null and (_col7 or _col6 is null) is not true and _col11 is null)) and ((_col13 is not null and _col14) or ((_col4 or _col15) and null and _col14 and _col13 is null))) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 49 Data size: 392 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -3420,7 +3420,7 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                    expressions: (_col0 <> 0L) (type: boolean), (_col1 < _col0) (type: boolean)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
@@ -3721,7 +3721,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col3, _col4, _col5
                 Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (false) WHEN (_col3 is not null) THEN (true) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col0 (type: int), ((_col3 is not null and _col4) or ((_col1 or _col5) and null and _col4 and _col3 is null)) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -3802,7 +3802,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                  expressions: (_col0 <> 0L) (type: boolean), (_col1 < _col0) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
@@ -4399,7 +4399,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col3, _col4
                 Statistics: Num rows: 32 Data size: 304 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col4 is null) THEN (0) ELSE (_col3) END (type: bigint)
+                  expressions: _col1 (type: int), CASE WHEN (_col4 is null) THEN (0L) ELSE (_col3) END (type: bigint)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 32 Data size: 356 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git a/ql/src/test/results/clientpositive/llap/subquery_views.q.out b/ql/src/test/results/clientpositive/llap/subquery_views.q.out
index fbc9f5b..945ec44 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_views.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_views.q.out
@@ -281,17 +281,17 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col4, _col5, _col8
                 Statistics: Num rows: 386 Data size: 73020 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 193 Data size: 36518 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col0 is null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
+                  Statistics: Num rows: 373 Data size: 70566 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 193 Data size: 34354 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 373 Data size: 66394 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: string)
-                      Statistics: Num rows: 193 Data size: 34354 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 373 Data size: 66394 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: string)
         Reducer 4 
             Execution mode: llap
@@ -303,10 +303,10 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 193 Data size: 34354 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 373 Data size: 66394 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 193 Data size: 34354 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 373 Data size: 66394 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -379,12 +379,12 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col4, _col5, _col8
                 Statistics: Num rows: 319 Data size: 30993 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col4 = 0L)) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col8 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 159 Data size: 15453 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col5 < _col4) is not true or (_col4 = 0L) or _col4 is null or _col8 is not null or _col0 is null) and (_col0 is not null or (_col4 = 0L) or _col4 is null or _col8 is not null) and (_col8 is null or (_col4 = 0L) or _col4 is null)) (type: boolean)
+                  Statistics: Num rows: 304 Data size: 29540 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 159 Data size: 13833 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 304 Data size: 26448 Basic stats: COMPLETE Column stats: COMPLETE
                     Group By Operator
                       keys: _col0 (type: string)
                       minReductionHashAggr: 0.0
diff --git a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
index c115675..87c47cd 100644
--- a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
@@ -46,20 +46,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: (csmallint < 100S) (type: boolean)
+                  filterExpr: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (csmallint < 100S) (type: boolean)
-                    Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
+                    Statistics: Num rows: 3058 Data size: 769960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col12 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col12 (type: int)
-                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -67,10 +67,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToInteger(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToInteger(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToInteger(key) (type: int)
@@ -251,20 +251,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: (csmallint < 100S) (type: boolean)
+                  filterExpr: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (csmallint < 100S) (type: boolean)
-                    Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
+                    Statistics: Num rows: 3058 Data size: 769960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col12 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col12 (type: int)
-                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -272,10 +272,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToInteger(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToInteger(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToInteger(key) (type: int)
@@ -456,20 +456,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: (csmallint < 100S) (type: boolean)
+                  filterExpr: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (csmallint < 100S) (type: boolean)
-                    Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
+                    Statistics: Num rows: 3058 Data size: 769960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col12 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col12 (type: int)
-                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -477,10 +477,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToInteger(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToInteger(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToInteger(key) (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/tez_smb_reduce_side.q.out b/ql/src/test/results/clientpositive/llap/tez_smb_reduce_side.q.out
index 93a1716..90326ca 100644
--- a/ql/src/test/results/clientpositive/llap/tez_smb_reduce_side.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_smb_reduce_side.q.out
@@ -697,15 +697,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col2, _col3, _col5
                 Statistics: Num rows: 5 Data size: 72 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col2 = 0L)) THEN (true) WHEN (_col2 is null) THEN (true) WHEN (_col5 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col3 < _col2)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 2 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col3 < _col2) is not true or (_col2 = 0L) or _col2 is null or _col5 is not null or _col0 is null) and (_col0 is not null or (_col2 = 0L) or _col2 is null or _col5 is not null) and (_col5 is null or (_col2 = 0L) or _col2 is null)) (type: boolean)
+                  Statistics: Num rows: 5 Data size: 72 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -920,15 +920,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col2, _col3, _col5
                 Statistics: Num rows: 5 Data size: 72 Basic stats: COMPLETE Column stats: COMPLETE
                 Filter Operator
-                  predicate: CASE WHEN ((_col2 = 0L)) THEN (true) WHEN (_col2 is null) THEN (true) WHEN (_col5 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col3 < _col2)) THEN (false) ELSE (true) END (type: boolean)
-                  Statistics: Num rows: 2 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  predicate: (((_col3 < _col2) is not true or (_col2 = 0L) or _col2 is null or _col5 is not null or _col0 is null) and (_col0 is not null or (_col2 = 0L) or _col2 is null or _col5 is not null) and (_col5 is null or (_col2 = 0L) or _col2 is null)) (type: boolean)
+                  Statistics: Num rows: 5 Data size: 72 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
diff --git a/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out b/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
index c115675..87c47cd 100644
--- a/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
@@ -46,20 +46,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: (csmallint < 100S) (type: boolean)
+                  filterExpr: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (csmallint < 100S) (type: boolean)
-                    Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
+                    Statistics: Num rows: 3058 Data size: 769960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col12 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col12 (type: int)
-                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -67,10 +67,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToInteger(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToInteger(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToInteger(key) (type: int)
@@ -251,20 +251,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: (csmallint < 100S) (type: boolean)
+                  filterExpr: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (csmallint < 100S) (type: boolean)
-                    Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
+                    Statistics: Num rows: 3058 Data size: 769960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col12 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col12 (type: int)
-                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -272,10 +272,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToInteger(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToInteger(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToInteger(key) (type: int)
@@ -456,20 +456,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: (csmallint < 100S) (type: boolean)
+                  filterExpr: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (csmallint < 100S) (type: boolean)
-                    Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                    predicate: ((csmallint < 100S) and UDFToInteger(csmallint) is not null) (type: boolean)
+                    Statistics: Num rows: 3058 Data size: 769960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col12 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col12 (type: int)
-                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 3058 Data size: 779096 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -477,10 +477,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  filterExpr: key is not null (type: boolean)
+                  filterExpr: UDFToInteger(key) is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: key is not null (type: boolean)
+                    predicate: UDFToInteger(key) is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToInteger(key) (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out b/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
index 3d6fe20..2c6163b 100644
--- a/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
@@ -3832,6 +3832,19 @@ POSTHOOK: Input: default@dst_union22_delta_n0@ds=1
 POSTHOOK: Input: default@dst_union22_n0
 POSTHOOK: Input: default@dst_union22_n0@ds=1
 POSTHOOK: Output: default@dst_union22_n0@ds=2
+OPTIMIZED SQL: SELECT `k1`, `k2`, `k3`, `k4`
+FROM (SELECT `k1`, `k2`, `k3`, `k4`
+FROM `default`.`dst_union22_delta_n0`
+WHERE `ds` = '1' AND `k0` <= 50
+UNION ALL
+SELECT `t2`.`k1`, `t2`.`k2`, `t4`.`k3`, `t4`.`k4`
+FROM (SELECT `k1`, `k2`, `ds` = '1' AS `=`
+FROM `default`.`dst_union22_n0`
+WHERE `k1` > 20) AS `t2`
+LEFT JOIN (SELECT `k1`, `k3`, `k4`
+FROM `default`.`dst_union22_delta_n0`
+WHERE `ds` = '1' AND `k0` > 50 AND `k1` > 20) AS `t4` ON `t2`.`k1` = `t4`.`k1` AND `t2`.`=`)
+GROUP BY `k1`, `k2`, `k3`, `k4`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/llap/vector_adaptor_usage_mode.q.out b/ql/src/test/results/clientpositive/llap/vector_adaptor_usage_mode.q.out
index 93c7e5a..4a1a1e5 100644
--- a/ql/src/test/results/clientpositive/llap/vector_adaptor_usage_mode.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_adaptor_usage_mode.q.out
@@ -790,7 +790,7 @@ STAGE PLANS:
                 enabled: true
                 enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
-                notVectorizedReason: SELECT operator: Could not vectorize expression (mode = PROJECTION): GenericUDFBridge ==> log (Column[value], Const decimal(20,10) 10) because hive.vectorized.adaptor.usage.mode=none
+                notVectorizedReason: SELECT operator: Could not vectorize expression (mode = PROJECTION): GenericUDFBridge ==> log (Column[value], Const decimal(2,0) 10) because hive.vectorized.adaptor.usage.mode=none
                 vectorized: false
 
   Stage: Stage-0
@@ -972,7 +972,7 @@ STAGE PLANS:
                 enabled: true
                 enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
-                notVectorizedReason: SELECT operator: Could not vectorize expression (mode = PROJECTION): GenericUDFBridge ==> log (Column[value], Const decimal(20,10) 10) because hive.vectorized.adaptor.usage.mode=chosen and the UDF wasn't one of the chosen ones
+                notVectorizedReason: SELECT operator: Could not vectorize expression (mode = PROJECTION): GenericUDFBridge ==> log (Column[value], Const decimal(2,0) 10) because hive.vectorized.adaptor.usage.mode=chosen and the UDF wasn't one of the chosen ones
                 vectorized: false
 
   Stage: Stage-0
diff --git a/ql/src/test/results/clientpositive/llap/vector_case_when_1.q.out b/ql/src/test/results/clientpositive/llap/vector_case_when_1.q.out
index 6529758..08200b4 100644
--- a/ql/src/test/results/clientpositive/llap/vector_case_when_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_case_when_1.q.out
@@ -209,13 +209,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:l_orderkey:int, 1:l_partkey:int, 2:l_suppkey:int, 3:l_linenumber:int, 4:l_quantity:int, 5:l_extendedprice:double, 6:l_discount:double, 7:l_tax:decimal(10,2)/DECIMAL_64, 8:l_returnflag:char(1), 9:l_linestatus:char(1), 10:l_shipdate:date, 11:l_commitdate:date, 12:l_receiptdate:date, 13:l_shipinstruct:varchar(20), 14:l_shipmode:char(10), 15:l_comment:string, 16:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: l_quantity (type: int), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE (null) END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Sing [...]
+                    expressions: l_quantity (type: int), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE (null) END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Sing [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [4, 21, 26, 31, 35, 39, 43, 45, 47, 49, 51, 53, 55, 59, 62, 65, 68]
-                        selectExpressions: VectorUDFAdaptor(CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, LongColLessLongScalar(col 4:int, val 100) -> 20:boolean) -> 21:stri [...]
+                        projectedOutputColumnNums: [4, 21, 26, 30, 34, 38, 42, 44, 46, 48, 50, 52, 54, 58, 61, 64, 67]
+                        selectExpressions: VectorUDFAdaptor(CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, LongColLessLongScalar(col 4:int, val 100) -> 20:boolean) -> 21:stri [...]
                     Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
@@ -243,7 +243,7 @@ STAGE PLANS:
                     includeColumns: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14]
                     dataColumns: l_orderkey:int, l_partkey:int, l_suppkey:int, l_linenumber:int, l_quantity:int, l_extendedprice:double, l_discount:double, l_tax:decimal(10,2)/DECIMAL_64, l_returnflag:char(1), l_linestatus:char(1), l_shipdate:date, l_commitdate:date, l_receiptdate:date, l_shipinstruct:varchar(20), l_shipmode:char(10), l_comment:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, double, double, double, bigint, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint [...]
+                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, double, double, double, bigint, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint [...]
 
   Stage: Stage-0
     Fetch Operator
@@ -546,13 +546,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:l_orderkey:int, 1:l_partkey:int, 2:l_suppkey:int, 3:l_linenumber:int, 4:l_quantity:int, 5:l_extendedprice:double, 6:l_discount:double, 7:l_tax:decimal(10,2)/DECIMAL_64, 8:l_returnflag:char(1), 9:l_linestatus:char(1), 10:l_shipdate:date, 11:l_commitdate:date, 12:l_receiptdate:date, 13:l_shipinstruct:varchar(20), 14:l_shipmode:char(10), 15:l_comment:string, 16:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: l_quantity (type: int), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE (null) END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Sing [...]
+                    expressions: l_quantity (type: int), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE (null) END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Sing [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
                         projectedOutputColumnNums: [4, 24, 33, 40, 44, 49, 53, 55, 57, 59, 61, 63, 65, 69, 72, 75, 78]
-                        selectExpressions: IfExprStringScalarStringGroupColumn(col 17:boolean, val Singlecol 23:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, IfExprStringScalarStringGroupColumn(col 18:boolean, val Twocol 22:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, IfExprStringScalarStringGroupColumn(col 19:boolean, val Somecol 21:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, IfExprStringScalarStringS [...]
+                        selectExpressions: IfExprStringScalarStringGroupColumn(col 17:boolean, val Singlecol 23:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, IfExprStringScalarStringGroupColumn(col 18:boolean, val Twocol 22:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, IfExprStringScalarStringGroupColumn(col 19:boolean, val Somecol 21:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, IfExprStringScalarStringS [...]
                     Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
@@ -883,13 +883,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:l_orderkey:int, 1:l_partkey:int, 2:l_suppkey:int, 3:l_linenumber:int, 4:l_quantity:int, 5:l_extendedprice:double, 6:l_discount:double, 7:l_tax:decimal(10,2)/DECIMAL_64, 8:l_returnflag:char(1), 9:l_linestatus:char(1), 10:l_shipdate:date, 11:l_commitdate:date, 12:l_receiptdate:date, 13:l_shipinstruct:varchar(20), 14:l_shipmode:char(10), 15:l_comment:string, 16:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: l_quantity (type: int), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE (null) END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Sing [...]
+                    expressions: l_quantity (type: int), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE ('Huge number') END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Single') WHEN ((l_quantity = 2)) THEN ('Two') WHEN ((l_quantity < 10)) THEN ('Some') WHEN ((l_quantity < 100)) THEN ('Many') ELSE (null) END (type: string), CASE WHEN ((l_quantity = 1)) THEN ('Sing [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [4, 27, 39, 49, 53, 58, 63, 65, 67, 72, 77, 79, 81, 85, 88, 91, 94]
-                        selectExpressions: IfExprColumnCondExpr(col 17:boolean, col 18:stringcol 26:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, ConstantVectorExpression(val Single) -> 18:string, IfExprColumnCondExpr(col 19:boolean, col 20:stringcol 25:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 19:boolean, ConstantVectorExpression(val Two) -> 20:string, IfExprColumnCondExpr(col 21:boolean, col 22:stringcol 24:string)(children: LongColLessLo [...]
+                        projectedOutputColumnNums: [4, 27, 39, 48, 52, 57, 62, 64, 66, 71, 76, 78, 80, 84, 87, 90, 93]
+                        selectExpressions: IfExprColumnCondExpr(col 17:boolean, col 18:stringcol 26:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, ConstantVectorExpression(val Single) -> 18:string, IfExprColumnCondExpr(col 19:boolean, col 20:stringcol 25:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 19:boolean, ConstantVectorExpression(val Two) -> 20:string, IfExprColumnCondExpr(col 21:boolean, col 22:stringcol 24:string)(children: LongColLessLo [...]
                     Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
@@ -917,7 +917,7 @@ STAGE PLANS:
                     includeColumns: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14]
                     dataColumns: l_orderkey:int, l_partkey:int, l_suppkey:int, l_linenumber:int, l_quantity:int, l_extendedprice:double, l_discount:double, l_tax:decimal(10,2)/DECIMAL_64, l_returnflag:char(1), l_linestatus:char(1), l_shipdate:date, l_commitdate:date, l_receiptdate:date, l_shipinstruct:varchar(20), l_shipmode:char(10), l_comment:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, double, bigint, double, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, bigint, decimal(1 [...]
+                    scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, double, bigint, double, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, bigint, decimal(12,2), bi [...]
 
   Stage: Stage-0
     Fetch Operator
diff --git a/ql/src/test/results/clientpositive/llap/vector_case_when_2.q.out b/ql/src/test/results/clientpositive/llap/vector_case_when_2.q.out
index 218a5cf..d7a7c2f 100644
--- a/ql/src/test/results/clientpositive/llap/vector_case_when_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_case_when_2.q.out
@@ -144,13 +144,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:cdate:date, 1:ctimestamp1:timestamp, 2:stimestamp1:string, 3:ctimestamp2:timestamp, 4:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END (type: strin [...]
+                    expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END (type: strin [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [1, 3, 9, 14, 19, 23, 25, 28, 33, 39, 2]
-                        selectExpressions: VectorUDFAdaptor(CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END)(children: TimestampColLessEqualTimestampScalar [...]
+                        projectedOutputColumnNums: [1, 3, 9, 14, 18, 22, 24, 27, 32, 38, 2]
+                        selectExpressions: VectorUDFAdaptor(CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END)(children: TimestampColLessEqualTimestampScalar [...]
                     Statistics: Num rows: 51 Data size: 50745 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: timestamp), _col10 (type: string), _col1 (type: timestamp)
@@ -160,7 +160,7 @@ STAGE PLANS:
                           keyColumns: 1:timestamp, 2:string, 3:timestamp
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          valueColumns: 9:string, 14:string, 19:string, 23:int, 25:string, 28:int, 33:int, 39:date
+                          valueColumns: 9:string, 14:string, 18:string, 22:int, 24:string, 27:int, 32:int, 38:date
                       Statistics: Num rows: 51 Data size: 50745 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: int), _col8 (type: int), _col9 (type: date)
             Execution mode: vectorized, llap
@@ -179,7 +179,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2, 3]
                     dataColumns: cdate:date, ctimestamp1:timestamp, stimestamp1:string, ctimestamp2:timestamp
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, double, double, bigint, bigint, bigint, bigint]
+                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, double, double, bigint, bigint, bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -433,13 +433,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:cdate:date, 1:ctimestamp1:timestamp, 2:stimestamp1:string, 3:ctimestamp2:timestamp, 4:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END (type: strin [...]
+                    expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END (type: strin [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
                         projectedOutputColumnNums: [1, 3, 12, 21, 28, 32, 34, 37, 42, 48, 2]
-                        selectExpressions: IfExprStringScalarStringGroupColumn(col 5:boolean, val 1800s or Earliercol 11:string)(children: TimestampColLessEqualTimestampScalar(col 3:timestamp, val 1800-12-31 00:00:00) -> 5:boolean, IfExprStringScalarStringGroupColumn(col 6:boolean, val 1900scol 10:string)(children: TimestampColLessTimestampScalar(col 3:timestamp, val 1900-01-01 00:00:00) -> 6:boolean, IfExprStringScalarStringGroupColumn(col 7:boolean, val Late 2000scol 9:string)(children [...]
+                        selectExpressions: IfExprStringScalarStringGroupColumn(col 5:boolean, val 1800s or Earliercol 11:string)(children: TimestampColLessEqualTimestampScalar(col 3:timestamp, val 1800-12-31 00:00:00) -> 5:boolean, IfExprStringScalarStringGroupColumn(col 6:boolean, val 1900scol 10:string)(children: TimestampColLessTimestampScalar(col 3:timestamp, val 1900-01-01 00:00:00) -> 6:boolean, IfExprStringScalarStringGroupColumn(col 7:boolean, val Late 2000scol 9:string)(children [...]
                     Statistics: Num rows: 51 Data size: 50745 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: timestamp), _col10 (type: string), _col1 (type: timestamp)
@@ -722,13 +722,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:cdate:date, 1:ctimestamp1:timestamp, 2:stimestamp1:string, 3:ctimestamp2:timestamp, 4:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END (type: strin [...]
+                    expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), CASE WHEN ((ctimestamp2 <= TIMESTAMP'1800-12-31 00:00:00')) THEN ('1800s or Earlier') WHEN ((ctimestamp2 < TIMESTAMP'1900-01-01 00:00:00')) THEN ('1900s') WHEN (ctimestamp2 BETWEEN TIMESTAMP'2006-01-01 00:00:00' AND TIMESTAMP'2010-12-31 23:59:59.999999999') THEN ('Late 2000s') WHEN ((ctimestamp2 <= TIMESTAMP'2015-12-31 23:59:59.999999999')) THEN ('Early 2010s') ELSE ('Unknown') END (type: strin [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [1, 3, 15, 27, 37, 41, 43, 46, 51, 57, 2]
-                        selectExpressions: IfExprColumnCondExpr(col 5:boolean, col 6:stringcol 14:string)(children: TimestampColLessEqualTimestampScalar(col 3:timestamp, val 1800-12-31 00:00:00) -> 5:boolean, ConstantVectorExpression(val 1800s or Earlier) -> 6:string, IfExprColumnCondExpr(col 7:boolean, col 8:stringcol 13:string)(children: TimestampColLessTimestampScalar(col 3:timestamp, val 1900-01-01 00:00:00) -> 7:boolean, ConstantVectorExpression(val 1900s) -> 8:string, IfExprColumnC [...]
+                        projectedOutputColumnNums: [1, 3, 15, 27, 36, 40, 42, 45, 50, 56, 2]
+                        selectExpressions: IfExprColumnCondExpr(col 5:boolean, col 6:stringcol 14:string)(children: TimestampColLessEqualTimestampScalar(col 3:timestamp, val 1800-12-31 00:00:00) -> 5:boolean, ConstantVectorExpression(val 1800s or Earlier) -> 6:string, IfExprColumnCondExpr(col 7:boolean, col 8:stringcol 13:string)(children: TimestampColLessTimestampScalar(col 3:timestamp, val 1900-01-01 00:00:00) -> 7:boolean, ConstantVectorExpression(val 1900s) -> 8:string, IfExprColumnC [...]
                     Statistics: Num rows: 51 Data size: 50745 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: timestamp), _col10 (type: string), _col1 (type: timestamp)
@@ -738,7 +738,7 @@ STAGE PLANS:
                           keyColumns: 1:timestamp, 2:string, 3:timestamp
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          valueColumns: 15:string, 27:string, 37:string, 41:int, 43:string, 46:int, 51:int, 57:date
+                          valueColumns: 15:string, 27:string, 36:string, 40:int, 42:string, 45:int, 50:int, 56:date
                       Statistics: Num rows: 51 Data size: 50745 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: int), _col8 (type: int), _col9 (type: date)
             Execution mode: vectorized, llap
@@ -757,7 +757,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2, 3]
                     dataColumns: cdate:date, ctimestamp1:timestamp, stimestamp1:string, ctimestamp2:timestamp
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, double, double, bigint, bigint, bigint, bigint]
+                    scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, double, double, bigint, bigint, bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
diff --git a/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out b/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
index d6f01ae..6ece71e 100644
--- a/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
@@ -507,7 +507,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: c2 is not null (type: boolean)
+                  filterExpr: CAST( c2 AS STRING) is not null (type: boolean)
                   Statistics: Num rows: 3 Data size: 273 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -515,8 +515,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: SelectColumnIsNotNull(col 1:char(10))
-                    predicate: c2 is not null (type: boolean)
+                        predicateExpression: SelectColumnIsNotNull(col 1:string)(children: col 1:char(10))
+                    predicate: CAST( c2 AS STRING) is not null (type: boolean)
                     Statistics: Num rows: 3 Data size: 273 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: c1 (type: int), c2 (type: char(10)), CAST( c2 AS STRING) (type: string)
diff --git a/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out b/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
index 493cfca..0a34149 100644
--- a/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
@@ -162,13 +162,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:member:bigint, 1:attr:bigint, 2:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: member (type: bigint), CASE WHEN (CASE WHEN (attr is not null) THEN ((attr > 1L)) ELSE (true) END) THEN (attr) ELSE (null) END (type: bigint)
+                    expressions: member (type: bigint), CASE WHEN (((attr > 1L) or attr is null)) THEN (attr) ELSE (null) END (type: bigint)
                     outputColumnNames: _col0, _col1
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 7]
-                        selectExpressions: IfExprColumnNull(col 6:boolean, col 1:bigint, null)(children: IfExprCondExprColumn(col 3:boolean, col 4:boolean, col 5:boolean)(children: IsNotNull(col 1:bigint) -> 3:boolean, LongColGreaterLongScalar(col 1:bigint, val 1) -> 4:boolean, ConstantVectorExpression(val 1) -> 5:boolean) -> 6:boolean, col 1:bigint) -> 7:bigint
+                        projectedOutputColumnNums: [0, 6]
+                        selectExpressions: IfExprColumnNull(col 5:boolean, col 1:bigint, null)(children: ColOrCol(col 3:boolean, col 4:boolean)(children: LongColGreaterLongScalar(col 1:bigint, val 1) -> 3:boolean, IsNull(col 1:bigint) -> 4:boolean) -> 5:boolean, col 1:bigint) -> 6:bigint
                     Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: bigint)
@@ -179,7 +179,7 @@ STAGE PLANS:
                           keyColumns: 0:bigint
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          valueColumns: 7:bigint
+                          valueColumns: 6:bigint
                       Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
@@ -198,7 +198,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: member:bigint, attr:bigint
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint]
+                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint]
 
   Stage: Stage-0
     Fetch Operator
diff --git a/ql/src/test/results/clientpositive/llap/vector_date_1.q.out b/ql/src/test/results/clientpositive/llap/vector_date_1.q.out
index e79a7b7..399d566 100644
--- a/ql/src/test/results/clientpositive/llap/vector_date_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_date_1.q.out
@@ -119,13 +119,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:dt1:date, 1:dt2:date, 2:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: dt1 (type: date), dt2 (type: date), (dt1 = dt1) (type: boolean), (dt1 <> dt2) (type: boolean), (dt1 <= dt1) (type: boolean), (dt1 <= dt2) (type: boolean), (dt1 < dt2) (type: boolean), (dt2 >= dt2) (type: boolean), (dt2 >= dt1) (type: boolean), (dt2 > dt1) (type: boolean)
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                    expressions: dt1 (type: date), dt2 (type: date), (null or dt1 is not null) (type: boolean), (dt1 <> dt2) (type: boolean), (dt1 <= dt2) (type: boolean), (dt1 < dt2) (type: boolean), (null or dt2 is not null) (type: boolean), (dt2 >= dt1) (type: boolean), (dt2 > dt1) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col8, _col9
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 3, 4, 5, 6, 7, 8, 9, 10]
-                        selectExpressions: LongColEqualLongColumn(col 0:date, col 0:date) -> 3:boolean, LongColNotEqualLongColumn(col 0:date, col 1:date) -> 4:boolean, LongColLessEqualLongColumn(col 0:date, col 0:date) -> 5:boolean, LongColLessEqualLongColumn(col 0:date, col 1:date) -> 6:boolean, LongColLessLongColumn(col 0:date, col 1:date) -> 7:boolean, LongColGreaterEqualLongColumn(col 1:date, col 1:date) -> 8:boolean, LongColGreaterEqualLongColumn(col 1:date, col 0:date) -> 9:boolean [...]
+                        projectedOutputColumnNums: [0, 1, 4, 5, 6, 7, 9, 10, 11]
+                        selectExpressions: VectorUDFAdaptor((null or dt1 is not null))(children: IsNotNull(col 0:date) -> 3:boolean) -> 4:boolean, LongColNotEqualLongColumn(col 0:date, col 1:date) -> 5:boolean, LongColLessEqualLongColumn(col 0:date, col 1:date) -> 6:boolean, LongColLessLongColumn(col 0:date, col 1:date) -> 7:boolean, VectorUDFAdaptor((null or dt2 is not null))(children: IsNotNull(col 1:date) -> 8:boolean) -> 9:boolean, LongColGreaterEqualLongColumn(col 1:date, col 0:date [...]
                     Statistics: Num rows: 3 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: date)
@@ -135,9 +135,9 @@ STAGE PLANS:
                           keyColumns: 0:date
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          valueColumns: 1:date, 3:boolean, 4:boolean, 5:boolean, 6:boolean, 7:boolean, 8:boolean, 9:boolean, 10:boolean
+                          valueColumns: 1:date, 4:boolean, 5:boolean, 6:boolean, 7:boolean, 9:boolean, 10:boolean, 11:boolean
                       Statistics: Num rows: 3 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: date), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean)
+                      value expressions: _col1 (type: date), _col2 (type: boolean), _col3 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -147,14 +147,14 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: true
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 2
                     includeColumns: [0, 1]
                     dataColumns: dt1:date, dt2:date
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint]
+                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -166,18 +166,18 @@ STAGE PLANS:
                 usesVectorUDFAdaptor: false
                 vectorized: true
                 rowBatchContext:
-                    dataColumnCount: 10
-                    dataColumns: KEY.reducesinkkey0:date, VALUE._col0:date, VALUE._col1:boolean, VALUE._col2:boolean, VALUE._col3:boolean, VALUE._col4:boolean, VALUE._col5:boolean, VALUE._col6:boolean, VALUE._col7:boolean, VALUE._col8:boolean
+                    dataColumnCount: 9
+                    dataColumns: KEY.reducesinkkey0:date, VALUE._col0:date, VALUE._col1:boolean, VALUE._col2:boolean, VALUE._col3:boolean, VALUE._col4:boolean, VALUE._col5:boolean, VALUE._col6:boolean, VALUE._col7:boolean
                     partitionColumnCount: 0
                     scratchColumnTypeNames: []
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey0 (type: date), VALUE._col0 (type: date), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean), VALUE._col8 (type: boolean)
+                expressions: KEY.reducesinkkey0 (type: date), VALUE._col0 (type: date), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col1 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                 Select Vectorization:
                     className: VectorSelectOperator
                     native: true
-                    projectedOutputColumnNums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+                    projectedOutputColumnNums: [0, 1, 2, 3, 2, 4, 5, 6, 7, 8]
                 Statistics: Num rows: 3 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
@@ -288,13 +288,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:dt1:date, 1:dt2:date, 2:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: dt1 (type: date), dt2 (type: date), (dt1 <> dt1) (type: boolean), (dt1 = dt2) (type: boolean), (dt1 < dt1) (type: boolean), (dt1 >= dt2) (type: boolean), (dt1 > dt2) (type: boolean), (dt2 > dt2) (type: boolean), (dt2 <= dt1) (type: boolean), (dt2 < dt1) (type: boolean)
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                    expressions: dt1 (type: date), dt2 (type: date), (null and dt1 is null) (type: boolean), (dt1 = dt2) (type: boolean), (dt1 >= dt2) (type: boolean), (dt1 > dt2) (type: boolean), (null and dt2 is null) (type: boolean), (dt2 <= dt1) (type: boolean), (dt2 < dt1) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col8, _col9
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 3, 4, 5, 6, 7, 8, 9, 10]
-                        selectExpressions: LongColNotEqualLongColumn(col 0:date, col 0:date) -> 3:boolean, LongColEqualLongColumn(col 0:date, col 1:date) -> 4:boolean, LongColLessLongColumn(col 0:date, col 0:date) -> 5:boolean, LongColGreaterEqualLongColumn(col 0:date, col 1:date) -> 6:boolean, LongColGreaterLongColumn(col 0:date, col 1:date) -> 7:boolean, LongColGreaterLongColumn(col 1:date, col 1:date) -> 8:boolean, LongColLessEqualLongColumn(col 1:date, col 0:date) -> 9:boolean, LongC [...]
+                        projectedOutputColumnNums: [0, 1, 4, 5, 6, 7, 9, 10, 11]
+                        selectExpressions: VectorUDFAdaptor((null and dt1 is null))(children: IsNull(col 0:date) -> 3:boolean) -> 4:boolean, LongColEqualLongColumn(col 0:date, col 1:date) -> 5:boolean, LongColGreaterEqualLongColumn(col 0:date, col 1:date) -> 6:boolean, LongColGreaterLongColumn(col 0:date, col 1:date) -> 7:boolean, VectorUDFAdaptor((null and dt2 is null))(children: IsNull(col 1:date) -> 8:boolean) -> 9:boolean, LongColLessEqualLongColumn(col 1:date, col 0:date) -> 10:bool [...]
                     Statistics: Num rows: 3 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: date)
@@ -304,9 +304,9 @@ STAGE PLANS:
                           keyColumns: 0:date
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          valueColumns: 1:date, 3:boolean, 4:boolean, 5:boolean, 6:boolean, 7:boolean, 8:boolean, 9:boolean, 10:boolean
+                          valueColumns: 1:date, 4:boolean, 5:boolean, 6:boolean, 7:boolean, 9:boolean, 10:boolean, 11:boolean
                       Statistics: Num rows: 3 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: date), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean)
+                      value expressions: _col1 (type: date), _col2 (type: boolean), _col3 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -316,14 +316,14 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: true
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 2
                     includeColumns: [0, 1]
                     dataColumns: dt1:date, dt2:date
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint]
+                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -335,18 +335,18 @@ STAGE PLANS:
                 usesVectorUDFAdaptor: false
                 vectorized: true
                 rowBatchContext:
-                    dataColumnCount: 10
-                    dataColumns: KEY.reducesinkkey0:date, VALUE._col0:date, VALUE._col1:boolean, VALUE._col2:boolean, VALUE._col3:boolean, VALUE._col4:boolean, VALUE._col5:boolean, VALUE._col6:boolean, VALUE._col7:boolean, VALUE._col8:boolean
+                    dataColumnCount: 9
+                    dataColumns: KEY.reducesinkkey0:date, VALUE._col0:date, VALUE._col1:boolean, VALUE._col2:boolean, VALUE._col3:boolean, VALUE._col4:boolean, VALUE._col5:boolean, VALUE._col6:boolean, VALUE._col7:boolean
                     partitionColumnCount: 0
                     scratchColumnTypeNames: []
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey0 (type: date), VALUE._col0 (type: date), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean), VALUE._col8 (type: boolean)
+                expressions: KEY.reducesinkkey0 (type: date), VALUE._col0 (type: date), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col1 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                 Select Vectorization:
                     className: VectorSelectOperator
                     native: true
-                    projectedOutputColumnNums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+                    projectedOutputColumnNums: [0, 1, 2, 3, 2, 4, 5, 6, 7, 8]
                 Statistics: Num rows: 3 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
@@ -788,7 +788,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: vector_date_1
-                  filterExpr: ((dt1 = dt1) and (dt1 <> dt2) and (dt1 < dt2) and (dt1 <= dt2) and (dt2 > dt1) and (dt2 >= dt1)) (type: boolean)
+                  filterExpr: ((dt1 <> dt2) and (dt1 < dt2) and (dt1 <= dt2) and (dt2 > dt1) and (dt2 >= dt1)) (type: boolean)
                   Statistics: Num rows: 3 Data size: 336 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -797,8 +797,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterLongColEqualLongColumn(col 0:date, col 0:date), FilterLongColNotEqualLongColumn(col 0:date, col 1:date), FilterLongColLessLongColumn(col 0:date, col 1:date), FilterLongColLessEqualLongColumn(col 0:date, col 1:date), FilterLongColGreaterLongColumn(col 1:date, col 0:date), FilterLongColGreaterEqualLongColumn(col 1:date, col 0:date))
-                    predicate: ((dt1 < dt2) and (dt1 <= dt2) and (dt1 <> dt2) and (dt1 = dt1) and (dt2 > dt1) and (dt2 >= dt1)) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: FilterLongColNotEqualLongColumn(col 0:date, col 1:date), FilterLongColLessLongColumn(col 0:date, col 1:date), FilterLongColLessEqualLongColumn(col 0:date, col 1:date), FilterLongColGreaterLongColumn(col 1:date, col 0:date), FilterLongColGreaterEqualLongColumn(col 1:date, col 0:date))
+                    predicate: ((dt1 < dt2) and (dt1 <= dt2) and (dt1 <> dt2) and (dt2 > dt1) and (dt2 >= dt1)) (type: boolean)
                     Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: dt1 (type: date), dt2 (type: date)
diff --git a/ql/src/test/results/clientpositive/llap/vector_decimal_math_funcs.q.out b/ql/src/test/results/clientpositive/llap/vector_decimal_math_funcs.q.out
index b26fb62..648eb83 100644
--- a/ql/src/test/results/clientpositive/llap/vector_decimal_math_funcs.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_decimal_math_funcs.q.out
@@ -119,7 +119,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: decimal_test_n0
-                  filterExpr: (((cbigint % 500) = 0) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
+                  filterExpr: (((cbigint % 500L) = 0L) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
                   Statistics: Num rows: 12289 Data size: 1100992 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -129,7 +129,7 @@ STAGE PLANS:
                         className: VectorFilterOperator
                         native: true
                         predicateExpression: FilterExprAndExpr(children: FilterLongColEqualLongScalar(col 5:bigint, val 0)(children: LongColModuloLongScalar(col 0:bigint, val 500) -> 5:bigint), FilterDoubleColGreaterEqualDoubleScalar(col 7:double, val -1.0)(children: FuncSinDoubleToDouble(col 6:double)(children: CastDecimalToDouble(col 2:decimal(20,10)) -> 6:double) -> 7:double))
-                    predicate: (((cbigint % 500) = 0) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
+                    predicate: (((cbigint % 500L) = 0L) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
                     Statistics: Num rows: 2048 Data size: 183600 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cdecimal1 (type: decimal(20,10)), round(cdecimal1, 2) (type: decimal(13,2)), round(cdecimal1) (type: decimal(11,0)), floor(cdecimal1) (type: decimal(11,0)), ceil(cdecimal1) (type: decimal(11,0)), round(exp(cdecimal1), 58) (type: double), ln(cdecimal1) (type: double), log10(cdecimal1) (type: double), log2(cdecimal1) (type: double), log2((cdecimal1 - 15601)) (type: double), log(2, cdecimal1) (type: double), power(log2(cdecimal1), 2) (type: double), power( [...]
@@ -370,7 +370,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: decimal_test_small
-                  filterExpr: (((cbigint % 500) = 0) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
+                  filterExpr: (((cbigint % 500L) = 0L) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 1100992 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -380,7 +380,7 @@ STAGE PLANS:
                         className: VectorFilterOperator
                         native: true
                         predicateExpression: FilterExprAndExpr(children: FilterLongColEqualLongScalar(col 5:bigint, val 0)(children: LongColModuloLongScalar(col 0:bigint, val 500) -> 5:bigint), FilterDoubleColGreaterEqualDoubleScalar(col 8:double, val -1.0)(children: FuncSinDoubleToDouble(col 7:double)(children: CastDecimalToDouble(col 6:decimal(12,4))(children: ConvertDecimal64ToDecimal(col 2:decimal(12,4)/DECIMAL_64) -> 6:decimal(12,4)) -> 7:double) -> 8:double))
-                    predicate: (((cbigint % 500) = 0) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
+                    predicate: (((cbigint % 500L) = 0L) and (sin(cdecimal1) >= -1.0D)) (type: boolean)
                     Statistics: Num rows: 2048 Data size: 183600 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cdecimal1 (type: decimal(12,4)), round(cdecimal1, 2) (type: decimal(11,2)), round(cdecimal1) (type: decimal(9,0)), floor(cdecimal1) (type: decimal(9,0)), ceil(cdecimal1) (type: decimal(9,0)), round(exp(cdecimal1), 58) (type: double), ln(cdecimal1) (type: double), log10(cdecimal1) (type: double), log2(cdecimal1) (type: double), log2((cdecimal1 - 15601)) (type: double), log(2, cdecimal1) (type: double), power(log2(cdecimal1), 2) (type: double), power(log2 [...]
diff --git a/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_grouping.q.out b/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_grouping.q.out
index 16fe26f..d1c270e 100644
--- a/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_grouping.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_grouping.q.out
@@ -143,7 +143,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 9 Data size: 136 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1) (type: bigint), grouping(_col2, 0) (type: bigint)
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Select Vectorization:
                       className: VectorSelectOperator
@@ -308,7 +308,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 12 Data size: 180 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1) (type: bigint), grouping(_col2, 0) (type: bigint)
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Select Vectorization:
                       className: VectorSelectOperator
@@ -484,7 +484,7 @@ STAGE PLANS:
                       className: VectorFilterOperator
                       native: true
                       predicateExpression: FilterLongColEqualLongScalar(col 3:bigint, val 1)(children: GroupingColumn(col 2, mask 2) -> 3:bigint)
-                  predicate: (grouping(_col2, 1) = 1) (type: boolean)
+                  predicate: (grouping(_col2, 1L) = 1L) (type: boolean)
                   Statistics: Num rows: 6 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int)
@@ -657,10 +657,10 @@ STAGE PLANS:
                       className: VectorFilterOperator
                       native: true
                       predicateExpression: FilterExprOrExpr(children: FilterLongColEqualLongScalar(col 3:bigint, val 1)(children: GroupingColumn(col 2, mask 2) -> 3:bigint), FilterLongColEqualLongScalar(col 4:bigint, val 1)(children: GroupingColumn(col 2, mask 1) -> 4:bigint))
-                  predicate: ((grouping(_col2, 0) = 1) or (grouping(_col2, 1) = 1)) (type: boolean)
+                  predicate: ((grouping(_col2, 0L) = 1L) or (grouping(_col2, 1L) = 1L)) (type: boolean)
                   Statistics: Num rows: 12 Data size: 180 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: _col0 (type: int), _col1 (type: int), (grouping(_col2, 1) + grouping(_col2, 0)) (type: bigint), CASE WHEN (((grouping(_col2, 1) + grouping(_col2, 0)) = 1)) THEN (_col0) ELSE (null) END (type: int)
+                    expressions: _col0 (type: int), _col1 (type: int), (grouping(_col2, 1L) + grouping(_col2, 0L)) (type: bigint), CASE WHEN (((grouping(_col2, 1L) + grouping(_col2, 0L)) = 1L)) THEN (_col0) ELSE (null) END (type: int)
                     outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
diff --git a/ql/src/test/results/clientpositive/llap/vector_groupby_mapjoin.q.out b/ql/src/test/results/clientpositive/llap/vector_groupby_mapjoin.q.out
index 229814f..258545b 100644
--- a/ql/src/test/results/clientpositive/llap/vector_groupby_mapjoin.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_groupby_mapjoin.q.out
@@ -93,8 +93,8 @@ STAGE PLANS:
                             Filter Vectorization:
                                 className: VectorFilterOperator
                                 native: true
-                                predicateExpression: FilterExprOrExpr(children: FilterLongColEqualLongScalar(col 4:bigint, val 0), FilterExprAndExpr(children: SelectColumnIsNull(col 3:boolean), SelectColumnIsNotNull(col 0:string), FilterLongColGreaterEqualLongColumn(col 5:bigint, col 4:bigint)))
-                            predicate: ((_col2 = 0L) or (_col5 is null and _col0 is not null and (_col3 >= _col2))) (type: boolean)
+                                predicateExpression: FilterExprAndExpr(children: FilterExprOrExpr(children: SelectColumnIsNull(col 3:boolean), FilterLongColEqualLongScalar(col 4:bigint, val 0)), FilterExprOrExpr(children: SelectColumnIsNotNull(col 0:string), FilterLongColEqualLongScalar(col 4:bigint, val 0), SelectColumnIsNotNull(col 3:boolean)), FilterExprOrExpr(children: FilterLongColGreaterEqualLongColumn(col 5:bigint, col 4:bigint), FilterLongColEqualLongScalar(col 4:bigint, val 0),  [...]
+                            predicate: (((_col3 >= _col2) or (_col2 = 0L) or _col5 is not null or _col0 is null) and (_col0 is not null or (_col2 = 0L) or _col5 is not null) and (_col5 is null or (_col2 = 0L))) (type: boolean)
                             Statistics: Num rows: 895 Data size: 175214 Basic stats: COMPLETE Column stats: COMPLETE
                             Select Operator
                               expressions: _col0 (type: string), _col1 (type: string)
diff --git a/ql/src/test/results/clientpositive/llap/vector_interval_2.q.out b/ql/src/test/results/clientpositive/llap/vector_interval_2.q.out
index 28da504..4ba6719 100644
--- a/ql/src/test/results/clientpositive/llap/vector_interval_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_interval_2.q.out
@@ -134,13 +134,13 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: str1 (type: string), (CAST( str1 AS INTERVAL YEAR TO MONTH) = CAST( str1 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str1 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) < CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) >= CAST(  [...]
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
+                    expressions: str1 (type: string), (null or CAST( str1 AS INTERVAL YEAR TO MONTH) is not null) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) < CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str2 AS INTERVAL YEAR TO MONTH) >= CAST( str1 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str2 AS INTERVAL YEAR TO MONTH) > CAST( str1 AS INTERVAL YEAR [...]
+                    outputColumnNames: _col0, _col1, _col3, _col4, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [2, 9, 12, 15, 18, 21, 24, 27, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62]
-                        selectExpressions: LongColEqualLongColumn(col 7:interval_year_month, col 8:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 7:interval_year_month, CastStringToIntervalYearMonth(col 2:string) -> 8:interval_year_month) -> 9:boolean, LongColLessEqualLongColumn(col 10:interval_year_month, col 11:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 10:interval_year_month, CastStringToIntervalYearMonth(col 2:string)  [...]
+                        projectedOutputColumnNums: [2, 9, 12, 15, 18, 21, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56]
+                        selectExpressions: VectorUDFAdaptor((null or CAST( str1 AS INTERVAL YEAR TO MONTH) is not null))(children: IsNotNull(col 7:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 7:interval_year_month) -> 8:boolean) -> 9:boolean, LongColLessEqualLongColumn(col 10:interval_year_month, col 11:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 10:interval_year_month, CastStringToIntervalYearMonth(col 3:string) -> 11:in [...]
                     Statistics: Num rows: 2 Data size: 366 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
@@ -150,7 +150,7 @@ STAGE PLANS:
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                       Statistics: Num rows: 2 Data size: 366 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col19 (type: boolean), _col [...]
+                      value expressions: _col1 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col19 (type: boolean), _col20 (type: boolean), _col21 (type: boolean), _c [...]
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -160,7 +160,7 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: true
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized, llap
@@ -172,12 +172,12 @@ STAGE PLANS:
                 vectorized: true
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: boolean), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean), VALUE._col8 (type: boolean), VALUE._col9 (type: boolean), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean), VALUE._col12 (type: boolean), VALUE._col13 (type: boolean), VALUE._col14 (type [...]
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: boolean), VALUE._col0 (type: boolean), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col0 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean), VALUE._col8 (type: boolean), VALUE._col9 (type: boolean), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean), VALUE._col12 (type:  [...]
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
                 Select Vectorization:
                     className: VectorSelectOperator
                     native: true
-                    projectedOutputColumnNums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
+                    projectedOutputColumnNums: [0, 1, 1, 2, 3, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
                 Statistics: Num rows: 2 Data size: 366 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
@@ -344,13 +344,13 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: str1 (type: string), (CAST( str1 AS INTERVAL YEAR TO MONTH) <> CAST( str1 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) >= CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) > CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str2 AS INTERVAL YEAR TO MONTH) <= CAST( str1 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str2 AS INTERVAL YEAR TO MONTH) < CAST(  [...]
+                    expressions: str1 (type: string), (null and CAST( str1 AS INTERVAL YEAR TO MONTH) is null) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) >= CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str1 AS INTERVAL YEAR TO MONTH) > CAST( str2 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str2 AS INTERVAL YEAR TO MONTH) <= CAST( str1 AS INTERVAL YEAR TO MONTH)) (type: boolean), (CAST( str2 AS INTERVAL YEAR TO MONTH) < CAST( str1 AS INTERVAL YEAR TO [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col13, _col14, _col15, _col16, _col17
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
                         projectedOutputColumnNums: [2, 9, 12, 15, 18, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]
-                        selectExpressions: LongColNotEqualLongColumn(col 7:interval_year_month, col 8:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 7:interval_year_month, CastStringToIntervalYearMonth(col 2:string) -> 8:interval_year_month) -> 9:boolean, LongColGreaterEqualLongColumn(col 10:interval_year_month, col 11:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 10:interval_year_month, CastStringToIntervalYearMonth(col 3:st [...]
+                        selectExpressions: VectorUDFAdaptor((null and CAST( str1 AS INTERVAL YEAR TO MONTH) is null))(children: IsNull(col 7:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 7:interval_year_month) -> 8:boolean) -> 9:boolean, LongColGreaterEqualLongColumn(col 10:interval_year_month, col 11:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 10:interval_year_month, CastStringToIntervalYearMonth(col 3:string) -> 11:inter [...]
                     Statistics: Num rows: 2 Data size: 318 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
@@ -370,7 +370,7 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: true
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized, llap
@@ -554,13 +554,13 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: str3 (type: string), (CAST( str3 AS INTERVAL DAY TO SECOND) = CAST( str3 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str3 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) < CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) >= CAST(  [...]
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
+                    expressions: str3 (type: string), (null or CAST( str3 AS INTERVAL DAY TO SECOND) is not null) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) < CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str4 AS INTERVAL DAY TO SECOND) >= CAST( str3 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str4 AS INTERVAL DAY TO SECOND) > CAST( str3 AS INTERVAL DAY  [...]
+                    outputColumnNames: _col0, _col1, _col3, _col4, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [4, 9, 12, 15, 18, 21, 24, 27, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62]
-                        selectExpressions: IntervalDayTimeColEqualIntervalDayTimeColumn(col 7:interval_day_time, col 8:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 7:interval_day_time, CastStringToIntervalDayTime(col 4:string) -> 8:interval_day_time) -> 9:boolean, IntervalDayTimeColLessEqualIntervalDayTimeColumn(col 10:interval_day_time, col 11:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 10:interval_day_time, CastStringToInterval [...]
+                        projectedOutputColumnNums: [4, 9, 12, 15, 18, 21, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56]
+                        selectExpressions: VectorUDFAdaptor((null or CAST( str3 AS INTERVAL DAY TO SECOND) is not null))(children: IsNotNull(col 7:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 7:interval_day_time) -> 8:boolean) -> 9:boolean, IntervalDayTimeColLessEqualIntervalDayTimeColumn(col 10:interval_day_time, col 11:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 10:interval_day_time, CastStringToIntervalDayTime(col 5:string) -> [...]
                     Statistics: Num rows: 2 Data size: 374 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
@@ -570,7 +570,7 @@ STAGE PLANS:
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                       Statistics: Num rows: 2 Data size: 374 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col19 (type: boolean), _col [...]
+                      value expressions: _col1 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col19 (type: boolean), _col20 (type: boolean), _col21 (type: boolean), _c [...]
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -580,7 +580,7 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: true
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized, llap
@@ -592,12 +592,12 @@ STAGE PLANS:
                 vectorized: true
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: boolean), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean), VALUE._col8 (type: boolean), VALUE._col9 (type: boolean), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean), VALUE._col12 (type: boolean), VALUE._col13 (type: boolean), VALUE._col14 (type [...]
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: boolean), VALUE._col0 (type: boolean), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col0 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean), VALUE._col8 (type: boolean), VALUE._col9 (type: boolean), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean), VALUE._col12 (type:  [...]
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
                 Select Vectorization:
                     className: VectorSelectOperator
                     native: true
-                    projectedOutputColumnNums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
+                    projectedOutputColumnNums: [0, 1, 1, 2, 3, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
                 Statistics: Num rows: 2 Data size: 374 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
@@ -764,13 +764,13 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: str3 (type: string), (CAST( str3 AS INTERVAL DAY TO SECOND) <> CAST( str3 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) >= CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) > CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str4 AS INTERVAL DAY TO SECOND) <= CAST( str3 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str4 AS INTERVAL DAY TO SECOND) < CAST(  [...]
+                    expressions: str3 (type: string), (null and CAST( str3 AS INTERVAL DAY TO SECOND) is null) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) >= CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str3 AS INTERVAL DAY TO SECOND) > CAST( str4 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str4 AS INTERVAL DAY TO SECOND) <= CAST( str3 AS INTERVAL DAY TO SECOND)) (type: boolean), (CAST( str4 AS INTERVAL DAY TO SECOND) < CAST( str3 AS INTERVAL DAY TO  [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col13, _col14, _col15, _col16, _col17
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
                         projectedOutputColumnNums: [4, 9, 12, 15, 18, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]
-                        selectExpressions: IntervalDayTimeColNotEqualIntervalDayTimeColumn(col 7:interval_day_time, col 8:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 7:interval_day_time, CastStringToIntervalDayTime(col 4:string) -> 8:interval_day_time) -> 9:boolean, IntervalDayTimeColGreaterEqualIntervalDayTimeColumn(col 10:interval_day_time, col 11:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 10:interval_day_time, CastStringToIn [...]
+                        selectExpressions: VectorUDFAdaptor((null and CAST( str3 AS INTERVAL DAY TO SECOND) is null))(children: IsNull(col 7:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 7:interval_day_time) -> 8:boolean) -> 9:boolean, IntervalDayTimeColGreaterEqualIntervalDayTimeColumn(col 10:interval_day_time, col 11:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 10:interval_day_time, CastStringToIntervalDayTime(col 5:string) -> 11 [...]
                     Statistics: Num rows: 2 Data size: 326 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
@@ -790,7 +790,7 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: true
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized, llap
@@ -956,7 +956,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: vector_interval_2
-                  filterExpr: ((CAST( str1 AS INTERVAL YEAR TO MONTH) = CAST( str1 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <> CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) < CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str2 AS INTERVAL YEAR TO MONTH) >= CAST( str1 AS INTERVAL YEAR TO MONTH)) and (CAST( str2 AS INTERVAL YEAR TO MONTH) [...]
+                  filterExpr: ((CAST( str1 AS INTERVAL YEAR TO MONTH) <> CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) < CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str2 AS INTERVAL YEAR TO MONTH) >= CAST( str1 AS INTERVAL YEAR TO MONTH)) and (CAST( str2 AS INTERVAL YEAR TO MONTH) > CAST( str1 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) [...]
                   Statistics: Num rows: 2 Data size: 428 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -964,8 +964,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterLongColEqualLongColumn(col 7:interval_year_month, col 8:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 7:interval_year_month, CastStringToIntervalYearMonth(col 2:string) -> 8:interval_year_month), FilterLongColNotEqualLongColumn(col 9:interval_year_month, col 10:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 9:interval_year_month, CastStringToInterv [...]
-                    predicate: ((CAST( str1 AS INTERVAL YEAR TO MONTH) < CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) < INTERVAL'1-3') and (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <= INTERVAL'1-3') and (CAST( str1 AS INTERVAL YEAR TO MONTH) <> CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <> INTERVAL'1-3') and (CAST( str1 AS INTERVAL  [...]
+                        predicateExpression: FilterExprAndExpr(children: FilterLongColNotEqualLongColumn(col 7:interval_year_month, col 8:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 7:interval_year_month, CastStringToIntervalYearMonth(col 3:string) -> 8:interval_year_month), FilterLongColLessEqualLongColumn(col 9:interval_year_month, col 10:interval_year_month)(children: CastStringToIntervalYearMonth(col 2:string) -> 9:interval_year_month, CastStringToIn [...]
+                    predicate: ((CAST( str1 AS INTERVAL YEAR TO MONTH) < CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) < INTERVAL'1-3') and (CAST( str1 AS INTERVAL YEAR TO MONTH) <= CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <= INTERVAL'1-3') and (CAST( str1 AS INTERVAL YEAR TO MONTH) <> CAST( str2 AS INTERVAL YEAR TO MONTH)) and (CAST( str1 AS INTERVAL YEAR TO MONTH) <> INTERVAL'1-3') and (CAST( str1 AS INTERVAL  [...]
                     Statistics: Num rows: 1 Data size: 214 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ts (type: timestamp)
@@ -1155,7 +1155,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: vector_interval_2
-                  filterExpr: ((CAST( str3 AS INTERVAL DAY TO SECOND) = CAST( str3 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <> CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) < CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str4 AS INTERVAL DAY TO SECOND) >= CAST( str3 AS INTERVAL DAY TO SECOND)) and (CAST( str4 AS INTERVAL DAY TO SECOND) [...]
+                  filterExpr: ((CAST( str3 AS INTERVAL DAY TO SECOND) <> CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) < CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str4 AS INTERVAL DAY TO SECOND) >= CAST( str3 AS INTERVAL DAY TO SECOND)) and (CAST( str4 AS INTERVAL DAY TO SECOND) > CAST( str3 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) [...]
                   Statistics: Num rows: 2 Data size: 444 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -1163,8 +1163,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterIntervalDayTimeColEqualIntervalDayTimeColumn(col 7:interval_day_time, col 8:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 7:interval_day_time, CastStringToIntervalDayTime(col 4:string) -> 8:interval_day_time), FilterIntervalDayTimeColNotEqualIntervalDayTimeColumn(col 9:interval_day_time, col 10:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 9:interval_day_ [...]
-                    predicate: ((CAST( str3 AS INTERVAL DAY TO SECOND) < CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) < INTERVAL'1 02:03:05.000000000') and (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <= INTERVAL'1 02:03:05.000000000') and (CAST( str3 AS INTERVAL DAY TO SECOND) <> CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <> INTERVAL' [...]
+                        predicateExpression: FilterExprAndExpr(children: FilterIntervalDayTimeColNotEqualIntervalDayTimeColumn(col 7:interval_day_time, col 8:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 7:interval_day_time, CastStringToIntervalDayTime(col 5:string) -> 8:interval_day_time), FilterIntervalDayTimeColLessEqualIntervalDayTimeColumn(col 9:interval_day_time, col 10:interval_day_time)(children: CastStringToIntervalDayTime(col 4:string) -> 9:interval_ [...]
+                    predicate: ((CAST( str3 AS INTERVAL DAY TO SECOND) < CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) < INTERVAL'1 02:03:05.000000000') and (CAST( str3 AS INTERVAL DAY TO SECOND) <= CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <= INTERVAL'1 02:03:05.000000000') and (CAST( str3 AS INTERVAL DAY TO SECOND) <> CAST( str4 AS INTERVAL DAY TO SECOND)) and (CAST( str3 AS INTERVAL DAY TO SECOND) <> INTERVAL' [...]
                     Statistics: Num rows: 1 Data size: 222 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ts (type: timestamp)
diff --git a/ql/src/test/results/clientpositive/llap/vector_interval_mapjoin.q.out b/ql/src/test/results/clientpositive/llap/vector_interval_mapjoin.q.out
index abf998e..6d4d105 100644
--- a/ql/src/test/results/clientpositive/llap/vector_interval_mapjoin.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_interval_mapjoin.q.out
@@ -206,7 +206,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: vectortab_a_1korc
-                  filterExpr: (dt is not null and ts is not null and s is not null) (type: boolean)
+                  filterExpr: (dt is not null and CAST( ts AS DATE) is not null and s is not null) (type: boolean)
                   Statistics: Num rows: 1000 Data size: 187480 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -214,8 +214,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: SelectColumnIsNotNull(col 12:date), SelectColumnIsNotNull(col 10:timestamp), SelectColumnIsNotNull(col 8:string))
-                    predicate: (dt is not null and s is not null and ts is not null) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: SelectColumnIsNotNull(col 12:date), SelectColumnIsNotNull(col 14:date)(children: CastTimestampToDate(col 10:timestamp) -> 14:date), SelectColumnIsNotNull(col 8:string))
+                    predicate: (CAST( ts AS DATE) is not null and dt is not null and s is not null) (type: boolean)
                     Statistics: Num rows: 954 Data size: 178852 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: s (type: string), (dt - CAST( ts AS DATE)) (type: interval_day_time)
@@ -223,8 +223,8 @@ STAGE PLANS:
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [8, 15]
-                          selectExpressions: DateColSubtractDateColumn(col 12:date, col 14:date)(children: CastTimestampToDate(col 10:timestamp) -> 14:date) -> 15:interval_day_time
+                          projectedOutputColumnNums: [8, 16]
+                          selectExpressions: DateColSubtractDateColumn(col 12:date, col 15:date)(children: CastTimestampToDate(col 10:timestamp) -> 15:date) -> 16:interval_day_time
                       Statistics: Num rows: 954 Data size: 101124 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
@@ -247,7 +247,7 @@ STAGE PLANS:
                           Select Vectorization:
                               className: VectorSelectOperator
                               native: true
-                              projectedOutputColumnNums: [8, 8, 15]
+                              projectedOutputColumnNums: [8, 8, 16]
                           Statistics: Num rows: 33319 Data size: 6663800 Basic stats: COMPLETE Column stats: COMPLETE
                           File Output Operator
                             compressed: false
@@ -274,7 +274,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: vectortab_b_1korc
-                  filterExpr: (dt is not null and ts is not null and s is not null) (type: boolean)
+                  filterExpr: (dt is not null and CAST( ts AS DATE) is not null and s is not null) (type: boolean)
                   Statistics: Num rows: 1000 Data size: 186864 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -282,8 +282,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: SelectColumnIsNotNull(col 12:date), SelectColumnIsNotNull(col 10:timestamp), SelectColumnIsNotNull(col 8:string))
-                    predicate: (dt is not null and s is not null and ts is not null) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: SelectColumnIsNotNull(col 12:date), SelectColumnIsNotNull(col 14:date)(children: CastTimestampToDate(col 10:timestamp) -> 14:date), SelectColumnIsNotNull(col 8:string))
+                    predicate: (CAST( ts AS DATE) is not null and dt is not null and s is not null) (type: boolean)
                     Statistics: Num rows: 943 Data size: 176202 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: s (type: string), (dt - CAST( ts AS DATE)) (type: interval_day_time)
@@ -291,8 +291,8 @@ STAGE PLANS:
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [8, 15]
-                          selectExpressions: DateColSubtractDateColumn(col 12:date, col 14:date)(children: CastTimestampToDate(col 10:timestamp) -> 14:date) -> 15:interval_day_time
+                          projectedOutputColumnNums: [8, 16]
+                          selectExpressions: DateColSubtractDateColumn(col 12:date, col 15:date)(children: CastTimestampToDate(col 10:timestamp) -> 15:date) -> 16:interval_day_time
                       Statistics: Num rows: 943 Data size: 99958 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string), _col1 (type: interval_day_time)
diff --git a/ql/src/test/results/clientpositive/llap/vector_orc_nested_column_pruning.q.out b/ql/src/test/results/clientpositive/llap/vector_orc_nested_column_pruning.q.out
index 944a363..3f67e0b 100644
--- a/ql/src/test/results/clientpositive/llap/vector_orc_nested_column_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_orc_nested_column_pruning.q.out
@@ -599,7 +599,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: nested_tbl_1
-                  filterExpr: (s1.f1 = false) (type: boolean)
+                  filterExpr: (not s1.f1) (type: boolean)
                   Pruned Column Paths: s1.f2, s1.f1
                   Statistics: Num rows: 1 Data size: 316 Basic stats: COMPLETE Column stats: NONE
                   TableScan Vectorization:
@@ -608,8 +608,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterLongColEqualLongScalar(col 8:boolean, val 0)(children: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 0:int) -> 8:boolean)
-                    predicate: (s1.f1 = false) (type: boolean)
+                        predicateExpression: SelectColumnIsFalse(col 8:boolean)(children: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 0:int) -> 8:boolean)
+                    predicate: (not s1.f1) (type: boolean)
                     Statistics: Num rows: 1 Data size: 316 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: s1.f2 (type: string)
@@ -1494,7 +1494,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: t2
-                  filterExpr: ((s2.f8.f9 = false) and s1.f6 is not null) (type: boolean)
+                  filterExpr: (s1.f6 is not null and (not s2.f8.f9)) (type: boolean)
                   Statistics: Num rows: 1 Data size: 1468 Basic stats: COMPLETE Column stats: NONE
                   TableScan Vectorization:
                       native: true
@@ -1502,8 +1502,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterLongColEqualLongScalar(col 9:boolean, val 0)(children: VectorUDFStructField(col 8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>, col 0:int)(children: VectorUDFStructField(col 2:struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>, col 1:int) -> 8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>) -> 9:boolean), SelectColumnIsNotNull(col 10:int)(children: VectorUDFS [...]
-                    predicate: ((s2.f8.f9 = false) and s1.f6 is not null) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: SelectColumnIsNotNull(col 8:int)(children: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int) -> 8:int), SelectColumnIsFalse(col 10:boolean)(children: VectorUDFStructField(col 9:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>, col 0:int)(children: VectorUDFStructField(col 2:struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>, co [...]
+                    predicate: ((not s2.f8.f9) and s1.f6 is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 1468 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: s1 (type: struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>), s2 (type: struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>)
@@ -1519,7 +1519,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0.f6 (type: int)
                         Reduce Sink Vectorization:
                             className: VectorReduceSinkLongOperator
-                            keyExpressions: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int) -> 9:int
+                            keyExpressions: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int) -> 8:int
                             native: true
                             nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                         Statistics: Num rows: 1 Data size: 1468 Basic stats: COMPLETE Column stats: NONE
@@ -1828,19 +1828,19 @@ STAGE PLANS:
                     predicate: (s1.f6 is not null and s2.f8.f9 and s2.f8.f9 is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 1468 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s1.f6 (type: int), (s2.f8.f9 = true) (type: boolean)
+                      expressions: s1.f6 (type: int), s2.f8.f9 (type: boolean)
                       outputColumnNames: _col0, _col1
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [16, 19]
-                          selectExpressions: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int) -> 16:int, LongColEqualLongScalar(col 18:boolean, val 1)(children: VectorUDFStructField(col 17:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>, col 0:int)(children: VectorUDFStructField(col 2:struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>, col 1:int) -> 17:struct<f9:boolean,f10:array<int>,f11:map<stri [...]
+                          projectedOutputColumnNums: [16, 18]
+                          selectExpressions: VectorUDFStructField(col 1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int) -> 16:int, VectorUDFStructField(col 17:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>, col 0:int)(children: VectorUDFStructField(col 2:struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>, col 1:int) -> 17:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>) -> 18:boolean
                       Statistics: Num rows: 1 Data size: 1468 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         Group By Vectorization:
                             className: VectorGroupByOperator
                             groupByMode: HASH
-                            keyExpressions: col 16:int, col 19:boolean
+                            keyExpressions: col 16:int, col 18:boolean
                             native: false
                             vectorProcessingMode: HASH
                             projectedOutputColumnNums: []
diff --git a/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out b/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
index f8b3223..92a8c92 100644
--- a/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
@@ -423,10 +423,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: a
-                  filterExpr: c2 is not null (type: boolean)
+                  filterExpr: CAST( c2 AS STRING) is not null (type: boolean)
                   Statistics: Num rows: 3 Data size: 276 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: c2 is not null (type: boolean)
+                    predicate: CAST( c2 AS STRING) is not null (type: boolean)
                     Statistics: Num rows: 3 Data size: 276 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: c1 (type: int), c2 (type: varchar(10)), CAST( c2 AS STRING) (type: string)
diff --git a/ql/src/test/results/clientpositive/llap/vector_windowing_navfn.q.out b/ql/src/test/results/clientpositive/llap/vector_windowing_navfn.q.out
index 2af57ed..bf4d3ae 100644
--- a/ql/src/test/results/clientpositive/llap/vector_windowing_navfn.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_windowing_navfn.q.out
@@ -1448,13 +1448,13 @@ STAGE PLANS:
                     predicate: ((s) IN ('oscar allen', 'oscar carson') and (t = 10Y)) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: UDFToByte(10) (type: tinyint), s (type: string)
+                      key expressions: 10Y (type: tinyint), s (type: string)
                       sort order: ++
-                      Map-reduce partition columns: UDFToByte(10) (type: tinyint)
+                      Map-reduce partition columns: 10Y (type: tinyint)
                       Reduce Sink Vectorization:
                           className: VectorReduceSinkObjectHashOperator
                           keyColumns: 12:tinyint, 7:string
-                          keyExpressions: ConstantVectorExpression(val 10) -> 12:bigint
+                          keyExpressions: ConstantVectorExpression(val 10) -> 12:tinyint
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                           partitionColumns: 13:tinyint
@@ -1512,7 +1512,7 @@ STAGE PLANS:
                         input alias: ptf_1
                         name: windowingtablefunction
                         order by: _col7 ASC NULLS LAST
-                        partition by: UDFToByte(10)
+                        partition by: 10Y
                         raw input shape:
                         window functions:
                             window function definition
@@ -1532,7 +1532,7 @@ STAGE PLANS:
                       orderExpressions: [col 1:string]
                       outputColumns: [3, 2, 1]
                       outputTypes: [int, int, string]
-                      partitionExpressions: [ConstantVectorExpression(val 10) -> 4:bigint]
+                      partitionExpressions: [ConstantVectorExpression(val 10) -> 4:tinyint]
                       streamingColumns: []
                   Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_0.q.out b/ql/src/test/results/clientpositive/llap/vectorization_0.q.out
index 1ee9aa9..045f970 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_0.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_0.q.out
@@ -1076,8 +1076,8 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cstring2 like '%b%') or (CAST( cint AS decimal(13,3)) <> 79.553) or (UDFToDouble(cbigint) < cdouble) or ((UDFToShort(ctinyint) >= csmallint) and (cboolean2 = 1) and null)) (type: boolean)
-                  Statistics: Num rows: 12288 Data size: 1210980 Basic stats: COMPLETE Column stats: COMPLETE
+                  filterExpr: ((cstring2 like '%b%') or (CAST( cint AS decimal(13,3)) <> 79.553) or (UDFToDouble(cbigint) < cdouble)) (type: boolean)
+                  Statistics: Num rows: 12288 Data size: 1137584 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
                       vectorizationSchemaColumns: [0:ctinyint:tinyint, 1:csmallint:smallint, 2:cint:int, 3:cbigint:bigint, 4:cfloat:float, 5:cdouble:double, 6:cstring1:string, 7:cstring2:string, 8:ctimestamp1:timestamp, 9:ctimestamp2:timestamp, 10:cboolean1:boolean, 11:cboolean2:boolean, 12:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
@@ -1085,22 +1085,22 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprOrExpr(children: FilterStringColLikeStringScalar(col 7:string, pattern %b%), FilterDecimalColNotEqualDecimalScalar(col 13:decimal(13,3), val 79.553)(children: CastLongToDecimal(col 2:int) -> 13:decimal(13,3)), FilterDoubleColLessDoubleColumn(col 14:double, col 5:double)(children: CastLongToDouble(col 3:bigint) -> 14:double), SelectColumnIsTrue(col 17:boolean)(children: VectorUDFAdaptor(((UDFToShort(ctinyint) >= csmallint) and (cboole [...]
-                    predicate: (((UDFToShort(ctinyint) >= csmallint) and (cboolean2 = 1) and null) or (CAST( cint AS decimal(13,3)) <> 79.553) or (UDFToDouble(cbigint) < cdouble) or (cstring2 like '%b%')) (type: boolean)
-                    Statistics: Num rows: 12288 Data size: 1210980 Basic stats: COMPLETE Column stats: COMPLETE
+                        predicateExpression: FilterExprOrExpr(children: FilterStringColLikeStringScalar(col 7:string, pattern %b%), FilterDecimalColNotEqualDecimalScalar(col 13:decimal(13,3), val 79.553)(children: CastLongToDecimal(col 2:int) -> 13:decimal(13,3)), FilterDoubleColLessDoubleColumn(col 14:double, col 5:double)(children: CastLongToDouble(col 3:bigint) -> 14:double))
+                    predicate: ((CAST( cint AS decimal(13,3)) <> 79.553) or (UDFToDouble(cbigint) < cdouble) or (cstring2 like '%b%')) (type: boolean)
+                    Statistics: Num rows: 12288 Data size: 1137584 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cbigint (type: bigint), cfloat (type: float), ctinyint (type: tinyint), UDFToDouble(cbigint) (type: double), (UDFToDouble(cbigint) * UDFToDouble(cbigint)) (type: double)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [3, 4, 0, 18, 21]
-                          selectExpressions: CastLongToDouble(col 3:bigint) -> 18:double, DoubleColMultiplyDoubleColumn(col 19:double, col 20:double)(children: CastLongToDouble(col 3:bigint) -> 19:double, CastLongToDouble(col 3:bigint) -> 20:double) -> 21:double
-                      Statistics: Num rows: 12288 Data size: 1210980 Basic stats: COMPLETE Column stats: COMPLETE
+                          projectedOutputColumnNums: [3, 4, 0, 15, 18]
+                          selectExpressions: CastLongToDouble(col 3:bigint) -> 15:double, DoubleColMultiplyDoubleColumn(col 16:double, col 17:double)(children: CastLongToDouble(col 3:bigint) -> 16:double, CastLongToDouble(col 3:bigint) -> 17:double) -> 18:double
+                      Statistics: Num rows: 12288 Data size: 1137584 Basic stats: COMPLETE Column stats: COMPLETE
                       Group By Operator
                         aggregations: sum(_col0), count(_col0), sum(_col4), sum(_col3), count(), sum(_col1), min(_col2)
                         Group By Vectorization:
-                            aggregators: VectorUDAFSumLong(col 3:bigint) -> bigint, VectorUDAFCount(col 3:bigint) -> bigint, VectorUDAFSumDouble(col 21:double) -> double, VectorUDAFSumDouble(col 18:double) -> double, VectorUDAFCountStar(*) -> bigint, VectorUDAFSumDouble(col 4:float) -> double, VectorUDAFMinLong(col 0:tinyint) -> tinyint
+                            aggregators: VectorUDAFSumLong(col 3:bigint) -> bigint, VectorUDAFCount(col 3:bigint) -> bigint, VectorUDAFSumDouble(col 18:double) -> double, VectorUDAFSumDouble(col 15:double) -> double, VectorUDAFCountStar(*) -> bigint, VectorUDAFSumDouble(col 4:float) -> double, VectorUDAFMinLong(col 0:tinyint) -> tinyint
                             className: VectorGroupByOperator
                             groupByMode: HASH
                             native: false
@@ -1128,14 +1128,14 @@ STAGE PLANS:
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: false
-                usesVectorUDFAdaptor: true
+                usesVectorUDFAdaptor: false
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 12
-                    includeColumns: [0, 1, 2, 3, 4, 5, 7, 11]
+                    includeColumns: [0, 2, 3, 4, 5, 7]
                     dataColumns: ctinyint:tinyint, csmallint:smallint, cint:int, cbigint:bigint, cfloat:float, cdouble:double, cstring1:string, cstring2:string, ctimestamp1:timestamp, ctimestamp2:timestamp, cboolean1:boolean, cboolean2:boolean
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [decimal(13,3), double, bigint, bigint, bigint, double, double, double, double]
+                    scratchColumnTypeNames: [decimal(13,3), double, double, double, double, double]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -30210,6 +30210,9 @@ POSTHOOK: query: explain extended select * from alltypesorc where
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT `ctinyint`, `csmallint`, `cint`, `cbigint`, `cfloat`, `cdouble`, `cstring1`, `cstring2`, `ctimestamp1`, `ctimestamp2`, `cboolean1`, `cboolean2`
+FROM `default`.`alltypesorc`
+WHERE ROW(`cint`, `cfloat`) IN (ROW(49, 3.5), ROW(47, 2.09), ROW(45, 3.02))
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -30455,6 +30458,11 @@ POSTHOOK: query: explain extended select count(*),cstring1 from alltypesorc wher
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
+OPTIMIZED SQL: SELECT COUNT(*) AS `_o__c0`, `cstring1`
+FROM `default`.`alltypesorc`
+WHERE `cstring1` IN ('biology', 'history', 'topology')
+GROUP BY `cstring1`
+ORDER BY `cstring1`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_5.q.out b/ql/src/test/results/clientpositive/llap/vectorization_5.q.out
index 6467a2f..0dce8fe 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_5.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_5.q.out
@@ -62,7 +62,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cboolean2 is not null and (cstring1 like '%b%')) or ((UDFToDouble(ctinyint) = cdouble) and ctimestamp2 is not null and (cstring2 like 'a'))) (type: boolean)
+                  filterExpr: (((cstring1 like '%b%') and cboolean2 is not null) or ((UDFToDouble(ctinyint) = cdouble) and (cstring2 like 'a') and ctimestamp2 is not null)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 2454862 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -71,8 +71,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprOrExpr(children: FilterExprAndExpr(children: SelectColumnIsNotNull(col 11:boolean), FilterStringColLikeStringScalar(col 6:string, pattern %b%)), FilterExprAndExpr(children: FilterDoubleColEqualDoubleColumn(col 13:double, col 5:double)(children: CastLongToDouble(col 0:tinyint) -> 13:double), SelectColumnIsNotNull(col 9:timestamp), FilterStringColLikeStringScalar(col 7:string, pattern a)))
-                    predicate: (((UDFToDouble(ctinyint) = cdouble) and ctimestamp2 is not null and (cstring2 like 'a')) or (cboolean2 is not null and (cstring1 like '%b%'))) (type: boolean)
+                        predicateExpression: FilterExprOrExpr(children: FilterExprAndExpr(children: FilterStringColLikeStringScalar(col 6:string, pattern %b%), SelectColumnIsNotNull(col 11:boolean)), FilterExprAndExpr(children: FilterDoubleColEqualDoubleColumn(col 13:double, col 5:double)(children: CastLongToDouble(col 0:tinyint) -> 13:double), FilterStringColLikeStringScalar(col 7:string, pattern a), SelectColumnIsNotNull(col 9:timestamp)))
+                    predicate: (((UDFToDouble(ctinyint) = cdouble) and (cstring2 like 'a') and ctimestamp2 is not null) or ((cstring1 like '%b%') and cboolean2 is not null)) (type: boolean)
                     Statistics: Num rows: 7658 Data size: 1529972 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_6.q.out b/ql/src/test/results/clientpositive/llap/vectorization_6.q.out
index 2990bd4..3762cc9 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_6.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_6.q.out
@@ -61,7 +61,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((ctinyint <> 0Y) and (((cboolean1 <= 0) and (cboolean2 >= cboolean1)) or (cbigint is not null and ((cstring2 like '%a') or (cfloat <= -257.0))))) (type: boolean)
+                  filterExpr: ((ctinyint <> 0Y) and (((cboolean1 <= 0) and (cboolean2 >= cboolean1)) or (((cstring2 like '%a') or (cfloat <= -257.0)) and cbigint is not null))) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 2110130 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -70,8 +70,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterLongColNotEqualLongScalar(col 0:tinyint, val 0), FilterExprOrExpr(children: FilterExprAndExpr(children: FilterLongColLessEqualLongScalar(col 10:boolean, val 0), FilterLongColGreaterEqualLongColumn(col 11:boolean, col 10:boolean)), FilterExprAndExpr(children: SelectColumnIsNotNull(col 3:bigint), FilterExprOrExpr(children: FilterStringColLikeStringScalar(col 7:string, pattern %a), FilterDoubleColLessEqualDoubleS [...]
-                    predicate: ((((cboolean1 <= 0) and (cboolean2 >= cboolean1)) or (cbigint is not null and ((cstring2 like '%a') or (cfloat <= -257.0)))) and (ctinyint <> 0Y)) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: FilterLongColNotEqualLongScalar(col 0:tinyint, val 0), FilterExprOrExpr(children: FilterExprAndExpr(children: FilterLongColLessEqualLongScalar(col 10:boolean, val 0), FilterLongColGreaterEqualLongColumn(col 11:boolean, col 10:boolean)), FilterExprAndExpr(children: FilterExprOrExpr(children: FilterStringColLikeStringScalar(col 7:string, pattern %a), FilterDoubleColLessEqualDoubleScalar(col 4:float, val -257.0)), Sele [...]
+                    predicate: ((((cboolean1 <= 0) and (cboolean2 >= cboolean1)) or (((cstring2 like '%a') or (cfloat <= -257.0)) and cbigint is not null)) and (ctinyint <> 0Y)) (type: boolean)
                     Statistics: Num rows: 5951 Data size: 1022000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cboolean1 (type: boolean), cfloat (type: float), cstring1 (type: string), (988888 * UDFToInteger(csmallint)) (type: int), (- csmallint) (type: smallint), (- cfloat) (type: float), (-26.28D / UDFToDouble(cfloat)) (type: double), (cfloat * 359.0) (type: float), (cint % UDFToInteger(ctinyint)) (type: int), (- cdouble) (type: double), (UDFToInteger(ctinyint) - -75) (type: int), (762 * (cint % UDFToInteger(ctinyint))) (type: int)
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_8.q.out b/ql/src/test/results/clientpositive/llap/vectorization_8.q.out
index 3959239..7d0594a 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_8.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_8.q.out
@@ -72,7 +72,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cstring2 is not null and (UDFToDouble(ctimestamp1) <= 10.0D) and (UDFToDouble(ctimestamp2) <> 16.0D)) or (cfloat < -6432.0) or (cboolean1 is not null and (cdouble = 988888.0D))) (type: boolean)
+                  filterExpr: (((UDFToDouble(ctimestamp1) <= 10.0D) and (UDFToDouble(ctimestamp2) <> 16.0D) and cstring2 is not null) or (cfloat < -6432.0) or ((cdouble = 988888.0D) and cboolean1 is not null)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 2983078 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -81,8 +81,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprOrExpr(children: FilterExprAndExpr(children: SelectColumnIsNotNull(col 7:string), FilterDoubleColLessEqualDoubleScalar(col 13:double, val 10.0)(children: CastTimestampToDouble(col 8:timestamp) -> 13:double), FilterDoubleColNotEqualDoubleScalar(col 14:double, val 16.0)(children: CastTimestampToDouble(col 9:timestamp) -> 14:double)), FilterDoubleColLessDoubleScalar(col 4:float, val -6432.0), FilterExprAndExpr(children: SelectColumnIsNo [...]
-                    predicate: ((cboolean1 is not null and (cdouble = 988888.0D)) or (cfloat < -6432.0) or (cstring2 is not null and (UDFToDouble(ctimestamp1) <= 10.0D) and (UDFToDouble(ctimestamp2) <> 16.0D))) (type: boolean)
+                        predicateExpression: FilterExprOrExpr(children: FilterExprAndExpr(children: FilterDoubleColLessEqualDoubleScalar(col 13:double, val 10.0)(children: CastTimestampToDouble(col 8:timestamp) -> 13:double), FilterDoubleColNotEqualDoubleScalar(col 14:double, val 16.0)(children: CastTimestampToDouble(col 9:timestamp) -> 14:double), SelectColumnIsNotNull(col 7:string)), FilterDoubleColLessDoubleScalar(col 4:float, val -6432.0), FilterExprAndExpr(children: FilterDoubleColE [...]
+                    predicate: (((UDFToDouble(ctimestamp1) <= 10.0D) and (UDFToDouble(ctimestamp2) <> 16.0D) and cstring2 is not null) or ((cdouble = 988888.0D) and cboolean1 is not null) or (cfloat < -6432.0)) (type: boolean)
                     Statistics: Num rows: 3059 Data size: 742850 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctimestamp1 (type: timestamp), cdouble (type: double), cboolean1 (type: boolean), cstring1 (type: string), cfloat (type: float), (- cdouble) (type: double), (-5638.15D - cdouble) (type: double), (cdouble * -257.0D) (type: double), (UDFToFloat(cint) + cfloat) (type: float), ((- cdouble) + UDFToDouble(cbigint)) (type: double), (- cdouble) (type: double), (-1.389 - cfloat) (type: float), (- cfloat) (type: float), ((-5638.15D - cdouble) + UDFToDouble((UDFTo [...]
@@ -313,7 +313,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cstring2 is not null and (UDFToDouble(ctimestamp1) <= 12.503D) and (UDFToDouble(ctimestamp2) <> 11.998D)) or (cfloat < -6432.0) or (cboolean1 is not null and (cdouble = 988888.0D))) (type: boolean)
+                  filterExpr: (((UDFToDouble(ctimestamp1) <= 12.503D) and (UDFToDouble(ctimestamp2) <> 11.998D) and cstring2 is not null) or (cfloat < -6432.0) or ((cdouble = 988888.0D) and cboolean1 is not null)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 2983078 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -321,8 +321,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprOrExpr(children: FilterExprAndExpr(children: SelectColumnIsNotNull(col 7:string), FilterDoubleColLessEqualDoubleScalar(col 13:double, val 12.503)(children: CastTimestampToDouble(col 8:timestamp) -> 13:double), FilterDoubleColNotEqualDoubleScalar(col 14:double, val 11.998)(children: CastTimestampToDouble(col 9:timestamp) -> 14:double)), FilterDoubleColLessDoubleScalar(col 4:float, val -6432.0), FilterExprAndExpr(children: SelectColumn [...]
-                    predicate: ((cboolean1 is not null and (cdouble = 988888.0D)) or (cfloat < -6432.0) or (cstring2 is not null and (UDFToDouble(ctimestamp1) <= 12.503D) and (UDFToDouble(ctimestamp2) <> 11.998D))) (type: boolean)
+                        predicateExpression: FilterExprOrExpr(children: FilterExprAndExpr(children: FilterDoubleColLessEqualDoubleScalar(col 13:double, val 12.503)(children: CastTimestampToDouble(col 8:timestamp) -> 13:double), FilterDoubleColNotEqualDoubleScalar(col 14:double, val 11.998)(children: CastTimestampToDouble(col 9:timestamp) -> 14:double), SelectColumnIsNotNull(col 7:string)), FilterDoubleColLessDoubleScalar(col 4:float, val -6432.0), FilterExprAndExpr(children: FilterDouble [...]
+                    predicate: (((UDFToDouble(ctimestamp1) <= 12.503D) and (UDFToDouble(ctimestamp2) <> 11.998D) and cstring2 is not null) or ((cdouble = 988888.0D) and cboolean1 is not null) or (cfloat < -6432.0)) (type: boolean)
                     Statistics: Num rows: 3059 Data size: 742850 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctimestamp1 (type: timestamp), cdouble (type: double), cboolean1 (type: boolean), cstring1 (type: string), cfloat (type: float), (- cdouble) (type: double), (-5638.15D - cdouble) (type: double), (cdouble * -257.0D) (type: double), (UDFToFloat(cint) + cfloat) (type: float), ((- cdouble) + UDFToDouble(cbigint)) (type: double), (- cdouble) (type: double), (-1.389 - cfloat) (type: float), (- cfloat) (type: float), ((-5638.15D - cdouble) + UDFToDouble((UDFTo [...]
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_div0.q.out b/ql/src/test/results/clientpositive/llap/vectorization_div0.q.out
index 9a260ef..652883f 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_div0.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_div0.q.out
@@ -260,7 +260,7 @@ STAGE PLANS:
                     predicate: ((cbigint < 100000000L) and (cbigint > 0L)) (type: boolean)
                     Statistics: Num rows: 1365 Data size: 16320 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: (cbigint - 988888) (type: bigint), (cdouble / UDFToDouble((cbigint - 988888))) (type: double), (1.2 / CAST( (cbigint - 988888) AS decimal(19,0))) (type: decimal(22,21))
+                      expressions: (cbigint - 988888L) (type: bigint), (cdouble / UDFToDouble((cbigint - 988888L))) (type: double), (1.2 / CAST( (cbigint - 988888L) AS decimal(19,0))) (type: decimal(22,21))
                       outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out b/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out
index 051dc2f..15e1abf 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out
@@ -624,7 +624,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((ctimestamp1 = ctimestamp2) or (cfloat = 762.0) or (cstring1 = 'ss') or ((UDFToLong(csmallint) <= cbigint) and (cboolean2 = 1)) or (cboolean1 is not null and ctimestamp2 is not null and (cstring2 > 'a'))) (type: boolean)
+                  filterExpr: ((ctimestamp1 = ctimestamp2) or (cfloat = 762.0) or (cstring1 = 'ss') or ((UDFToLong(csmallint) <= cbigint) and (cboolean2 = 1)) or ((cstring2 > 'a') and cboolean1 is not null and ctimestamp2 is not null)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -632,8 +632,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprOrExpr(children: FilterTimestampColEqualTimestampColumn(col 8:timestamp, col 9:timestamp), FilterDoubleColEqualDoubleScalar(col 4:float, val 762.0), FilterStringGroupColEqualStringScalar(col 6:string, val ss), FilterExprAndExpr(children: FilterLongColLessEqualLongColumn(col 1:bigint, col 3:bigint)(children: col 1:smallint), FilterLongColEqualLongScalar(col 11:boolean, val 1)), FilterExprAndExpr(children: SelectColumnIsNotNull(col 10: [...]
-                    predicate: (((UDFToLong(csmallint) <= cbigint) and (cboolean2 = 1)) or (cboolean1 is not null and ctimestamp2 is not null and (cstring2 > 'a')) or (cfloat = 762.0) or (cstring1 = 'ss') or (ctimestamp1 = ctimestamp2)) (type: boolean)
+                        predicateExpression: FilterExprOrExpr(children: FilterTimestampColEqualTimestampColumn(col 8:timestamp, col 9:timestamp), FilterDoubleColEqualDoubleScalar(col 4:float, val 762.0), FilterStringGroupColEqualStringScalar(col 6:string, val ss), FilterExprAndExpr(children: FilterLongColLessEqualLongColumn(col 1:bigint, col 3:bigint)(children: col 1:smallint), FilterLongColEqualLongScalar(col 11:boolean, val 1)), FilterExprAndExpr(children: FilterStringGroupColGreaterSt [...]
+                    predicate: (((UDFToLong(csmallint) <= cbigint) and (cboolean2 = 1)) or ((cstring2 > 'a') and cboolean1 is not null and ctimestamp2 is not null) or (cfloat = 762.0) or (cstring1 = 'ss') or (ctimestamp1 = ctimestamp2)) (type: boolean)
                     Statistics: Num rows: 11346 Data size: 2856120 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cbigint (type: bigint), ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cdouble (type: double), UDFToDouble(cbigint) (type: double), (UDFToDouble(cbigint) * UDFToDouble(cbigint)) (type: double), UDFToDouble(csmallint) (type: double), (UDFToDouble(csmallint) * UDFToDouble(csmallint)) (type: double), (cdouble * cdouble) (type: double)
@@ -2223,7 +2223,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((UDFToInteger(csmallint) >= -257) and ((UDFToInteger(csmallint) = -6432) or ((UDFToDouble(cint) >= cdouble) and (UDFToInteger(ctinyint) <= cint)))) (type: boolean)
+                  filterExpr: ((UDFToInteger(csmallint) >= -257) and (UDFToDouble(cint) >= cdouble) and (UDFToInteger(ctinyint) <= cint)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 256884 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -2231,9 +2231,9 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterLongColGreaterEqualLongScalar(col 1:int, val -257)(children: col 1:smallint), FilterExprOrExpr(children: FilterLongColEqualLongScalar(col 1:int, val -6432)(children: col 1:smallint), FilterExprAndExpr(children: FilterDoubleColGreaterEqualDoubleColumn(col 13:double, col 5:double)(children: CastLongToDouble(col 2:int) -> 13:double), FilterLongColLessEqualLongColumn(col 0:int, col 2:int)(children: col 0:tinyint))))
-                    predicate: (((UDFToInteger(csmallint) = -6432) or ((UDFToDouble(cint) >= cdouble) and (UDFToInteger(ctinyint) <= cint))) and (UDFToInteger(csmallint) >= -257)) (type: boolean)
-                    Statistics: Num rows: 2503 Data size: 52344 Basic stats: COMPLETE Column stats: COMPLETE
+                        predicateExpression: FilterExprAndExpr(children: FilterLongColGreaterEqualLongScalar(col 1:int, val -257)(children: col 1:smallint), FilterDoubleColGreaterEqualDoubleColumn(col 13:double, col 5:double)(children: CastLongToDouble(col 2:int) -> 13:double), FilterLongColLessEqualLongColumn(col 0:int, col 2:int)(children: col 0:tinyint))
+                    predicate: ((UDFToDouble(cint) >= cdouble) and (UDFToInteger(csmallint) >= -257) and (UDFToInteger(ctinyint) <= cint)) (type: boolean)
+                    Statistics: Num rows: 455 Data size: 9548 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: csmallint (type: smallint), cbigint (type: bigint), ctinyint (type: tinyint), UDFToDouble(csmallint) (type: double), (UDFToDouble(csmallint) * UDFToDouble(csmallint)) (type: double), UDFToDouble(ctinyint) (type: double), (UDFToDouble(ctinyint) * UDFToDouble(ctinyint)) (type: double)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
@@ -2242,7 +2242,7 @@ STAGE PLANS:
                           native: true
                           projectedOutputColumnNums: [1, 3, 0, 14, 17, 18, 21]
                           selectExpressions: CastLongToDouble(col 1:smallint) -> 14:double, DoubleColMultiplyDoubleColumn(col 15:double, col 16:double)(children: CastLongToDouble(col 1:smallint) -> 15:double, CastLongToDouble(col 1:smallint) -> 16:double) -> 17:double, CastLongToDouble(col 0:tinyint) -> 18:double, DoubleColMultiplyDoubleColumn(col 19:double, col 20:double)(children: CastLongToDouble(col 0:tinyint) -> 19:double, CastLongToDouble(col 0:tinyint) -> 20:double) -> 21:double
-                      Statistics: Num rows: 2503 Data size: 52344 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 455 Data size: 9548 Basic stats: COMPLETE Column stats: COMPLETE
                       Group By Operator
                         aggregations: sum(_col4), sum(_col3), count(_col0), sum(_col1), sum(_col6), sum(_col5), count(_col2), count()
                         Group By Vectorization:
@@ -2257,7 +2257,7 @@ STAGE PLANS:
                         minReductionHashAggr: 0.0
                         mode: hash
                         outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                        Statistics: Num rows: 1251 Data size: 83804 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 227 Data size: 15212 Basic stats: COMPLETE Column stats: COMPLETE
                         Reduce Output Operator
                           key expressions: _col0 (type: smallint)
                           sort order: +
@@ -2266,7 +2266,7 @@ STAGE PLANS:
                               className: VectorReduceSinkLongOperator
                               native: true
                               nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          Statistics: Num rows: 1251 Data size: 83804 Basic stats: COMPLETE Column stats: COMPLETE
+                          Statistics: Num rows: 227 Data size: 15212 Basic stats: COMPLETE Column stats: COMPLETE
                           value expressions: _col1 (type: double), _col2 (type: double), _col3 (type: bigint), _col4 (type: bigint), _col5 (type: double), _col6 (type: double), _col7 (type: bigint), _col8 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -2301,7 +2301,7 @@ STAGE PLANS:
                 keys: KEY._col0 (type: smallint)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                Statistics: Num rows: 1251 Data size: 83804 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 227 Data size: 15212 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col0 (type: smallint), (UDFToInteger(_col0) % -75) (type: int), power(((_col1 - ((_col2 * _col2) / _col3)) / CASE WHEN ((_col3 = 1L)) THEN (null) ELSE ((_col3 - 1)) END), 0.5) (type: double), (-1.389 / CAST( _col0 AS decimal(5,0))) (type: decimal(10,9)), _col4 (type: bigint), (UDFToDouble((UDFToInteger(_col0) % -75)) / UDFToDouble(_col4)) (type: double), (- (UDFToInteger(_col0) % -75)) (type: int), ((_col5 - ((_col6 * _col6) / _col7)) / _col7) (type: doubl [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
@@ -2310,7 +2310,7 @@ STAGE PLANS:
                       native: true
                       projectedOutputColumnNums: [0, 9, 17, 19, 4, 23, 25, 29, 32, 8, 33]
                       selectExpressions: LongColModuloLongScalar(col 0:int, val -75)(children: col 0:smallint) -> 9:int, FuncPowerDoubleToDouble(col 16:double)(children: DoubleColDivideLongColumn(col 12:double, col 15:bigint)(children: DoubleColSubtractDoubleColumn(col 1:double, col 11:double)(children: DoubleColDivideLongColumn(col 10:double, col 3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) -> 10:double) -> 11:double) -> 12:double, IfExprNullCondExpr(col [...]
-                  Statistics: Num rows: 1251 Data size: 218912 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 227 Data size: 39728 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col0 (type: smallint), _col1 (type: int), _col2 (type: double), _col3 (type: decimal(10,9)), _col4 (type: bigint), _col5 (type: double), _col6 (type: int), _col7 (type: double), _col8 (type: int), _col9 (type: bigint), _col10 (type: bigint)
                     sort order: +++++++++++
@@ -2318,7 +2318,7 @@ STAGE PLANS:
                         className: VectorReduceSinkObjectHashOperator
                         native: true
                         nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                    Statistics: Num rows: 1251 Data size: 218912 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 227 Data size: 39728 Basic stats: COMPLETE Column stats: COMPLETE
                     TopN Hash Memory Usage: 0.1
         Reducer 3 
             Execution mode: vectorized, llap
@@ -2336,7 +2336,7 @@ STAGE PLANS:
                     className: VectorSelectOperator
                     native: true
                     projectedOutputColumnNums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-                Statistics: Num rows: 1251 Data size: 218912 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 227 Data size: 39728 Basic stats: COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 20
                   Limit Vectorization:
@@ -2833,7 +2833,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((UDFToDouble(ctimestamp1) <> 0.0D) and (((UDFToInteger(ctinyint) <> -257) and cboolean2 is not null and cstring1 regexp '.*ss' and (UDFToDouble(ctimestamp1) > -3.0D)) or (UDFToDouble(ctimestamp2) = -5.0D) or ((UDFToDouble(ctimestamp1) < 0.0D) and (cstring2 like '%b%')) or (cdouble = UDFToDouble(cint)) or (cboolean1 is null and (cfloat < UDFToFloat(cint))))) (type: boolean)
+                  filterExpr: ((UDFToDouble(ctimestamp1) <> 0.0D) and (((UDFToInteger(ctinyint) <> -257) and cstring1 regexp '.*ss' and (UDFToDouble(ctimestamp1) > -3.0D) and cboolean2 is not null) or (UDFToDouble(ctimestamp2) = -5.0D) or ((UDFToDouble(ctimestamp1) < 0.0D) and (cstring2 like '%b%')) or (cdouble = UDFToDouble(cint)) or (cboolean1 is null and (cfloat < UDFToFloat(cint))))) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 3019778 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -2841,8 +2841,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterDoubleColNotEqualDoubleScalar(col 13:double, val 0.0)(children: CastTimestampToDouble(col 8:timestamp) -> 13:double), FilterExprOrExpr(children: FilterExprAndExpr(children: FilterLongColNotEqualLongScalar(col 0:int, val -257)(children: col 0:tinyint), SelectColumnIsNotNull(col 11:boolean), FilterStringColRegExpStringScalar(col 6:string, pattern .*ss), FilterDoubleColGreaterDoubleScalar(col 14:double, val -3.0) [...]
-                    predicate: ((((UDFToInteger(ctinyint) <> -257) and cboolean2 is not null and cstring1 regexp '.*ss' and (UDFToDouble(ctimestamp1) > -3.0D)) or (UDFToDouble(ctimestamp2) = -5.0D) or ((UDFToDouble(ctimestamp1) < 0.0D) and (cstring2 like '%b%')) or (cdouble = UDFToDouble(cint)) or (cboolean1 is null and (cfloat < UDFToFloat(cint)))) and (UDFToDouble(ctimestamp1) <> 0.0D)) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: FilterDoubleColNotEqualDoubleScalar(col 13:double, val 0.0)(children: CastTimestampToDouble(col 8:timestamp) -> 13:double), FilterExprOrExpr(children: FilterExprAndExpr(children: FilterLongColNotEqualLongScalar(col 0:int, val -257)(children: col 0:tinyint), FilterStringColRegExpStringScalar(col 6:string, pattern .*ss), FilterDoubleColGreaterDoubleScalar(col 14:double, val -3.0)(children: CastTimestampToDouble(col 8: [...]
+                    predicate: ((((UDFToInteger(ctinyint) <> -257) and cstring1 regexp '.*ss' and (UDFToDouble(ctimestamp1) > -3.0D) and cboolean2 is not null) or (UDFToDouble(ctimestamp2) = -5.0D) or ((UDFToDouble(ctimestamp1) < 0.0D) and (cstring2 like '%b%')) or (cdouble = UDFToDouble(cint)) or (cboolean1 is null and (cfloat < UDFToFloat(cint)))) and (UDFToDouble(ctimestamp1) <> 0.0D)) (type: boolean)
                     Statistics: Num rows: 12288 Data size: 3019778 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ctimestamp1 (type: timestamp), cstring1 (type: string), cint (type: int), csmallint (type: smallint), ctinyint (type: tinyint), cfloat (type: float), cdouble (type: double), UDFToDouble(cint) (type: double), (UDFToDouble(cint) * UDFToDouble(cint)) (type: double), UDFToDouble(csmallint) (type: double), (UDFToDouble(csmallint) * UDFToDouble(csmallint)) (type: double), UDFToDouble(cfloat) (type: double), (UDFToDouble(cfloat) * UDFToDouble(cfloat)) (type: d [...]
@@ -3241,7 +3241,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((((cdouble < UDFToDouble(csmallint)) and (cboolean2 = cboolean1) and (CAST( cbigint AS decimal(22,3)) <= -863.257)) or ((cint >= -257) and cstring1 is not null and (cboolean1 >= 1)) or cstring2 regexp 'b' or ((csmallint >= UDFToShort(ctinyint)) and ctimestamp2 is null)) and cboolean1 is not null) (type: boolean)
+                  filterExpr: ((((cdouble < UDFToDouble(csmallint)) and (cboolean2 = cboolean1) and (CAST( cbigint AS decimal(22,3)) <= -863.257)) or ((cint >= -257) and (cboolean1 >= 1) and cstring1 is not null) or cstring2 regexp 'b' or ((csmallint >= UDFToShort(ctinyint)) and ctimestamp2 is null)) and cboolean1 is not null) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 2601650 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -3249,8 +3249,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterExprAndExpr(children: FilterExprOrExpr(children: FilterExprAndExpr(children: FilterDoubleColLessDoubleColumn(col 5:double, col 13:double)(children: CastLongToDouble(col 1:smallint) -> 13:double), FilterLongColEqualLongColumn(col 11:boolean, col 10:boolean), FilterDecimalColLessEqualDecimalScalar(col 14:decimal(22,3), val -863.257)(children: CastLongToDecimal(col 3:bigint) -> 14:decimal(22,3))), FilterExprAndExpr(children: FilterLongColGr [...]
-                    predicate: ((((cdouble < UDFToDouble(csmallint)) and (cboolean2 = cboolean1) and (CAST( cbigint AS decimal(22,3)) <= -863.257)) or ((cint >= -257) and cstring1 is not null and (cboolean1 >= 1)) or cstring2 regexp 'b' or ((csmallint >= UDFToShort(ctinyint)) and ctimestamp2 is null)) and cboolean1 is not null) (type: boolean)
+                        predicateExpression: FilterExprAndExpr(children: FilterExprOrExpr(children: FilterExprAndExpr(children: FilterDoubleColLessDoubleColumn(col 5:double, col 13:double)(children: CastLongToDouble(col 1:smallint) -> 13:double), FilterLongColEqualLongColumn(col 11:boolean, col 10:boolean), FilterDecimalColLessEqualDecimalScalar(col 14:decimal(22,3), val -863.257)(children: CastLongToDecimal(col 3:bigint) -> 14:decimal(22,3))), FilterExprAndExpr(children: FilterLongColGr [...]
+                    predicate: ((((cdouble < UDFToDouble(csmallint)) and (cboolean2 = cboolean1) and (CAST( cbigint AS decimal(22,3)) <= -863.257)) or ((cint >= -257) and (cboolean1 >= 1) and cstring1 is not null) or cstring2 regexp 'b' or ((csmallint >= UDFToShort(ctinyint)) and ctimestamp2 is null)) and cboolean1 is not null) (type: boolean)
                     Statistics: Num rows: 7845 Data size: 1661020 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cboolean1 (type: boolean), cfloat (type: float), cbigint (type: bigint), cint (type: int), cdouble (type: double), ctinyint (type: tinyint), csmallint (type: smallint), UDFToDouble(cint) (type: double), (UDFToDouble(cint) * UDFToDouble(cint)) (type: double), UDFToDouble(cbigint) (type: double), (UDFToDouble(cbigint) * UDFToDouble(cbigint)) (type: double), UDFToDouble(ctinyint) (type: double), (UDFToDouble(ctinyint) * UDFToDouble(ctinyint)) (type: double [...]
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_casts.q.out b/ql/src/test/results/clientpositive/llap/vectorized_casts.q.out
index d1a9620..333cbd3 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_casts.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_casts.q.out
@@ -169,7 +169,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cbigint % 250) = 0) (type: boolean)
+                  filterExpr: ((cbigint % 250L) = 0L) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 1684250 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -179,16 +179,16 @@ STAGE PLANS:
                         className: VectorFilterOperator
                         native: true
                         predicateExpression: FilterLongColEqualLongScalar(col 13:bigint, val 0)(children: LongColModuloLongScalar(col 3:bigint, val 250) -> 13:bigint)
-                    predicate: ((cbigint % 250) = 0) (type: boolean)
+                    predicate: ((cbigint % 250L) = 0L) (type: boolean)
                     Statistics: Num rows: 6144 Data size: 842180 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: UDFToBoolean(ctinyint) (type: boolean), UDFToBoolean(csmallint) (type: boolean), UDFToBoolean(cint) (type: boolean), UDFToBoolean(cbigint) (type: boolean), UDFToBoolean(cfloat) (type: boolean), UDFToBoolean(cdouble) (type: boolean), cboolean1 (type: boolean), UDFToBoolean((cbigint * 0L)) (type: boolean), UDFToBoolean(ctimestamp1) (type: boolean), UDFToBoolean(cstring1) (type: boolean), UDFToInteger(ctinyint) (type: int), UDFToInteger(csmallint) (type: i [...]
+                      expressions: UDFToBoolean(ctinyint) (type: boolean), UDFToBoolean(csmallint) (type: boolean), UDFToBoolean(cint) (type: boolean), UDFToBoolean(cbigint) (type: boolean), UDFToBoolean(cfloat) (type: boolean), UDFToBoolean(cdouble) (type: boolean), cboolean1 (type: boolean), ((cbigint * 0L) <> 0L) (type: boolean), UDFToBoolean(ctimestamp1) (type: boolean), UDFToBoolean(cstring1) (type: boolean), UDFToInteger(ctinyint) (type: int), UDFToInteger(csmallint) (type: int), c [...]
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29, _col30, _col31, _col32, _col33, _col34, _col35, _col36, _col37, _col38, _col39, _col40, _col41, _col42, _col43, _col44, _col45, _col46, _col47, _col48, _col49, _col50, _col51, _col52, _col53, _col54, _col55, _col56, _col5 [...]
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
                           projectedOutputColumnNums: [14, 15, 16, 17, 18, 19, 10, 21, 22, 23, 0, 1, 2, 3, 24, 25, 10, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 4, 5, 37, 38, 39, 41, 42, 5, 44, 46, 48, 50, 51, 52, 54, 58, 60, 8, 61, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 6, 74, 75, 77, 79, 81, 84]
-                          selectExpressions: CastLongToBooleanViaLongToLong(col 0:tinyint) -> 14:boolean, CastLongToBooleanViaLongToLong(col 1:smallint) -> 15:boolean, CastLongToBooleanViaLongToLong(col 2:int) -> 16:boolean, CastLongToBooleanViaLongToLong(col 3:bigint) -> 17:boolean, CastDoubleToBooleanViaDoubleToLong(col 4:float) -> 18:boolean, CastDoubleToBooleanViaDoubleToLong(col 5:double) -> 19:boolean, CastLongToBooleanViaLongToLong(col 20:bigint)(children: LongColMultiplyLongScala [...]
+                          selectExpressions: CastLongToBooleanViaLongToLong(col 0:tinyint) -> 14:boolean, CastLongToBooleanViaLongToLong(col 1:smallint) -> 15:boolean, CastLongToBooleanViaLongToLong(col 2:int) -> 16:boolean, CastLongToBooleanViaLongToLong(col 3:bigint) -> 17:boolean, CastDoubleToBooleanViaDoubleToLong(col 4:float) -> 18:boolean, CastDoubleToBooleanViaDoubleToLong(col 5:double) -> 19:boolean, LongColNotEqualLongScalar(col 20:bigint, val 0)(children: LongColMultiplyLongSca [...]
                       Statistics: Num rows: 6144 Data size: 16362860 Basic stats: COMPLETE Column stats: COMPLETE
                       File Output Operator
                         compressed: false
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out b/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
index 7f09671..5dcf5f1 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
@@ -1843,17 +1843,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1869,10 +1872,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n2
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
@@ -2019,17 +2022,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: (UDFToDouble(hr) * 2.0D) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2195,17 +2201,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2221,10 +2230,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n2
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
@@ -2355,17 +2364,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: double)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: double)
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: (UDFToDouble(hr) * 2.0D) (type: double)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: double)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2528,17 +2540,20 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) (type: string)
-                    outputColumnNames: _col0
+                  Filter Operator
+                    predicate: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) is not null (type: boolean)
                     Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    Select Operator
+                      expressions: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2554,10 +2569,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n2
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and CAST( hr AS STRING) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and CAST( hr AS STRING) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: CAST( hr AS STRING) (type: string)
@@ -5848,31 +5863,34 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: double)
-                        1 _col0 (type: double)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: double)
+                          1 _col0 (type: double)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -5888,10 +5906,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart_double_hour_n2
-                  filterExpr: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                  filterExpr: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                   Statistics: Num rows: 2 Data size: 188 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and UDFToDouble(UDFToInteger((hr / 2.0D))) is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 94 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
@@ -6015,31 +6033,34 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart
-                  filterExpr: hr is not null (type: boolean)
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: double)
-                        1 _col0 (type: double)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: (UDFToDouble(hr) * 2.0D) (type: double)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: double)
+                          1 _col0 (type: double)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 1000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -7479,40 +7500,44 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: srcpart_orc_n0
+                  filterExpr: UDFToDouble(hr) is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 564000 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: ds (type: string), UDFToDouble(hr) (type: double)
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 2000 Data size: 384000 Basic stats: COMPLETE Column stats: COMPLETE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col0 (type: string), _col1 (type: double)
-                        1 _col0 (type: string), _col1 (type: double)
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Group By Operator
-                        aggregations: count()
-                        minReductionHashAggr: 0.0
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                        Reduce Output Operator
-                          sort order: 
+                  Filter Operator
+                    predicate: UDFToDouble(hr) is not null (type: boolean)
+                    Statistics: Num rows: 2000 Data size: 376000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: ds (type: string), UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 2000 Data size: 384000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: string), _col1 (type: double)
+                          1 _col0 (type: string), _col1 (type: double)
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Group By Operator
+                          aggregations: count()
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                            value expressions: _col0 (type: bigint)
             Execution mode: llap
             LLAP IO: all inputs
         Map 3 
             Map Operator Tree:
                 TableScan
                   alias: srcpart_date_hour_n2
-                  filterExpr: ((date) IN ('2008-04-08', '2008-04-09') and (UDFToDouble(hour) = 11.0D) and ds is not null and hr is not null) (type: boolean)
+                  filterExpr: ((date) IN ('2008-04-08', '2008-04-09') and (UDFToDouble(hour) = 11.0D) and ds is not null and UDFToDouble(hr) is not null) (type: boolean)
                   Statistics: Num rows: 4 Data size: 1440 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: ((UDFToDouble(hour) = 11.0D) and (date) IN ('2008-04-08', '2008-04-09') and ds is not null and hr is not null) (type: boolean)
+                    predicate: ((UDFToDouble(hour) = 11.0D) and (date) IN ('2008-04-08', '2008-04-09') and UDFToDouble(hr) is not null and ds is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 720 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: ds (type: string), UDFToDouble(hr) (type: double)
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_math_funcs.q.out b/ql/src/test/results/clientpositive/llap/vectorized_math_funcs.q.out
index 63b42fd..9febde9 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_math_funcs.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_math_funcs.q.out
@@ -123,7 +123,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: (((cbigint % 500) = 0) and (sin(cfloat) >= -1.0D)) (type: boolean)
+                  filterExpr: (((cbigint % 500L) = 0L) and (sin(cfloat) >= -1.0D)) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 293580 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -132,7 +132,7 @@ STAGE PLANS:
                         className: VectorFilterOperator
                         native: true
                         predicateExpression: FilterExprAndExpr(children: FilterLongColEqualLongScalar(col 13:bigint, val 0)(children: LongColModuloLongScalar(col 3:bigint, val 500) -> 13:bigint), FilterDoubleColGreaterEqualDoubleScalar(col 14:double, val -1.0)(children: FuncSinDoubleToDouble(col 4:float) -> 14:double))
-                    predicate: (((cbigint % 500) = 0) and (sin(cfloat) >= -1.0D)) (type: boolean)
+                    predicate: (((cbigint % 500L) = 0L) and (sin(cfloat) >= -1.0D)) (type: boolean)
                     Statistics: Num rows: 2048 Data size: 48960 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: cdouble (type: double), round(cdouble, 2) (type: double), floor(cdouble) (type: bigint), ceil(cdouble) (type: bigint), rand() (type: double), rand(98007) (type: double), exp(ln(cdouble)) (type: double), ln(cdouble) (type: double), ln(cfloat) (type: double), log10(cdouble) (type: double), log2(cdouble) (type: double), log2((cdouble - 15601.0D)) (type: double), log2(cfloat) (type: double), log2(cbigint) (type: double), log2(cint) (type: double), log2(csma [...]
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_string_funcs.q.out b/ql/src/test/results/clientpositive/llap/vectorized_string_funcs.q.out
index 7a50735..c53f00b 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_string_funcs.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_string_funcs.q.out
@@ -63,10 +63,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: (((cbigint % 237) = 0) and (length(substr(cstring1, 1, 2)) <= 2) and (cstring1 like '%')) (type: boolean)
+                  filterExpr: (((cbigint % 237L) = 0L) and (length(substr(cstring1, 1, 2)) <= 2) and (cstring1 like '%')) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 1816546 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
-                    predicate: (((cbigint % 237) = 0) and (cstring1 like '%') and (length(substr(cstring1, 1, 2)) <= 2)) (type: boolean)
+                    predicate: (((cbigint % 237L) = 0L) and (cstring1 like '%') and (length(substr(cstring1, 1, 2)) <= 2)) (type: boolean)
                     Statistics: Num rows: 1024 Data size: 151470 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: substr(cstring1, 1, 2) (type: string), substr(cstring1, 2) (type: string), lower(cstring1) (type: string), upper(cstring1) (type: string), upper(cstring1) (type: string), length(cstring1) (type: int), trim(cstring1) (type: string), ltrim(cstring1) (type: string), rtrim(cstring1) (type: string), concat(cstring1, cstring2) (type: string), concat('>', cstring1) (type: string), concat(cstring1, '<') (type: string), concat(substr(cstring1, 1, 2), substr(cstr [...]
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_timestamp_ints_casts.q.out b/ql/src/test/results/clientpositive/llap/vectorized_timestamp_ints_casts.q.out
index c52e3b9..e13d4a9 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_timestamp_ints_casts.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_timestamp_ints_casts.q.out
@@ -55,7 +55,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cbigint % 250) = 0) (type: boolean)
+                  filterExpr: ((cbigint % 250L) = 0L) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 1684250 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -64,7 +64,7 @@ STAGE PLANS:
                         className: VectorFilterOperator
                         native: true
                         predicateExpression: FilterLongColEqualLongScalar(col 13:bigint, val 0)(children: LongColModuloLongScalar(col 3:bigint, val 250) -> 13:bigint)
-                    predicate: ((cbigint % 250) = 0) (type: boolean)
+                    predicate: ((cbigint % 250L) = 0L) (type: boolean)
                     Statistics: Num rows: 6144 Data size: 842180 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: CAST( ctinyint AS TIMESTAMP) (type: timestamp), CAST( csmallint AS TIMESTAMP) (type: timestamp), CAST( cint AS TIMESTAMP) (type: timestamp), CAST( cbigint AS TIMESTAMP) (type: timestamp), CAST( cfloat AS TIMESTAMP) (type: timestamp), CAST( cdouble AS TIMESTAMP) (type: timestamp), CAST( cboolean1 AS TIMESTAMP) (type: timestamp), CAST( (cbigint * 0L) AS TIMESTAMP) (type: timestamp), ctimestamp1 (type: timestamp), CAST( cstring1 AS TIMESTAMP) (type: timest [...]
@@ -224,7 +224,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc
-                  filterExpr: ((cbigint % 250) = 0) (type: boolean)
+                  filterExpr: ((cbigint % 250L) = 0L) (type: boolean)
                   Statistics: Num rows: 12288 Data size: 1684250 Basic stats: COMPLETE Column stats: COMPLETE
                   TableScan Vectorization:
                       native: true
@@ -233,7 +233,7 @@ STAGE PLANS:
                         className: VectorFilterOperator
                         native: true
                         predicateExpression: FilterLongColEqualLongScalar(col 13:bigint, val 0)(children: LongColModuloLongScalar(col 3:bigint, val 250) -> 13:bigint)
-                    predicate: ((cbigint % 250) = 0) (type: boolean)
+                    predicate: ((cbigint % 250L) = 0L) (type: boolean)
                     Statistics: Num rows: 6144 Data size: 842180 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: CAST( ctinyint AS TIMESTAMP) (type: timestamp), CAST( csmallint AS TIMESTAMP) (type: timestamp), CAST( cint AS TIMESTAMP) (type: timestamp), CAST( cbigint AS TIMESTAMP) (type: timestamp), CAST( cfloat AS TIMESTAMP) (type: timestamp), CAST( cdouble AS TIMESTAMP) (type: timestamp), CAST( cboolean1 AS TIMESTAMP) (type: timestamp), CAST( (cbigint * 0L) AS TIMESTAMP) (type: timestamp), ctimestamp1 (type: timestamp), CAST( cstring1 AS TIMESTAMP) (type: timest [...]
diff --git a/ql/src/test/results/clientpositive/masking_1.q.out b/ql/src/test/results/clientpositive/masking_1.q.out
... 17799 lines suppressed ...