> On June 17, 2015, 4:08 p.m., Ashutosh Chauhan wrote: > > ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java, > > line 1240 > > <https://reviews.apache.org/r/35532/diff/1/?file=985909#file985909line1240> > > > > This doesn't seem right. isGreater() (as oppose to isEqual()) is not > > symmetric w.r.t order of two arguments. e.g., consider v1 = 23 and v2 = > > NULL, this call will return v1 > v2. However, if v1 = NULL and v2 = 23, it > > will still return v1 > v2. Either NULLs should always be greater or always > > be smaller, otherwise this has potential to generate incorrect result set.
The name isGreater() probably is a little misleading. It actually means if the distance of second value to the first value is greater than the given amt. When v1 = 23 and v2 = null, the distance is considered greater than 10 (actually any value) since 23 and null are not comparable; the same for v1 = null and v2 = 23. v1 = null and v2 = null are considered less than 10 since they are both null and the distance is 0. I can change the name to mean what it means, like isDistanceGreater(), so that we won't be confused with isEqual() (which is what I initially did as well); or add some comments. Suggestions? - Aihua ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/35532/#review88235 ----------------------------------------------------------- On June 16, 2015, 8:13 p.m., Aihua Xu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/35532/ > ----------------------------------------------------------- > > (Updated June 16, 2015, 8:13 p.m.) > > > Review request for hive. > > > Repository: hive-git > > > Description > ------- > > HIVE-11025 In windowing spec, when the datatype is decimal, it's comparing > the value against NULL value incorrectly > > > Diffs > ----- > > data/files/emp2.txt 650aff7f2c8003fb7c04dfa377c2b25d04f3ce88 > ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java > 32471f2dc864c38a2969909efa5b21508e27d7f8 > ql/src/test/queries/clientpositive/windowing_windowspec3.q > 608a6cf45e3c1e0b928800dae0470e8acfd77734 > ql/src/test/results/clientpositive/windowing_windowspec3.q.out > 42c042f2cf80f0a5a8269ad9eb9864d7e76525cc > > Diff: https://reviews.apache.org/r/35532/diff/ > > > Testing > ------- > > > Thanks, > > Aihua Xu > >