apache/iceberg · error · UnsupportedOperationException

Iceberg does not support Spark geography edge algorithm:

Error message

Iceberg does not support Spark geography edge algorithm: 

What it means

Iceberg's geography type only supports the SPHERICAL edge-interpolation algorithm. Spark's EdgeInterpolationAlgorithm enum may contain other values (future or non-spherical), and convertAlgorithm rejects anything but SPHERICAL so a new algorithm is not silently dropped.

Source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkTypeToType.java:200

      }
      return Types.GeographyType.of(geography.crs(), convertAlgorithm(geography.algorithm()));
    } else if (atomic instanceof NullType) {
      return Types.UnknownType.get();
    }

    throw new UnsupportedOperationException("Not a supported type: " + atomic.catalogString());
  }

  // Translates Spark's edge-interpolation algorithm to Iceberg's, mirroring
  // TypeToSparkType#convertAlgorithm. Spark supports only the spherical algorithm today; anything
  // else is rejected loudly rather than silently defaulting, so a new Spark algorithm surfaces here
  // instead of being dropped.
  private static EdgeAlgorithm convertAlgorithm(EdgeInterpolationAlgorithm algorithm) {
    switch (algorithm.toString().toUpperCase(Locale.ROOT)) {
      case "SPHERICAL":
        return EdgeAlgorithm.SPHERICAL;
      default:
        throw new UnsupportedOperationException(
            "Iceberg does not support Spark geography edge algorithm: " + algorithm);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Use SPHERICAL edge interpolation in the geography column definition
  2. Upgrade iceberg-spark if a newer version supports the algorithm you need
  3. Drop or change the geography column to a plain geometry/binary if the algorithm cannot be changed

Example fix

// before: GeographyType(crs, algorithm=PLANAR)
// after: define geography with spherical edges
val geo = GeographyType.apply(4326, EdgeInterpolationAlgorithm.SPHERICAL);
Defensive patterns

Strategy: validation

Validate before calling

if (geoType.algorithm() != null && !"SPHERICAL".equalsIgnoreCase(geoType.algorithm().toString())) {
  throw new IllegalArgumentException("Geography must use SPHERICAL edge algorithm");
}

Type guard

boolean unsupportedAlgorithm(GeographyType t) { return t.algorithm() != null && !"SPHERICAL".equalsIgnoreCase(t.algorithm().toString()); }

Try / catch

try { convert(schema); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("edge algorithm")) { /* switch to SPHERICAL */ } throw e; }

Prevention

When it happens

Trigger: Converting a Spark schema whose GeographyType carries an edge algorithm other than SPHERICAL (convertAlgorithm is called from atomic() when translating GeographyType).

Common situations: Using a Spark/geo build that defines additional edge algorithms while pinned to an older iceberg-spark version; misconfigured geography columns with planar or custom algorithms.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/e447c423a5b8023a. Report an issue: GitHub.