Skip to content

Commit 33d0b37

Browse files
committed
[query] move checkRVDKeys from HailContext to RVD$
1 parent ea46cb3 commit 33d0b37

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

hail/hail/src/is/hail/HailContext.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ class HailContext private (
162162
) {
163163
def stop(): Unit = HailContext.stop()
164164

165-
var checkRVDKeys: Boolean = false
166-
167165
def version: String = is.hail.HAIL_PRETTY_VERSION
168166

169167
private[this] def fileAndLineCounts(

hail/hail/src/is/hail/rvd/RVD.scala

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,9 @@ class RVD(
10611061
}
10621062

10631063
object RVD {
1064+
1065+
var CheckRvdKeyOrderingForTesting: Boolean = false
1066+
10641067
def empty(ctx: ExecuteContext, typ: RVDType): RVD =
10651068
RVD.empty(ctx.stateManager, typ)
10661069

@@ -1313,15 +1316,10 @@ object RVD {
13131316
RVDPartitioner.fromKeySamples(ctx, typ, min, max, samples, nPartitions, partitionKey)
13141317
}
13151318

1316-
def apply(
1317-
typ: RVDType,
1318-
partitioner: RVDPartitioner,
1319-
crdd: ContextRDD[Long],
1320-
): RVD =
1321-
if (!HailContext.get.checkRVDKeys)
1322-
new RVD(typ, partitioner, crdd)
1323-
else
1324-
new RVD(typ, partitioner, crdd).checkKeyOrdering()
1319+
def apply(typ: RVDType, partitioner: RVDPartitioner, crdd: ContextRDD[Long]): RVD = {
1320+
val rvd = new RVD(typ, partitioner, crdd)
1321+
if (CheckRvdKeyOrderingForTesting) rvd.checkKeyOrdering() else rvd
1322+
}
13251323

13261324
def unify(execCtx: ExecuteContext, rvds: Seq[RVD]): Seq[RVD] = {
13271325
if (rvds.length == 1 || rvds.forall(_.rowPType == rvds.head.rowPType))

hail/hail/test/src/is/hail/HailSuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import is.hail.expr.ir.defs.{
1111
}
1212
import is.hail.expr.ir.lowering.IrMetadata
1313
import is.hail.io.fs.{FS, HadoopFS}
14+
import is.hail.rvd.RVD
1415
import is.hail.types.virtual._
1516
import is.hail.utils._
1617
import is.hail.variant.ReferenceGenome
@@ -29,6 +30,8 @@ import org.testng.ITestContext
2930
import org.testng.annotations.{AfterClass, AfterSuite, BeforeClass, BeforeSuite}
3031

3132
object HailSuite {
33+
RVD.CheckRvdKeyOrderingForTesting = true
34+
3235
val theHailClassLoader: HailClassLoader =
3336
new HailClassLoader(getClass.getClassLoader)
3437

@@ -67,7 +70,6 @@ class HailSuite extends TestNGSuite with TestUtils {
6770
skipLoggingConfiguration = true,
6871
)
6972
HailSuite.hc_ = HailContext(backend)
70-
HailSuite.hc_.checkRVDKeys = true
7173
}
7274

7375
@BeforeClass

0 commit comments

Comments
 (0)