use of org.apache.drill.exec.vector.accessor.TupleWriter in project drill by apache.
the class HttpdLogRecord method setWildcard.
/**
* This method is referenced and called via reflection. When the parser processes a field like:
* HTTP.URI:request.firstline.uri.query.* where star is an arbitrary field that the parser found this method will be
* invoked. <br>
*
* @param field name of field
* @param value value of field
*/
@SuppressWarnings("unused")
public void setWildcard(String field, String value) {
if (value != null) {
String cleanedField = HttpdUtils.getFieldNameFromMap(field);
if (flattenWildcards) {
String drillFieldName = HttpdUtils.drillFormattedFieldName(field);
ScalarWriter writer = getColWriter(rootRowWriter, drillFieldName, MinorType.VARCHAR);
writer.setString(value);
} else {
final TupleWriter mapWriter = getWildcardWriter(field);
logger.debug("Parsed wildcard field: {}, as String: {}", field, value);
writeStringColumn(mapWriter, cleanedField, value);
}
}
}
use of org.apache.drill.exec.vector.accessor.TupleWriter in project drill by apache.
the class HttpdLogRecord method setWildcard.
/**
* This method is referenced and called via reflection. When the parser processes a field like:
* HTTP.URI:request.firstline.uri.query.* where star is an arbitrary field that the parser found this method will be
* invoked. <br>
*
* @param field name of field
* @param value value of field
*/
@SuppressWarnings("unused")
public void setWildcard(String field, Long value) {
if (value != null) {
String cleanedField = HttpdUtils.getFieldNameFromMap(field);
if (flattenWildcards) {
String drillFieldName = HttpdUtils.drillFormattedFieldName(field);
ScalarWriter writer = getColWriter(rootRowWriter, drillFieldName, MinorType.BIGINT);
writer.setLong(value);
} else {
final TupleWriter mapWriter = getWildcardWriter(field);
logger.debug("Parsed wildcard field: {}, as long: {}", field, value);
writeLongColumn(mapWriter, cleanedField, value);
}
}
}
use of org.apache.drill.exec.vector.accessor.TupleWriter in project drill by apache.
the class HttpdLogRecord method setWildcard.
/**
* This method is referenced and called via reflection. When the parser processes a field like:
* HTTP.URI:request.firstline.uri.query.* where star is an arbitrary field that the parser found this method will be
* invoked. <br>
*
* @param field name of field
* @param value value of field
*/
@SuppressWarnings("unused")
public void setWildcard(String field, Double value) {
if (value != null) {
String cleanedField = HttpdUtils.getFieldNameFromMap(field);
if (flattenWildcards) {
String drillFieldName = HttpdUtils.drillFormattedFieldName(field);
ScalarWriter writer = getColWriter(rootRowWriter, drillFieldName, MinorType.FLOAT8);
writer.setDouble(value);
} else {
final TupleWriter mapWriter = getWildcardWriter(field);
logger.debug("Parsed wildcard field: {}, as double: {}", field, value);
writeFloatColumn(mapWriter, cleanedField, value);
}
}
}
use of org.apache.drill.exec.vector.accessor.TupleWriter in project drill by apache.
the class AvroColumnConverterFactory method buildMapMembers.
public void buildMapMembers(GenericRecord genericRecord, TupleMetadata providedSchema, TupleWriter tupleWriter, List<ColumnConverter> converters) {
// fill in tuple schema for cases when it contains recursive named record types
TupleMetadata readerSchema = AvroSchemaUtil.convert(genericRecord.getSchema());
TupleMetadata tableSchema = FixedReceiver.Builder.mergeSchemas(providedSchema, readerSchema);
tableSchema.toMetadataList().forEach(tupleWriter::addColumn);
IntStream.range(0, tableSchema.size()).mapToObj(i -> getConverter(providedSchema, readerSchema.metadata(i), tupleWriter.column(i))).forEach(converters::add);
}
Aggregations