bcv.length[row] = bytes.length;
}
};
} else if (types[i].equalsIgnoreCase("double") ||
types[i].equalsIgnoreCase("float")) {
batch.cols[i] = new DoubleColumnVector(batchSize);
columnAssign[i] = new ColumnVectorAssign() {
@Override
public void assign(
ColumnVector columnVector,
int row,
Object value) {
DoubleColumnVector dcv = (DoubleColumnVector) columnVector;
dcv.vector[row] = Double.valueOf(value.toString());
}
};
} else if (types[i].toLowerCase().startsWith("decimal")) {
Pattern decimalPattern = Pattern.compile(
"decimal(?:\\((\\d+)(?:\\,(\\d+))?\\))?", Pattern.CASE_INSENSITIVE);
Matcher mr = decimalPattern.matcher(types[i]);
int precission = 38;
int scale = 0;
if (mr.matches()) {
String typePrecission = mr.group(1);
if (typePrecission != null) {
precission = Integer.parseInt(typePrecission);
}
String typeScale = mr.group(2);
if (typeScale != null) {
scale = Integer.parseInt(typeScale);
}
}
batch.cols[i] = new DecimalColumnVector(batchSize, precission, scale);
columnAssign[i] = new ColumnVectorAssign() {
@Override
public void assign(
ColumnVector columnVector,
int row,
Object value) {
DecimalColumnVector dcv = (DecimalColumnVector) columnVector;
dcv.set(row, (HiveDecimal) value);
}
};
} else {
throw new HiveException("Unimplemented type " + types[i]);
}