Speed up HLL computation.

Trivial change to turn a mod into an and.

Results on ndv(l_orderkey) on a bigger version of the lineitem table.
Before:
QueryTime: 1.70s

After:
QueryTime: 1.40s

Change-Id: I3fa0dcb4da6efcd8ff1115ad6e5a3bdd990a35df
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2512
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
IMPALA-964: Full outer join on values() followed by group by hits a
preconditions check

This commit fixes IMPALA-964 where full outer join between two inline
views followed by a group by (e.g. select 1 FROM (VALUES(1 x, 1 y)) a
FULL OUTER JOIN (VALUES(1 x, 1 y)) b ON (a.x = b.y) GROUP BY a.x;)
hits a preconditions check. This check evaluates if the numNodes
(number of nodes for the purpose of resource estimation) variable
is greater or equal to zero and is triggered when we try to compute
the resource estimates (number of distinct values) of a plan fragment.

The following changes are included in this commit:
1. Modified the getNumDistinctValues function in PlanFragment class to
consider the special case where the numNodes of a plan fragment is -1.
2. Added a test case in QueryTest/joins.test.

Change-Id: I2962ed5079e174d0e76ad990ab84e1fb1a4607ef
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2466
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins
Fix FE bug from missing casts for functions with wildcard decimal args.

Before, if none of the child args where decimals, the casts would be added.
This is because getResolvedWildcardDecimalType could return a non-null, non-decimal
type.

Change-Id: I652c3afc00ce4c2047660dc4d226b299a11069a6
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2507
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins