Skip to content

Commit

Permalink
Fix assert not work on DF with single column
Browse files Browse the repository at this point in the history
  • Loading branch information
zeotuan committed Dec 28, 2024
1 parent cd173ef commit e6caa63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ Expected DataFrame Row Count: '$expectedCount'
if (actualCount != expectedCount) {
throw DatasetCountMismatch(countMismatchMessage(actualCount, expectedCount))
}

val joined = ds1
.joinPair(ds2, primaryKeys)
joined.show(false)
joined.printSchema()
val unequalDf = ds1
.joinPair(ds2, primaryKeys)
.filter((p: (T, T)) => !customEquals(p._1, p._2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.github.mrpowers.spark.fast.tests

import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._
import org.apache.spark.sql.{DataFrame, Dataset, Encoder}
import org.apache.spark.sql.{DataFrame, Dataset, Encoder, Row}

import scala.reflect.ClassTag

Expand Down Expand Up @@ -33,7 +33,7 @@ private object DatasetUtils {
val leftCols = columns.map(n => col(s"l.$n"))
val rightCols = columns.map(n => col(s"r.$n"))
val (pair1, pair2) =
if (columns.length == 1)
if (columns.length == 1 && !(implicitly[ClassTag[T]].runtimeClass == classOf[Row]))
(leftCols.head, rightCols.head)
else
(struct(leftCols: _*), struct(rightCols: _*))
Expand Down

0 comments on commit e6caa63

Please sign in to comment.