diff --git a/src/main/java/com/snowflake/kafka/connector/streaming/iceberg/IcebergTableSchemaValidator.java b/src/main/java/com/snowflake/kafka/connector/streaming/iceberg/IcebergTableSchemaValidator.java index 2148dd8de..2cfa3db98 100644 --- a/src/main/java/com/snowflake/kafka/connector/streaming/iceberg/IcebergTableSchemaValidator.java +++ b/src/main/java/com/snowflake/kafka/connector/streaming/iceberg/IcebergTableSchemaValidator.java @@ -62,14 +62,14 @@ private void validateSchemaEvolutionScenario(String tableName, String role) { } private static void validateNoSchemaEvolutionScenario(List columns) { - Optional recordContent = + DescribeTableRow recordContent = columns.stream() .filter(c -> Objects.equals(c.getColumn(), TABLE_COLUMN_CONTENT)) - .findFirst(); - if (!recordContent.isPresent()) { - throw SnowflakeErrors.ERROR_0032.getException("record_content_column_not_found"); - } - if (!isOfStructuredObjectType(recordContent.get())) { + .findFirst() + .orElseThrow( + () -> SnowflakeErrors.ERROR_0032.getException("record_content_column_not_found")); + + if (!isOfStructuredObjectType(recordContent)) { throw SnowflakeErrors.ERROR_0032.getException("invalid_record_content_type"); } }