Object getter()

in amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/lookup/filter/RowDataPredicate.java [208:253]


  Object getter(RowData rowData) {
    int pos = fieldIndex;
    if (rowData.isNullAt(pos)) {
      return null;
    }
    Preconditions.checkNotNull(dataType);
    LogicalType logicalType = dataType.getLogicalType();
    switch (logicalType.getTypeRoot()) {
      case CHAR:
      case VARCHAR:
        return rowData.getString(pos).toString();
      case BOOLEAN:
        return rowData.getBoolean(pos);
      case BINARY:
      case VARBINARY:
        return rowData.getBinary(pos);
      case DECIMAL:
        DecimalType decimalType = (DecimalType) logicalType;
        return rowData
            .getDecimal(pos, decimalType.getPrecision(), decimalType.getScale())
            .toBigDecimal();
      case TINYINT:
        return rowData.getByte(pos);
      case SMALLINT:
        return rowData.getShort(pos);
      case INTEGER:
      case DATE:
      case INTERVAL_YEAR_MONTH:
      case TIME_WITHOUT_TIME_ZONE:
        return rowData.getInt(pos);
      case BIGINT:
      case INTERVAL_DAY_TIME:
        return rowData.getLong(pos);
      case FLOAT:
        return rowData.getFloat(pos);
      case DOUBLE:
        return rowData.getDouble(pos);
      case TIMESTAMP_WITHOUT_TIME_ZONE:
      case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
        final int timestampPrecision = getPrecision(logicalType);
        return rowData.getTimestamp(pos, timestampPrecision).getMillisecond();
      default:
        throw new IllegalArgumentException(
            String.format("Not supported datatype: %s, field: %s", dataType, fieldName));
    }
  }