throw new UnsupportedOperationException();
}
}
for (int p = 0; p < partNum; p++) {
Tuple sTuple = new VTuple(schema.getColumnNum());
Tuple eTuple = new VTuple(schema.getColumnNum());
for (int i = 0; i < schema.getColumnNum(); i++) {
col = schema.getColumn(i);
sTuple.put(i, prevValues[i]);
switch (col.getDataType().getType()) {
case CHAR:
char endChar = (char) (prevValues[i].asChar() + term[i].asChar());
if (endChar > end.get(i).asByte()) {
eTuple.put(i, end.get(i));
} else {
eTuple.put(i, DatumFactory.createChar(endChar));
}
prevValues[i] = DatumFactory.createChar(endChar);
break;
case BIT:
byte endByte = (byte) (prevValues[i].asByte() + term[i].asByte());
if (endByte > end.get(i).asByte()) {
eTuple.put(i, end.get(i));
} else {
eTuple.put(i, DatumFactory.createBit(endByte));
}
prevValues[i] = DatumFactory.createBit(endByte);
break;
case INT2:
int endShort = (short) (prevValues[i].asInt2() + term[i].asInt2());
if (endShort > end.get(i).asInt2()) {
eTuple.put(i, end.get(i));
} else {
// TODO - to consider overflow
eTuple.put(i, DatumFactory.createInt2((short) endShort));
}
prevValues[i] = DatumFactory.createInt2((short) endShort);
break;
case INT4:
int endInt = (prevValues[i].asInt4() + term[i].asInt4());
if (endInt > end.get(i).asInt4()) {
eTuple.put(i, end.get(i));
} else {
// TODO - to consider overflow
eTuple.put(i, DatumFactory.createInt4(endInt));
}
prevValues[i] = DatumFactory.createInt4(endInt);
break;
case INT8:
long endLong = (prevValues[i].asInt8() + term[i].asInt8());
if (endLong > end.get(i).asInt8()) {
eTuple.put(i, end.get(i));
} else {
// TODO - to consider overflow
eTuple.put(i, DatumFactory.createInt8(endLong));
}
prevValues[i] = DatumFactory.createInt8(endLong);
break;
case FLOAT4:
float endFloat = (prevValues[i].asFloat4() + term[i].asFloat4());
if (endFloat > end.get(i).asFloat4()) {
eTuple.put(i, end.get(i));
} else {
// TODO - to consider overflow
eTuple.put(i, DatumFactory.createFloat4(endFloat));
}
prevValues[i] = DatumFactory.createFloat4(endFloat);
break;
case FLOAT8:
double endDouble = (prevValues[i].asFloat8() + term[i].asFloat8());
if (endDouble > end.get(i).asFloat8()) {
eTuple.put(i, end.get(i));
} else {
// TODO - to consider overflow
eTuple.put(i, DatumFactory.createFloat8(endDouble));
}
prevValues[i] = DatumFactory.createFloat8(endDouble);
break;
case TEXT:
String endString = ((char)(prevValues[i].asChars().charAt(0) + term[i].asChars().charAt(0))) + "";
if (endString.charAt(0) > end.get(i).asChars().charAt(0)) {
eTuple.put(i, end.get(i));
} else {
// TODO - to consider overflow
eTuple.put(i, DatumFactory.createText(endString));
}
prevValues[i] = DatumFactory.createText(endString);
break;
case INET4:
throw new UnsupportedOperationException();