@SuppressWarnings({
    "squid:S6541",
    "squid:S3776"
  }) /// ignore Cognitive Complexity of methods should not be too high
  // ignore Methods should not perform too many tasks (aka Brain method)
  private static void getValueBufferOfDataType(
      TSDataType dataType, Tablet tablet, int i, ByteBuffer valueBuffer) {

    switch (dataType) {
      case INT32:
        int[] intValues = (int[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i)) {
            valueBuffer.putInt(intValues[index]);
          } else {
            valueBuffer.putInt(Integer.MIN_VALUE);
          }
        }
        break;
      case INT64:
      case TIMESTAMP:
        long[] longValues = (long[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i)) {
            valueBuffer.putLong(longValues[index]);
          } else {
            valueBuffer.putLong(Long.MIN_VALUE);
          }
        }
        break;
      case FLOAT:
        float[] floatValues = (float[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i)) {
            valueBuffer.putFloat(floatValues[index]);
          } else {
            valueBuffer.putFloat(Float.MIN_VALUE);
          }
        }
        break;
      case DOUBLE:
        double[] doubleValues = (double[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i)) {
            valueBuffer.putDouble(doubleValues[index]);
          } else {
            valueBuffer.putDouble(Double.MIN_VALUE);
          }
        }
        break;
      case BOOLEAN:
        boolean[] boolValues = (boolean[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i)) {
            valueBuffer.put(BytesUtils.boolToByte(boolValues[index]));
          } else {
            valueBuffer.put(BytesUtils.boolToByte(false));
          }
        }
        break;
      case TEXT:
      case STRING:
      case BLOB:
        Binary[] binaryValues = (Binary[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i) && binaryValues[index] != null) {
            valueBuffer.putInt(binaryValues[index].getLength());
            valueBuffer.put(binaryValues[index].getValues());
          } else {
            valueBuffer.putInt(Binary.EMPTY_VALUE.getLength());
            valueBuffer.put(Binary.EMPTY_VALUE.getValues());
          }
        }
        break;
      case DATE:
        LocalDate[] dateValues = (LocalDate[]) tablet.getValues()[i];
        for (int index = 0; index < tablet.getRowSize(); index++) {
          if (!tablet.isNull(index, i) && dateValues[index] != null) {
            valueBuffer.putInt(DateUtils.parseDateExpressionToInt(dateValues[index]));
          } else {
            valueBuffer.putInt(EMPTY_DATE_INT);
          }
        }
        break;
      default:
        throw new UnSupportedDataTypeException(
            String.format("Data type %s is not supported.", dataType));
    }
  }
put value in buffer

@param types types list
@param values values list
@param buffer buffer to insert
@throws IoTDBConnectionException
iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java