Skip to content

Commit

Permalink
[bugfix] Fix physical key pruning issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoterba committed Apr 16, 2019
1 parent 3314180 commit fbf7b28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions hail/python/test/hail/table/test_table.py
Expand Up @@ -1048,6 +1048,11 @@ def test_unicode_ordering(self):
ht = ht.annotate(fd=hl.sorted(a))
assert ht.fd.collect()[0] == ["e", "é"]

def test_physical_key_truncation(self):
path = new_temp_file(suffix='ht')
hl.import_vcf(resource('sample.vcf')).rows().key_by('locus').write(path)
hl.read_table(path).select()._force_count()

def test_large_number_of_fields(tmpdir):
ht = hl.utils.range_table(100)
ht = ht.annotate(**{
Expand Down
5 changes: 3 additions & 2 deletions hail/src/main/scala/is/hail/rvd/AbstractRVDSpec.scala
Expand Up @@ -139,9 +139,10 @@ abstract class AbstractRVDSpec {
def codecSpec: CodecSpec

def read(hc: HailContext, path: String, requestedType: PStruct): RVD = {
val rvdType = RVDType(requestedType, key)
val requestedKey = key.takeWhile(requestedType.hasField)
val rvdType = RVDType(requestedType, requestedKey)

RVD(rvdType, partitioner, hc.readRows(path, encodedType, codecSpec, partFiles, requestedType))
RVD(rvdType, partitioner.coarsen(requestedKey.length), hc.readRows(path, encodedType, codecSpec, partFiles, requestedType))
}

def readLocal(hc: HailContext, path: String, requestedType: PStruct): IndexedSeq[Row] =
Expand Down

0 comments on commit fbf7b28

Please sign in to comment.