Skip to content

Discrepancy between partition truncation transform in spec vs code (org.apache.iceberg.transforms.Transform)  #5251

@malvarezrohena

Description

@malvarezrohena

I would like some clarification on wether or not Iceberg officially supports partition truncation transform for Fixed or Binary data types.

The specification denotes that the only data types supported for truncate transform are: String, Int, Long, and Decimal. Yet the following code seems to suggest that fixed/binary data types might be supported as well:

static Truncate get(Type type, int width) {
Preconditions.checkArgument(width > 0,
"Invalid truncate width: %s (must be > 0)", width);

switch (type.typeId()) {
  case INTEGER:
    return (Truncate<T>) new TruncateInteger(width);
  case LONG:
    return (Truncate<T>) new TruncateLong(width);
  case DECIMAL:
    return (Truncate<T>) new TruncateDecimal(width);
  case STRING:
    return (Truncate<T>) new TruncateString(width);
  case BINARY:
    return (Truncate<T>) new TruncateByteBuffer(width);
  default:
    throw new UnsupportedOperationException(
        "Cannot truncate type: " + type);
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions