docs: @Override
      public PartitionMetaData write(List<Writable> record) throws IOException {
          if (!record.isEmpty()) {
              List<Writable> recordList = record instanceof List ? (List<Writable>) record : new ArrayList<>(record);
  
              /* Infer label columns, if necessary. The default is
               * to assume that last column is a label and that the
               * first label column immediately follows the
               * last feature column.
               */
              if (hasLabel) {
                  if (labelLastColumn < 0)
                      labelLastColumn = record.size() - 1;
                  if (labelFirstColumn < 0) {
                      if (featureLastColumn > 0)
                          labelFirstColumn = featureLastColumn + 1;
                      else
                          labelFirstColumn = record.size() - 1;
                  }
              }
  
              /* Infer feature columns, if necessary. The default is
               * to assume that the first column is a feature and that
               * the last feature column immediately precedes the first
               * label column, if there are any.
               */
              if (featureLastColumn < 0) {
                  if (labelFirstColumn > 0)
                      featureLastColumn = labelFirstColumn - 1;
                  else
                      featureLastColumn = recordList.size() - 1;
              }
  
              StringBuilder result = new StringBuilder();
              // Process labels
              if (hasLabel) {
                  // Track label indeces
                  int labelIndex = zeroBasedLabelIndexing ? 0 : 1;
                  for (int i = labelFirstColumn; i <= labelLastColumn; i++) {
                      Writable w = record.get(i);
                      // Handle array-structured Writables, which themselves have multiple columns
                      if (w instanceof ArrayWritable) {
                          ArrayWritable arr = (ArrayWritable) w;
                          for (int j = 0; j < arr.length(); j++) {
                              double val = arr.getDouble(j);
                              // If multilabel, only store indeces of non-zero labels
                              if (multilabel) {
                                  if (val == 1.0) {
                                      result.append(SVMLightRecordReader.LABEL_DELIMITER + labelIndex);
                                  } else if (val != 0.0 && val != -1.0)
                                      throw new NumberFormatException("Expect value -1, 0, or 1 for multilabel targets (found " + val + ")");
                              } else { // Store value of standard label
                                  result.append(SVMLightRecordReader.LABEL_DELIMITER + val);
                              }
                              labelIndex++; // Increment label index for each entry in array
                          }
                      } else { // Handle scalar Writables
                          // If multilabel, only store indeces of non-zero labels
                          if (multilabel) {
                              double val = Double.valueOf(w.toString());
                              if (val == 1.0) {
                                  result.append(SVMLightRecordReader.LABEL_DELIMITER + labelIndex);
                              } else if (val != 0.0 && val != -1.0)
                                  throw new NumberFormatException("Expect value -1, 0, or 1 for multilabel targets (found " + val + ")");
                          } else { // Store value of standard label
                              try { // Encode label as integer, if possible
                                  int val = Integer.valueOf(w.toString());
                                  result.append(SVMLightRecordReader.LABEL_DELIMITER + val);
                              } catch (Exception e) {
                                  double val = Double.valueOf(w.toString());
                                  result.append(SVMLightRecordReader.LABEL_DELIMITER + val);
                              }
                          }
                          labelIndex++; // Increment label index once per scalar Writable
                      }
                  }
              }
              if (result.toString().equals("")) { // Add "unlabeled" label if no labels found
                  result.append(SVMLightRecordReader.LABEL_DELIMITER + UNLABELED);
              }
  
              // Track feature indeces
              int featureIndex = zeroBasedIndexing ? 0 : 1;
              for (int i = featureFirstColumn; i <= featureLastColumn; i++) {
                  Writable w = record.get(i);
                  // Handle array-structured Writables, which themselves have multiple columns
                  if (w instanceof ArrayWritable) {
                      ArrayWritable arr = (ArrayWritable) w;
                      for (int j = 0; j < arr.length(); j++) {
                          double val = arr.getDouble(j);
                          if (val != 0) {
                              result.append(SVMLightRecordReader.PREFERRED_DELIMITER + featureIndex);
                              result.append(SVMLightRecordReader.FEATURE_DELIMITER + val);
                          }
                          featureIndex++; // Increment feature index for each entry in array
                      }
                  } else {
                      double val = w.toDouble();
                      if (val != 0) {
                          result.append(SVMLightRecordReader.PREFERRED_DELIMITER + featureIndex);
                          result.append(SVMLightRecordReader.FEATURE_DELIMITER + val);
                      }
                      featureIndex++; // Increment feature index once per scalar Writable
                  }
              }
  
              // Remove extra label delimiter at beginning
              String line = result.substring(1).toString();
              out.write(line.getBytes());
              out.write(NEW_LINE.getBytes());
  
          }
  
          return PartitionMetaData.builder().numRecordsUpdated(1).build();
      }