use of org.apache.drill.exec.vector.accessor.ScalarWriter in project drill by apache.
the class HttpdLogRecord method set.
/**
* This method is referenced and called via reflection. This is added as a parsing target for the parser. It will get
* called when the value of a log field is a String data type.
*
* @param field name of field
* @param value value of field
*/
@SuppressWarnings("unused")
public void set(String field, String value) {
if (value != null) {
final ScalarWriter w = strings.get(field);
if (w != null) {
logger.debug("Parsed field: {}, as string: {}", field, value);
w.setString(value);
} else {
logger.warn("No 'string' writer found for field: {}", field);
}
}
}
use of org.apache.drill.exec.vector.accessor.ScalarWriter in project drill by apache.
the class HttpdLogRecord method writeLongColumn.
/**
* Helper function to write a 1D long column
*
* @param rowWriter The row to which the data will be written
* @param name The column name
* @param value The value to be written
*/
private void writeLongColumn(TupleWriter rowWriter, String name, long value) {
ScalarWriter colWriter = getColWriter(rowWriter, name, MinorType.BIGINT);
colWriter.setLong(value);
}
use of org.apache.drill.exec.vector.accessor.ScalarWriter in project drill by apache.
the class HttpdLogRecord method setTime.
/**
* This method is referenced and called via reflection. This is added as a parsing target for the parser. It will get
* called when the value of a log field is a Time data type.
*
* @param field name of field
* @param value value of field
*/
@SuppressWarnings("unused")
public void setTime(String field, String value) {
if (value != null) {
final ScalarWriter w = times.get(field);
if (w != null) {
logger.debug("Parsed field: {}, as long: {}", field, value);
w.setTime(LocalTime.parse(value));
} else {
logger.warn("No 'date' writer found for field: {}", field);
}
}
}
use of org.apache.drill.exec.vector.accessor.ScalarWriter in project drill by apache.
the class HDF5BatchReader method writeFloat4Column.
private void writeFloat4Column(TupleWriter rowWriter, String name, float value) {
ScalarWriter colWriter = getColWriter(rowWriter, name, TypeProtos.MinorType.FLOAT4);
colWriter.setDouble(value);
}
use of org.apache.drill.exec.vector.accessor.ScalarWriter in project drill by apache.
the class HDF5BatchReader method writeTimestampListColumn.
private void writeTimestampListColumn(TupleWriter rowWriter, String name, long[] list) {
int index = rowWriter.tupleSchema().index(name);
if (index == -1) {
ColumnMetadata colSchema = MetadataUtils.newScalar(name, TypeProtos.MinorType.TIMESTAMP, TypeProtos.DataMode.REPEATED);
index = rowWriter.addColumn(colSchema);
}
ScalarWriter arrayWriter = rowWriter.column(index).array().scalar();
for (long l : list) {
arrayWriter.setTimestamp(Instant.ofEpochMilli(l));
}
}
Aggregations