use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class VectorColumnGroupGenerator method populateBatchColumn.
private void populateBatchColumn(VectorizedRowBatch batch, int logicalColumnIndex, int size) {
int columnNum = columnNums[logicalColumnIndex];
ColumnVector colVector = batch.cols[columnNum];
GenerateType generateType = generateTypes[logicalColumnIndex];
GenerateCategory category = generateType.getCategory();
Object array = arrays[logicalColumnIndex];
switch(category) {
case BOOLEAN:
{
boolean[] booleanArray = ((boolean[]) array);
long[] vector = ((LongColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = (booleanArray[i] ? 1 : 0);
}
}
break;
case BYTE:
{
byte[] byteArray = ((byte[]) array);
long[] vector = ((LongColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = byteArray[i];
}
}
break;
case SHORT:
{
short[] shortArray = ((short[]) array);
long[] vector = ((LongColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = shortArray[i];
}
}
break;
case INT:
{
int[] intArray = ((int[]) array);
long[] vector = ((LongColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = intArray[i];
}
}
break;
case LONG:
{
long[] longArray = ((long[]) array);
long[] vector = ((LongColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = longArray[i];
}
}
break;
case FLOAT:
{
float[] floatArray = ((float[]) array);
double[] vector = ((DoubleColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = floatArray[i];
}
}
break;
case DOUBLE:
{
double[] doubleArray = ((double[]) array);
double[] vector = ((DoubleColumnVector) colVector).vector;
for (int i = 0; i < size; i++) {
vector[i] = doubleArray[i];
}
}
break;
case STRING:
{
String[] stringArray = ((String[]) array);
BytesColumnVector bytesColVec = ((BytesColumnVector) colVector);
for (int i = 0; i < size; i++) {
byte[] bytes = stringArray[i].getBytes();
bytesColVec.setVal(i, bytes);
}
}
break;
case TIMESTAMP:
{
Timestamp[] timestampArray = ((Timestamp[]) array);
TimestampColumnVector timestampColVec = ((TimestampColumnVector) colVector);
for (int i = 0; i < size; i++) {
Timestamp timestamp = timestampArray[i];
timestampColVec.set(i, timestamp);
}
}
break;
case DATE:
case BINARY:
case DECIMAL:
case VARCHAR:
case CHAR:
case LIST:
case MAP:
case STRUCT:
case UNION:
default:
}
}
Aggregations