APISonar


org.apache.pinot.spi.data.FieldSpec.FieldType.TIME

> org > apache > pinot > spi > data > FieldSpec > FieldType > TIME
org APIs apache APIs pinot APIs spi APIs data APIs FieldSpec APIs FieldType APIs TIME APIs

Example 1
public GenericRow next(GenericRow reuse)
      throws IOException {
    for (FieldSpec fieldSpec : _fieldSpecs) {
      String fieldName = fieldSpec.getName();
      Object value = _nextRecord.get(fieldName);
      // Allow default value for non-time columns
      if (value != null || fieldSpec.getFieldType() != FieldSpec.FieldType.TIME) {
        reuse.putField(fieldName, RecordReaderUtils.convert(fieldSpec, value));
      }
    }
    _nextRecord = _reader.read();
    return reuse;
  }
Example 2
public NullValueTransformer(Schema schema) {
    for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) {
      if (!fieldSpec.isVirtualColumn() && fieldSpec.getFieldType() != FieldType.TIME) {
        String fieldName = fieldSpec.getName();
        Object defaultNullValue = fieldSpec.getDefaultNullValue();
        if (fieldSpec.isSingleValueField()) {
          _defaultNullValues.put(fieldName, defaultNullValue);
        } else {
          _defaultNullValues.put(fieldName, new Object[]{defaultNullValue});
        }
      }
    }
  }
Example 3
public static List<FieldSpec> extractFieldSpecs(Schema schema) {
    List<FieldSpec> fieldSpecs = new ArrayList<>();
    for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) {
      if (fieldSpec.getFieldType() == FieldSpec.FieldType.TIME) {
        TimeFieldSpec timeFieldSpec = (TimeFieldSpec) fieldSpec;
        fieldSpecs.add(new TimeFieldSpec(timeFieldSpec.getIncomingGranularitySpec()));
        if (!timeFieldSpec.getOutgoingTimeColumnName().equals(timeFieldSpec.getIncomingTimeColumnName())) {
          fieldSpecs.add(new TimeFieldSpec(timeFieldSpec.getOutgoingGranularitySpec()));
        }
      } else {
        fieldSpecs.add(fieldSpec);
      }
    }
    return fieldSpecs;
  }
Example 4
public GenericRow decode(byte[] payload, GenericRow destination) {
    try {
      JsonNode message = JsonUtils.bytesToJsonNode(payload);
      for (FieldSpec fieldSpec : _schema.getAllFieldSpecs()) {
        FieldSpec incomingFieldSpec =
            fieldSpec.getFieldType() == FieldSpec.FieldType.TIME ? _incomingTimeFieldSpec : fieldSpec;
        String column = incomingFieldSpec.getName();
        destination.putValue(column, JsonUtils.extractValue(message.get(column), incomingFieldSpec));
      }
      return destination;
    } catch (Exception e) {
      LOGGER.error("Caught exception while decoding row, discarding row.", e);
      return null;
    }
  }
Example 5
public GenericRow transform(GenericData.Record from, GenericRow to) {
    for (FieldSpec fieldSpec : _schema.getAllFieldSpecs()) {
      FieldSpec incomingFieldSpec =
          fieldSpec.getFieldType() == FieldSpec.FieldType.TIME ? _incomingTimeFieldSpec : fieldSpec;
      AvroUtils.extractField(incomingFieldSpec, from, to);
    }
    return to;
  }