Fixed- PackedArrayIndexFieldData.chooseStorageFormat compared to Long.MAX_VALUE instead of Long.MIN_VALUE

Also made the LongFieldDataTests.SINGLE_VALUED_SPARSE_RANDOM & LongFieldDataTests.MULTI_VALUED_SPARSE_RANDOM more sparse
This commit is contained in:
Boaz Leskes 2014-04-11 16:40:47 +02:00
parent 1d1ca3befc
commit f549472fea
2 changed files with 4 additions and 4 deletions

View File

@ -261,7 +261,7 @@ public class PackedArrayIndexFieldData extends AbstractIndexFieldData<AtomicNume
}
if (pageIndex == pageSize - 1) {
// end of page, we now know enough to estimate memory usage
if (pageMaxOrdinal == Long.MAX_VALUE) {
if (pageMaxOrdinal == Long.MIN_VALUE) {
// empty page - will use the null reader which just stores size
pagedSingleValuesSize += RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT);
@ -288,7 +288,7 @@ public class PackedArrayIndexFieldData extends AbstractIndexFieldData<AtomicNume
if (pageIndex > 0) {
// last page estimation
pageIndex++;
if (pageMaxOrdinal == Long.MAX_VALUE) {
if (pageMaxOrdinal == Long.MIN_VALUE) {
// empty page - will use the null reader which just stores size
pagedSingleValuesSize += RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT);

View File

@ -281,7 +281,7 @@ public class LongFieldDataTests extends AbstractNumericFieldDataTests {
},
SINGLE_VALUED_SPARSE_RANDOM {
public int numValues(Random r) {
return r.nextFloat() < 0.1f ? 1 : 0;
return r.nextFloat() < 0.01 ? 1 : 0;
}
@Override
@ -291,7 +291,7 @@ public class LongFieldDataTests extends AbstractNumericFieldDataTests {
},
MULTI_VALUED_SPARSE_RANDOM {
public int numValues(Random r) {
return r.nextFloat() < 0.1f ? 1 + r.nextInt(5) : 0;
return r.nextFloat() < 0.01f ? 1 + r.nextInt(5) : 0;
}
@Override