PartitionTransformType fromIcebergTransform()

in xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergPartitionSpecExtractor.java [94:120]


  PartitionTransformType fromIcebergTransform(Transform<?, ?> transform) {
    if (transform.isIdentity()) {
      return PartitionTransformType.VALUE;
    }

    String transformName = transform.toString();
    switch (transformName) {
      case "year":
        return PartitionTransformType.YEAR;
      case "month":
        return PartitionTransformType.MONTH;
      case "day":
        return PartitionTransformType.DAY;
      case "hour":
        return PartitionTransformType.HOUR;
    }

    if (transform.isVoid()) {
      throw new NotSupportedException(transformName);
    }

    if (transformName.startsWith(BUCKET)) {
      return PartitionTransformType.BUCKET;
    }

    throw new NotSupportedException(transform.toString());
  }