Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARK-24714 AnalysisSuite should use ClassTag to check the runtime in… #21694

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package org.apache.spark.sql.catalyst.analysis

import java.util.TimeZone

import scala.reflect.{classTag, ClassTag}

import org.scalatest.Matchers

import org.apache.spark.sql.catalyst.TableIdentifier
Expand Down Expand Up @@ -518,9 +520,10 @@ class AnalysisSuite extends AnalysisTest with Matchers {
}

test("SPARK-22614 RepartitionByExpression partitioning") {
def checkPartitioning[T <: Partitioning](numPartitions: Int, exprs: Expression*): Unit = {
def checkPartitioning[T <: Partitioning: ClassTag](numPartitions: Int,
exprs: Expression*): Unit = {
val partitioning = RepartitionByExpression(exprs, testRelation2, numPartitions).partitioning
assert(partitioning.isInstanceOf[T])
assert(classTag[T].runtimeClass.isInstance(partitioning))
}

checkPartitioning[HashPartitioning](numPartitions = 10, exprs = Literal(20))
Expand Down