Skip to content

Commit 7062da7

Browse files
fix the collect_set() behaviour differences under different versions of JDK
1 parent ce0051d commit 7062da7

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveWindowFunctionQuerySuite.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,14 @@ abstract class HiveWindowFunctionQueryBaseSuite extends HiveComparisonTest with
526526
| rows between 2 preceding and 2 following);
527527
""".stripMargin, reset = false)
528528

529+
// collect_set() output array in an arbitrary order, hence causes different result
530+
// when running this test suite under Java 7 and 8.
531+
// We change the original sql query a little bit for making the test suite passed
532+
// under different JDK
529533
createQueryTest("windowing.q -- 20. testSTATs",
530534
"""
535+
|select p_mfgr,p_name, p_size, sdev, sdev_pop, size(uniq_size), var, cor, covarp
536+
|from (
531537
|select p_mfgr,p_name, p_size,
532538
|stddev(p_retailprice) over w1 as sdev,
533539
|stddev_pop(p_retailprice) over w1 as sdev_pop,
@@ -538,6 +544,7 @@ abstract class HiveWindowFunctionQueryBaseSuite extends HiveComparisonTest with
538544
|from part
539545
|window w1 as (distribute by p_mfgr sort by p_mfgr, p_name
540546
| rows between 2 preceding and 2 following)
547+
|) t
541548
""".stripMargin, reset = false)
542549

543550
createQueryTest("windowing.q -- 21. testDISTs",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Manufacturer#1 almond antique burnished rose metallic 2 273.70217881648074 273.70217881648074 2 74912.8826888888 1.0 4128.782222222221
2+
Manufacturer#1 almond antique burnished rose metallic 2 258.10677784349235 258.10677784349235 3 66619.10876874991 0.811328754177887 2801.7074999999995
3+
Manufacturer#1 almond antique chartreuse lavender yellow 34 230.90151585470358 230.90151585470358 4 53315.51002399992 0.695639377397664 2210.7864
4+
Manufacturer#1 almond antique salmon chartreuse burlywood 6 202.73109328368946 202.73109328368946 5 41099.896184 0.630785977101214 2009.9536000000007
5+
Manufacturer#1 almond aquamarine burnished black steel 28 121.6064517973862 121.6064517973862 4 14788.129118750014 0.2036684720435979 331.1337500000004
6+
Manufacturer#1 almond aquamarine pink moccasin thistle 42 96.5751586416853 96.5751586416853 3 9326.761266666683 -1.4442181184933883E-4 -0.20666666666708502
7+
Manufacturer#2 almond antique violet chocolate turquoise 14 142.2363169751898 142.2363169751898 3 20231.169866666663 -0.49369526554523185 -1113.7466666666658
8+
Manufacturer#2 almond antique violet turquoise frosted 40 137.76306498840682 137.76306498840682 4 18978.662075 -0.5205630897335946 -1004.4812499999995
9+
Manufacturer#2 almond aquamarine midnight light salmon 2 130.03972279269132 130.03972279269132 5 16910.329504000005 -0.46908967495720255 -766.1791999999995
10+
Manufacturer#2 almond aquamarine rose maroon antique 25 135.55100986344584 135.55100986344584 4 18374.07627499999 -0.6091405874714462 -1128.1787499999987
11+
Manufacturer#2 almond aquamarine sandy cyan gainsboro 18 156.44019460768044 156.44019460768044 3 24473.534488888927 -0.9571686373491608 -1441.4466666666676
12+
Manufacturer#3 almond antique chartreuse khaki white 17 196.7742266885805 196.7742266885805 3 38720.09628888887 0.5557168646224995 224.6944444444446
13+
Manufacturer#3 almond antique forest lavender goldenrod 14 275.14144189852607 275.14144189852607 4 75702.81305 -0.6720833036576083 -1296.9000000000003
14+
Manufacturer#3 almond antique metallic orange dim 19 260.23473614412046 260.23473614412046 5 67722.117896 -0.5703526513979519 -2129.0664
15+
Manufacturer#3 almond antique misty red olive 1 275.9139962356932 275.9139962356932 4 76128.53331875012 -0.577476899644802 -2547.7868749999993
16+
Manufacturer#3 almond antique olive coral navajo 45 260.5815918713796 260.5815918713796 3 67902.76602222225 -0.8710736366736884 -4099.731111111111
17+
Manufacturer#4 almond antique gainsboro frosted violet 10 170.13011889596618 170.13011889596618 3 28944.25735555559 -0.6656975320098423 -1347.4777777777779
18+
Manufacturer#4 almond antique violet mint lemon 39 242.26834609323197 242.26834609323197 4 58693.95151875002 -0.8051852719193339 -2537.328125
19+
Manufacturer#4 almond aquamarine floral ivory bisque 27 234.10001662537326 234.10001662537326 5 54802.817784000035 -0.6046935574240581 -1719.8079999999995
20+
Manufacturer#4 almond aquamarine yellow dodger mint 7 247.3342714197732 247.3342714197732 4 61174.24181875003 -0.5508665654707869 -1719.0368749999975
21+
Manufacturer#4 almond azure aquamarine papaya violet 12 283.3344330566893 283.3344330566893 3 80278.40095555557 -0.7755740084632333 -1867.4888888888881
22+
Manufacturer#5 almond antique blue firebrick mint 31 83.69879024746363 83.69879024746363 3 7005.487488888913 0.39004303087285047 418.9233333333353
23+
Manufacturer#5 almond antique medium spring khaki 6 316.68049612345885 316.68049612345885 4 100286.53662500004 -0.713612911776183 -4090.853749999999
24+
Manufacturer#5 almond antique sky peru orange 2 285.40506298242155 285.40506298242155 5 81456.04997600002 -0.712858514567818 -3297.2011999999986
25+
Manufacturer#5 almond aquamarine dodger light gainsboro 46 285.43749038756283 285.43749038756283 4 81474.56091875004 -0.984128787153391 -4871.028125000002
26+
Manufacturer#5 almond azure blanched chiffon midnight 23 315.9225931564038 315.9225931564038 3 99807.08486666664 -0.9978877469246936 -5664.856666666666

sql/hive/src/test/resources/golden/windowing.q -- 20. testSTATs-0-da0e0cca69e42118a96b8609b8fa5838

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)