OIiveirra commented on code in PR #69032: URL: https://github.com/apache/doris/pull/69032#discussion_r4435103940
########## fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergSpatialSchemaValidator.java: ########## @@ -0,0 +1,157 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.connector.iceberg; + +import org.apache.doris.connector.spi.DorisConnectorException; + +import org.apache.iceberg.BaseTable; +import org.apache.iceberg.Schema; +import org.apache.iceberg.StaticTableOperations; +import org.apache.iceberg.Table; +import org.apache.iceberg.TableMetadata; +import org.apache.iceberg.TableOperations; +import org.apache.iceberg.TableProperties; +import org.apache.iceberg.encryption.EncryptionManager; +import org.apache.iceberg.io.FileIO; +import org.apache.iceberg.io.LocationProvider; +import org.apache.iceberg.types.Type; +import org.apache.iceberg.types.Types; + +import java.util.Map; + +/** Constraints of the Doris spatial Parquet writer, checked before DDL commits and data writes. */ +final class IcebergSpatialSchemaValidator { + private IcebergSpatialSchemaValidator() { + } + + /** Returns whether any leaf is spatial so V3/Parquet checks also apply to nested columns. */ + static boolean containsSpatial(Type type) { + if (type.typeId() == Type.TypeID.GEOMETRY || type.typeId() == Type.TypeID.GEOGRAPHY) { + return true; + } + boolean spatial = false; + if (type.isNestedType()) { + for (Types.NestedField field : type.asNestedType().fields()) { + spatial |= containsSpatial(field.type()); + } + } + return spatial; + } + + static boolean containsSpatial(Schema schema) { + return schema.columns().stream().anyMatch(field -> containsSpatial(field.type())); + } + + static void validateTable(int formatVersion, String fileFormat) { Review Comment: Fixed in commit `162a69007e3`. FE now rejects referenced `projjson:` CRS before DDL, schema changes, or write planning, matching the BE Parquet writer limitation. Geometry/Geography coverage was added; ordinary key plus spatial value writes remain supported. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
