@@ -466,7 +466,10 @@ class AggregateFunctionsTests extends TypedDatasetSuite {
466
466
TypedColumn [X3 [Int , A , B ], A ],
467
467
TypedColumn [X3 [Int , A , B ], B ]
468
468
) => TypedAggregate [X3 [Int , A , B ], Option [Double ]],
469
- sparkFun : (Column , Column ) => Column
469
+ sparkFun : (Column , Column ) => Column ,
470
+ fudger : Tuple2 [Option [BigDecimal ], Option [BigDecimal ]] => Tuple2 [Option [
471
+ BigDecimal
472
+ ], Option [BigDecimal ]] = identity
470
473
)(implicit
471
474
encEv : Encoder [(Int , A , B )],
472
475
encEv2 : Encoder [(Int , Option [Double ])],
@@ -496,7 +499,12 @@ class AggregateFunctionsTests extends TypedDatasetSuite {
496
499
})
497
500
498
501
// Should be the same
499
- tdBivar.toMap ?= compBivar.collect().toMap
502
+ // tdBivar.toMap ?= compBivar.collect().toMap
503
+ DoubleBehaviourUtils .compareMaps(
504
+ tdBivar.toMap,
505
+ compBivar.collect().toMap,
506
+ fudger
507
+ )
500
508
}
501
509
502
510
def univariatePropTemplate [A : TypedEncoder ](
@@ -505,7 +513,10 @@ class AggregateFunctionsTests extends TypedDatasetSuite {
505
513
X2 [Int , A ],
506
514
Option [Double ]
507
515
],
508
- sparkFun : (Column ) => Column
516
+ sparkFun : (Column ) => Column ,
517
+ fudger : Tuple2 [Option [BigDecimal ], Option [BigDecimal ]] => Tuple2 [Option [
518
+ BigDecimal
519
+ ], Option [BigDecimal ]] = identity
509
520
)(implicit
510
521
encEv : Encoder [(Int , A )],
511
522
encEv2 : Encoder [(Int , Option [Double ])],
@@ -534,7 +545,12 @@ class AggregateFunctionsTests extends TypedDatasetSuite {
534
545
})
535
546
536
547
// Should be the same
537
- tdUnivar.toMap ?= compUnivar.collect().toMap
548
+ // tdUnivar.toMap ?= compUnivar.collect().toMap
549
+ DoubleBehaviourUtils .compareMaps(
550
+ tdUnivar.toMap,
551
+ compUnivar.collect().toMap,
552
+ fudger
553
+ )
538
554
}
539
555
540
556
test(" corr" ) {
@@ -571,7 +587,8 @@ class AggregateFunctionsTests extends TypedDatasetSuite {
571
587
evCanBeDoubleB : CatalystCast [B , Double ]
572
588
): Prop = bivariatePropTemplate(xs)(
573
589
covarPop[A , B , X3 [Int , A , B ]],
574
- org.apache.spark.sql.functions.covar_pop
590
+ org.apache.spark.sql.functions.covar_pop,
591
+ fudger = DoubleBehaviourUtils .tolerance(_, BigDecimal (" 100" ))
575
592
)
576
593
577
594
check(forAll(prop[Double , Double ] _))
@@ -614,7 +631,8 @@ class AggregateFunctionsTests extends TypedDatasetSuite {
614
631
evCanBeDoubleA : CatalystCast [A , Double ]
615
632
): Prop = univariatePropTemplate(xs)(
616
633
kurtosis[A , X2 [Int , A ]],
617
- org.apache.spark.sql.functions.kurtosis
634
+ org.apache.spark.sql.functions.kurtosis,
635
+ fudger = DoubleBehaviourUtils .tolerance(_, BigDecimal (" 0.1" ))
618
636
)
619
637
620
638
check(forAll(prop[Double ] _))
0 commit comments