@@ -494,107 +494,6 @@ class MatrixTable(val hc: HailContext, val ast: MatrixIR) {
494
494
copyAST(MatrixLiteral (newValue))
495
495
}
496
496
497
- /**
498
- *
499
- * @param right right-hand dataset with which to join
500
- */
501
- def unionCols (right : MatrixTable ): MatrixTable = {
502
- if (entryType != right.entryType) {
503
- fatal(
504
- s """ union_cols: cannot combine datasets with different entry schema
505
- | left entry schema: @1
506
- | right entry schema: @2 """ .stripMargin,
507
- entryType.toString,
508
- right.entryType.toString)
509
- }
510
-
511
- if (! colKeyTypes.sameElements(right.colKeyTypes)) {
512
- fatal(
513
- s """ union_cols: cannot combine datasets with different column key schema
514
- | left column schema: [ ${ colKeyTypes.map(_.toString).mkString(" , " ) }]
515
- | right column schema: [ ${ right.colKeyTypes.map(_.toString).mkString(" , " ) }] """ .stripMargin)
516
- }
517
-
518
- if (colType != right.colType) {
519
- fatal(
520
- s """ union_cols: cannot combine datasets with different column schema
521
- | left column schema: @1
522
- | right column schema: @2 """ .stripMargin,
523
- colType.toString,
524
- right.colType.toString)
525
- }
526
-
527
- if (! rowKeyTypes.sameElements(right.rowKeyTypes)) {
528
- fatal(
529
- s """ union_cols: cannot combine datasets with different row key schema
530
- | left row key schema: @1
531
- | right row key schema: @2 """ .stripMargin,
532
- rowKeyTypes.map(_.toString).mkString(" , " ),
533
- right.rowKeyTypes.map(_.toString).mkString(" , " ))
534
- }
535
-
536
-
537
- val newMatrixType = matrixType.copyParts() // move entries to the end
538
- val newRVRowType = newMatrixType.rvRowType
539
- val leftRVRowType = rvRowType.physicalType
540
- val rightRVRowType = right.rvRowType.physicalType
541
- val localLeftSamples = numCols
542
- val localRightSamples = right.numCols
543
- val leftEntriesIndex = entriesIndex
544
- val rightEntriesIndex = right.entriesIndex
545
- val localEntriesType = matrixType.entryArrayType.physicalType
546
- assert(right.matrixType.entryArrayType == matrixType.entryArrayType)
547
-
548
- val joiner = { (ctx : RVDContext , it : Iterator [JoinedRegionValue ]) =>
549
- val rvb = ctx.rvb
550
- val rv2 = RegionValue ()
551
-
552
- it.map { jrv =>
553
- val lrv = jrv.rvLeft
554
- val rrv = jrv.rvRight
555
-
556
- rvb.start(newRVRowType.physicalType)
557
- rvb.startStruct()
558
- var i = 0
559
- while (i < leftRVRowType.size) {
560
- if (i != leftEntriesIndex)
561
- rvb.addField(leftRVRowType, lrv, i)
562
- i += 1
563
- }
564
- rvb.startArray(localLeftSamples + localRightSamples)
565
-
566
- val leftEntriesOffset = leftRVRowType.loadField(lrv.region, lrv.offset, leftEntriesIndex)
567
- val leftEntriesLength = localEntriesType.loadLength(lrv.region, leftEntriesOffset)
568
- assert(leftEntriesLength == localLeftSamples)
569
-
570
- val rightEntriesOffset = rightRVRowType.loadField(rrv.region, rrv.offset, rightEntriesIndex)
571
- val rightEntriesLength = localEntriesType.loadLength(rrv.region, rightEntriesOffset)
572
- assert(rightEntriesLength == localRightSamples)
573
-
574
- i = 0
575
- while (i < localLeftSamples) {
576
- rvb.addElement(localEntriesType, lrv.region, leftEntriesOffset, i)
577
- i += 1
578
- }
579
-
580
- i = 0
581
- while (i < localRightSamples) {
582
- rvb.addElement(localEntriesType, rrv.region, rightEntriesOffset, i)
583
- i += 1
584
- }
585
-
586
- rvb.endArray()
587
- rvb.endStruct()
588
- rv2.set(ctx.region, rvb.end())
589
- rv2
590
- }
591
- }
592
-
593
- copyMT(matrixType = newMatrixType,
594
- colValues = colValues.copy(value = colValues.value ++ right.colValues.value),
595
- rvd = rvd.orderedJoinDistinct(right.rvd, " inner" , joiner, newMatrixType.canonicalRVDType))
596
- }
597
-
598
497
def makeTable (separator : String = " ." ): Table = {
599
498
matrixType.requireColKeyString()
600
499
requireUniqueSamples(" make_table" )
0 commit comments