private void writeRecordFields(GroupType schema, Schema tajoSchema, Tuple tuple) {
   List<Type> fields = schema.getFields();
   // Parquet ignores Tajo NULL_TYPE columns, so the index may differ.
   int index = 0;
   for (int tajoIndex = 0; tajoIndex < tajoSchema.size(); ++tajoIndex) {
     Column column = tajoSchema.getColumn(tajoIndex);
     if (column.getDataType().getType() == TajoDataTypes.Type.NULL_TYPE) {
       continue;
     }
     Type fieldType = fields.get(index);
     if (!tuple.isBlankOrNull(tajoIndex)) {
       recordConsumer.startField(fieldType.getName(), index);
       writeValue(column, tuple, tajoIndex);
       recordConsumer.endField(fieldType.getName(), index);
     } else if (fieldType.isRepetition(Type.Repetition.REQUIRED)) {
       throw new RuntimeException("Null-value for required field: " + column.getSimpleName());
     }
     ++index;
   }
 }
  private void writeValue(Column column, Tuple tuple, int index) {
    switch (column.getDataType().getType()) {
      case BOOLEAN:
        recordConsumer.addBoolean(tuple.getBool(index));
        break;
      case BIT:
      case INT2:
      case INT4:
        recordConsumer.addInteger(tuple.getInt4(index));
        break;
      case INT8:
        recordConsumer.addLong(tuple.getInt8(index));
        break;
      case FLOAT4:
        recordConsumer.addFloat(tuple.getFloat4(index));
        break;
      case FLOAT8:
        recordConsumer.addDouble(tuple.getFloat8(index));
        break;
      case CHAR:
        if (tuple.size(index) > column.getDataType().getLength()) {
          throw new ValueTooLongForTypeCharactersException(column.getDataType().getLength());
        }

        recordConsumer.addBinary(Binary.fromByteArray(tuple.getTextBytes(index)));
        break;
      case TEXT:
        recordConsumer.addBinary(Binary.fromByteArray(tuple.getTextBytes(index)));
        break;
      case DATE:
        // Parquet DATE type is based on Unix Epoch(Jan 1, 1970).
        recordConsumer.addInteger(tuple.getInt4(index) - DateTimeConstants.UNIX_EPOCH_JDATE);
        break;
      case PROTOBUF:
      case BLOB:
        recordConsumer.addBinary(Binary.fromByteArray(tuple.getBytes(index)));
        break;
      default:
        break;
    }
  }
 @Override
 public void writeValue(RecordConsumer recordConsumer) {
   recordConsumer.addFloat(value);
 }
 /**
  * Writes a Tuple to the file.
  *
  * @param tuple The Tuple to write to the file.
  */
 @Override
 public void write(Tuple tuple) {
   recordConsumer.startMessage();
   writeRecordFields(rootSchema, rootTajoSchema, tuple);
   recordConsumer.endMessage();
 }