}
return coi.getWritableConstantValue().toString().length();
} else if (oi instanceof WritableConstantHiveVarcharObjectInspector) {
WritableConstantHiveVarcharObjectInspector wcsoi =
(WritableConstantHiveVarcharObjectInspector) oi;
return wcsoi.getWritableConstantValue().toString().length();
} else if (oi instanceof WritableHiveVarcharObjectInspector) {
return ((WritableHiveVarcharObjectInspector) oi).getMaxLength();
}
} else if (colType.startsWith(serdeConstants.CHAR_TYPE_NAME)) {
// constant char projection
if (oi instanceof ConstantObjectInspector) {
ConstantObjectInspector coi = (ConstantObjectInspector) oi;
// if writable constant is null then return size 0
if (coi.getWritableConstantValue() == null) {
return 0;
}
return coi.getWritableConstantValue().toString().length();
} else if (oi instanceof WritableConstantHiveCharObjectInspector) {
WritableConstantHiveCharObjectInspector wcsoi =
(WritableConstantHiveCharObjectInspector) oi;
return wcsoi.getWritableConstantValue().toString().length();
} else if (oi instanceof WritableHiveCharObjectInspector) {
return ((WritableHiveCharObjectInspector) oi).getMaxLength();
}
} else if (colType.equalsIgnoreCase(serdeConstants.BINARY_TYPE_NAME)) {