@Test public void testIncrement6() { Schema schema = new Schema() .addColumn("l_orderkey", Type.FLOAT8) .addColumn("l_linenumber", Type.FLOAT8) .addColumn("final", Type.FLOAT8); SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema); Tuple s = new VTuple(3); s.put(0, DatumFactory.createFloat8(1.1d)); s.put(1, DatumFactory.createFloat8(1.1d)); s.put(2, DatumFactory.createFloat8(1.1d)); Tuple e = new VTuple(3); e.put(0, DatumFactory.createFloat8(4.1d)); e.put(1, DatumFactory.createFloat8(2.1d)); e.put(2, DatumFactory.createFloat8(3.1d)); TupleRange expected = new TupleRange(sortSpecs, s, e); UniformRangePartition partitioner = new UniformRangePartition(expected, sortSpecs); assertEquals(24, partitioner.getTotalCardinality().longValue()); Tuple beforeOverflow = partitioner.increment(s, 5, 2); assertTrue(1.1d == beforeOverflow.get(0).asFloat8()); assertTrue(2.1d == beforeOverflow.get(1).asFloat8()); assertTrue(3.1d == beforeOverflow.get(2).asFloat8()); Tuple overflow = partitioner.increment(beforeOverflow, 1, 2); assertTrue(2.1d == overflow.get(0).asFloat8()); assertTrue(1.1d == overflow.get(1).asFloat8()); assertTrue(1.1d == overflow.get(2).asFloat8()); }
public Tuple increment(final Tuple last, final long inc, final int baseDigit) { BigDecimal [] incs = new BigDecimal[last.size()]; boolean [] overflowFlag = new boolean[last.size()]; BigDecimal [] result; BigDecimal value = new BigDecimal(inc); BigDecimal [] reverseCardsForDigit = new BigDecimal[baseDigit + 1]; for (int i = baseDigit; i >= 0; i--) { if (i == baseDigit) { reverseCardsForDigit[i] = colCards[i]; } else { reverseCardsForDigit[i] = reverseCardsForDigit[i+1].multiply(colCards[i]); } } for (int i = 0; i < baseDigit; i++) { result = value.divideAndRemainder(reverseCardsForDigit[i + 1]); incs[i] = result[0]; value = result[1]; } int finalId = baseDigit; incs[finalId] = value; for (int i = finalId; i >= 0; i--) { if (isOverflow(i, last.get(i), incs[i], sortSpecs)) { if (i == 0) { throw new RangeOverflowException(range, last, incs[i].longValue()); } long rem = incrementAndGetReminder(i, last.get(i), value.longValue()); incs[i] = new BigDecimal(rem); incs[i - 1] = incs[i-1].add(new BigDecimal(1)); overflowFlag[i] = true; } else { if (i > 0) { incs[i] = value; break; } } } for (int i = 0; i < incs.length; i++) { if (incs[i] == null) { incs[i] = new BigDecimal(0); } } Tuple end = new VTuple(sortSpecs.length); Column column; for (int i = 0; i < last.size(); i++) { column = sortSpecs[i].getSortKey(); switch (column.getDataType().getType()) { case CHAR: if (overflowFlag[i]) { end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue()))); } break; case BIT: if (overflowFlag[i]) { end.put(i, DatumFactory.createBit( (byte) (range.getStart().get(i).asByte() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue()))); } break; case INT2: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt2( (short) (range.getStart().get(i).asInt2() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue()))); } break; case INT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt4( (int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { if (sortSpecs[i].isAscending()) { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() - incs[i].longValue()))); } } break; case INT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt8( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue())); } break; case FLOAT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat4( range.getStart().get(i).asFloat4() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue())); } break; case FLOAT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat8( range.getStart().get(i).asFloat8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue())); } break; case TEXT: if (overflowFlag[i]) { end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } else { end.put(i, DatumFactory.createText( ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } break; case DATE: if (overflowFlag[i]) { end.put(i, DatumFactory.createDate((int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createDate((int) (last.get(i).asInt4() + incs[i].longValue()))); } break; case TIME: if (overflowFlag[i]) { end.put(i, DatumFactory.createTime(range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTime(last.get(i).asInt8() + incs[i].longValue())); } break; case TIMESTAMP: if (overflowFlag[i]) { end.put(i, DatumFactory.createTimeStampFromMillis( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTimeStampFromMillis(last.get(i).asInt8() + incs[i].longValue())); } break; default: throw new UnsupportedOperationException(column.getDataType() + " is not supported yet"); } } return end; }
UniformRangePartition extends RangePartitionAlgorithm { public Tuple increment(final Tuple last, final long inc, final int baseDigit) { BigDecimal [] incs = new BigDecimal[last.size()]; boolean [] overflowFlag = new boolean[last.size()]; BigDecimal [] result; BigDecimal value = new BigDecimal(inc); BigDecimal [] reverseCardsForDigit = new BigDecimal[baseDigit + 1]; for (int i = baseDigit; i >= 0; i--) { if (i == baseDigit) { reverseCardsForDigit[i] = colCards[i]; } else { reverseCardsForDigit[i] = reverseCardsForDigit[i+1].multiply(colCards[i]); } } for (int i = 0; i < baseDigit; i++) { result = value.divideAndRemainder(reverseCardsForDigit[i + 1]); incs[i] = result[0]; value = result[1]; } int finalId = baseDigit; incs[finalId] = value; for (int i = finalId; i >= 0; i--) { if (isOverflow(i, last.get(i), incs[i], sortSpecs)) { if (i == 0) { throw new RangeOverflowException(range, last, incs[i].longValue()); } long rem = incrementAndGetReminder(i, last.get(i), value.longValue()); incs[i] = new BigDecimal(rem); incs[i - 1] = incs[i-1].add(new BigDecimal(1)); overflowFlag[i] = true; } else { if (i > 0) { incs[i] = value; break; } } } for (int i = 0; i < incs.length; i++) { if (incs[i] == null) { incs[i] = new BigDecimal(0); } } Tuple end = new VTuple(sortSpecs.length); Column column; for (int i = 0; i < last.size(); i++) { column = sortSpecs[i].getSortKey(); switch (column.getDataType().getType()) { case CHAR: if (overflowFlag[i]) { end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue()))); } break; case BIT: if (overflowFlag[i]) { end.put(i, DatumFactory.createBit( (byte) (range.getStart().get(i).asByte() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue()))); } break; case INT2: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt2( (short) (range.getStart().get(i).asInt2() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue()))); } break; case INT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt4( (int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { if (sortSpecs[i].isAscending()) { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() - incs[i].longValue()))); } } break; case INT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt8( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue())); } break; case FLOAT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat4( range.getStart().get(i).asFloat4() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue())); } break; case FLOAT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat8( range.getStart().get(i).asFloat8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue())); } break; case TEXT: if (overflowFlag[i]) { end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } else { end.put(i, DatumFactory.createText( ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } break; case DATE: if (overflowFlag[i]) { end.put(i, DatumFactory.createDate((int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createDate((int) (last.get(i).asInt4() + incs[i].longValue()))); } break; case TIME: if (overflowFlag[i]) { end.put(i, DatumFactory.createTime(range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTime(last.get(i).asInt8() + incs[i].longValue())); } break; case TIMESTAMP: if (overflowFlag[i]) { end.put(i, DatumFactory.createTimeStampFromMillis( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTimeStampFromMillis(last.get(i).asInt8() + incs[i].longValue())); } break; default: throw new UnsupportedOperationException(column.getDataType() + " is not supported yet"); } } return end; } }
UniformRangePartition extends RangePartitionAlgorithm { public Tuple increment(final Tuple last, final long inc, final int baseDigit) { BigDecimal [] incs = new BigDecimal[last.size()]; boolean [] overflowFlag = new boolean[last.size()]; BigDecimal [] result; BigDecimal value = new BigDecimal(inc); BigDecimal [] reverseCardsForDigit = new BigDecimal[baseDigit + 1]; for (int i = baseDigit; i >= 0; i--) { if (i == baseDigit) { reverseCardsForDigit[i] = colCards[i]; } else { reverseCardsForDigit[i] = reverseCardsForDigit[i+1].multiply(colCards[i]); } } for (int i = 0; i < baseDigit; i++) { result = value.divideAndRemainder(reverseCardsForDigit[i + 1]); incs[i] = result[0]; value = result[1]; } int finalId = baseDigit; incs[finalId] = value; for (int i = finalId; i >= 0; i--) { if (isOverflow(i, last.get(i), incs[i], sortSpecs)) { if (i == 0) { throw new RangeOverflowException(range, last, incs[i].longValue()); } long rem = incrementAndGetReminder(i, last.get(i), value.longValue()); incs[i] = new BigDecimal(rem); incs[i - 1] = incs[i-1].add(new BigDecimal(1)); overflowFlag[i] = true; } else { if (i > 0) { incs[i] = value; break; } } } for (int i = 0; i < incs.length; i++) { if (incs[i] == null) { incs[i] = new BigDecimal(0); } } Tuple end = new VTuple(sortSpecs.length); Column column; for (int i = 0; i < last.size(); i++) { column = sortSpecs[i].getSortKey(); switch (column.getDataType().getType()) { case CHAR: if (overflowFlag[i]) { end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue()))); } break; case BIT: if (overflowFlag[i]) { end.put(i, DatumFactory.createBit( (byte) (range.getStart().get(i).asByte() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue()))); } break; case INT2: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt2( (short) (range.getStart().get(i).asInt2() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue()))); } break; case INT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt4( (int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { if (sortSpecs[i].isAscending()) { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() - incs[i].longValue()))); } } break; case INT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt8( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue())); } break; case FLOAT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat4( range.getStart().get(i).asFloat4() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue())); } break; case FLOAT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat8( range.getStart().get(i).asFloat8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue())); } break; case TEXT: if (overflowFlag[i]) { end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } else { end.put(i, DatumFactory.createText( ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } break; case DATE: if (overflowFlag[i]) { end.put(i, DatumFactory.createDate((int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createDate((int) (last.get(i).asInt4() + incs[i].longValue()))); } break; case TIME: if (overflowFlag[i]) { end.put(i, DatumFactory.createTime(range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTime(last.get(i).asInt8() + incs[i].longValue())); } break; case TIMESTAMP: if (overflowFlag[i]) { end.put(i, DatumFactory.createTimeStampFromMillis( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTimeStampFromMillis(last.get(i).asInt8() + incs[i].longValue())); } break; default: throw new UnsupportedOperationException(column.getDataType() + " is not supported yet"); } } return end; } UniformRangePartition(TupleRange totalRange, SortSpec[] sortSpecs, boolean inclusive);  UniformRangePartition(TupleRange range, SortSpec [] sortSpecs); }
UniformRangePartition extends RangePartitionAlgorithm { public Tuple increment(final Tuple last, final long inc, final int baseDigit) { BigDecimal [] incs = new BigDecimal[last.size()]; boolean [] overflowFlag = new boolean[last.size()]; BigDecimal [] result; BigDecimal value = new BigDecimal(inc); BigDecimal [] reverseCardsForDigit = new BigDecimal[baseDigit + 1]; for (int i = baseDigit; i >= 0; i--) { if (i == baseDigit) { reverseCardsForDigit[i] = colCards[i]; } else { reverseCardsForDigit[i] = reverseCardsForDigit[i+1].multiply(colCards[i]); } } for (int i = 0; i < baseDigit; i++) { result = value.divideAndRemainder(reverseCardsForDigit[i + 1]); incs[i] = result[0]; value = result[1]; } int finalId = baseDigit; incs[finalId] = value; for (int i = finalId; i >= 0; i--) { if (isOverflow(i, last.get(i), incs[i], sortSpecs)) { if (i == 0) { throw new RangeOverflowException(range, last, incs[i].longValue()); } long rem = incrementAndGetReminder(i, last.get(i), value.longValue()); incs[i] = new BigDecimal(rem); incs[i - 1] = incs[i-1].add(new BigDecimal(1)); overflowFlag[i] = true; } else { if (i > 0) { incs[i] = value; break; } } } for (int i = 0; i < incs.length; i++) { if (incs[i] == null) { incs[i] = new BigDecimal(0); } } Tuple end = new VTuple(sortSpecs.length); Column column; for (int i = 0; i < last.size(); i++) { column = sortSpecs[i].getSortKey(); switch (column.getDataType().getType()) { case CHAR: if (overflowFlag[i]) { end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue()))); } break; case BIT: if (overflowFlag[i]) { end.put(i, DatumFactory.createBit( (byte) (range.getStart().get(i).asByte() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue()))); } break; case INT2: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt2( (short) (range.getStart().get(i).asInt2() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue()))); } break; case INT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt4( (int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { if (sortSpecs[i].isAscending()) { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() - incs[i].longValue()))); } } break; case INT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt8( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue())); } break; case FLOAT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat4( range.getStart().get(i).asFloat4() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue())); } break; case FLOAT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat8( range.getStart().get(i).asFloat8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue())); } break; case TEXT: if (overflowFlag[i]) { end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } else { end.put(i, DatumFactory.createText( ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } break; case DATE: if (overflowFlag[i]) { end.put(i, DatumFactory.createDate((int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createDate((int) (last.get(i).asInt4() + incs[i].longValue()))); } break; case TIME: if (overflowFlag[i]) { end.put(i, DatumFactory.createTime(range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTime(last.get(i).asInt8() + incs[i].longValue())); } break; case TIMESTAMP: if (overflowFlag[i]) { end.put(i, DatumFactory.createTimeStampFromMillis( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTimeStampFromMillis(last.get(i).asInt8() + incs[i].longValue())); } break; default: throw new UnsupportedOperationException(column.getDataType() + " is not supported yet"); } } return end; } UniformRangePartition(TupleRange totalRange, SortSpec[] sortSpecs, boolean inclusive);  UniformRangePartition(TupleRange range, SortSpec [] sortSpecs); @Override TupleRange[] partition(int partNum); boolean isOverflow(int colId, Datum last, BigDecimal inc, SortSpec [] sortSpecs); long incrementAndGetReminder(int colId, Datum last, long inc); Tuple increment(final Tuple last, final long inc, final int baseDigit); }
UniformRangePartition extends RangePartitionAlgorithm { public Tuple increment(final Tuple last, final long inc, final int baseDigit) { BigDecimal [] incs = new BigDecimal[last.size()]; boolean [] overflowFlag = new boolean[last.size()]; BigDecimal [] result; BigDecimal value = new BigDecimal(inc); BigDecimal [] reverseCardsForDigit = new BigDecimal[baseDigit + 1]; for (int i = baseDigit; i >= 0; i--) { if (i == baseDigit) { reverseCardsForDigit[i] = colCards[i]; } else { reverseCardsForDigit[i] = reverseCardsForDigit[i+1].multiply(colCards[i]); } } for (int i = 0; i < baseDigit; i++) { result = value.divideAndRemainder(reverseCardsForDigit[i + 1]); incs[i] = result[0]; value = result[1]; } int finalId = baseDigit; incs[finalId] = value; for (int i = finalId; i >= 0; i--) { if (isOverflow(i, last.get(i), incs[i], sortSpecs)) { if (i == 0) { throw new RangeOverflowException(range, last, incs[i].longValue()); } long rem = incrementAndGetReminder(i, last.get(i), value.longValue()); incs[i] = new BigDecimal(rem); incs[i - 1] = incs[i-1].add(new BigDecimal(1)); overflowFlag[i] = true; } else { if (i > 0) { incs[i] = value; break; } } } for (int i = 0; i < incs.length; i++) { if (incs[i] == null) { incs[i] = new BigDecimal(0); } } Tuple end = new VTuple(sortSpecs.length); Column column; for (int i = 0; i < last.size(); i++) { column = sortSpecs[i].getSortKey(); switch (column.getDataType().getType()) { case CHAR: if (overflowFlag[i]) { end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue()))); } break; case BIT: if (overflowFlag[i]) { end.put(i, DatumFactory.createBit( (byte) (range.getStart().get(i).asByte() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue()))); } break; case INT2: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt2( (short) (range.getStart().get(i).asInt2() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue()))); } break; case INT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt4( (int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { if (sortSpecs[i].isAscending()) { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() - incs[i].longValue()))); } } break; case INT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createInt8( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue())); } break; case FLOAT4: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat4( range.getStart().get(i).asFloat4() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue())); } break; case FLOAT8: if (overflowFlag[i]) { end.put(i, DatumFactory.createFloat8( range.getStart().get(i).asFloat8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue())); } break; case TEXT: if (overflowFlag[i]) { end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } else { end.put(i, DatumFactory.createText( ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + "")); } break; case DATE: if (overflowFlag[i]) { end.put(i, DatumFactory.createDate((int) (range.getStart().get(i).asInt4() + incs[i].longValue()))); } else { end.put(i, DatumFactory.createDate((int) (last.get(i).asInt4() + incs[i].longValue()))); } break; case TIME: if (overflowFlag[i]) { end.put(i, DatumFactory.createTime(range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTime(last.get(i).asInt8() + incs[i].longValue())); } break; case TIMESTAMP: if (overflowFlag[i]) { end.put(i, DatumFactory.createTimeStampFromMillis( range.getStart().get(i).asInt8() + incs[i].longValue())); } else { end.put(i, DatumFactory.createTimeStampFromMillis(last.get(i).asInt8() + incs[i].longValue())); } break; default: throw new UnsupportedOperationException(column.getDataType() + " is not supported yet"); } } return end; } UniformRangePartition(TupleRange totalRange, SortSpec[] sortSpecs, boolean inclusive);  UniformRangePartition(TupleRange range, SortSpec [] sortSpecs); @Override TupleRange[] partition(int partNum); boolean isOverflow(int colId, Datum last, BigDecimal inc, SortSpec [] sortSpecs); long incrementAndGetReminder(int colId, Datum last, long inc); Tuple increment(final Tuple last, final long inc, final int baseDigit);  }