OIiveirra commented on code in PR #69032: URL: https://github.com/apache/doris/pull/69032#discussion_r4367994010
########## be/src/core/data_type/data_type_spatial.cpp: ########## @@ -0,0 +1,220 @@ +// 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. + +#include "core/data_type/data_type_spatial.h" + +#include <algorithm> +#include <cctype> +#include <cstring> +#include <string_view> + +#include "agent/be_exec_version_manager.h" +#include "common/exception.h" +#include "core/assert_cast.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type.h" +#include "core/data_type_serde/data_type_varbinary_serde.h" +#include "core/field.h" +#include "core/string_view.h" +#include "exprs/function/geo/wkb_parse.h" +#include "gen_cpp/data.pb.h" + +namespace doris { + +namespace { + +std::string normalize_spatial_crs(std::string crs) { + // Imported ogc:crs84 has default semantics; leave custom CRS/property references unchanged. + constexpr std::string_view default_crs = "OGC:CRS84"; + if (std::ranges::equal(crs, default_crs, [](unsigned char left, unsigned char right) { + return std::tolower(left) == std::tolower(right); + })) { + return std::string(default_crs); + } + return crs; +} + +std::string normalize_spatial_algorithm(PrimitiveType type, std::string algorithm) { + if (type == TYPE_GEOGRAPHY && algorithm.empty()) { + return "spherical"; + } + std::ranges::transform(algorithm, algorithm.begin(), + [](unsigned char c) { return static_cast<char>(std::tolower(c)); }); + return algorithm; +} + +class SpatialParquetSerDe final : public DataTypeVarbinarySerDeBase<ColumnSpatial> { +public: + SpatialParquetSerDe(int nesting_level, bool geographic) + : DataTypeVarbinarySerDeBase<ColumnSpatial>(nesting_level), _geographic(geographic) {} + + Status read_column_from_parquet(IColumn& column, ParquetDecodeSource& source, + const ParquetDecodeContext& context, size_t num_values, + ParquetMaterializationState& state) const override { + const auto start = column.size(); + RETURN_IF_ERROR(DataTypeVarbinarySerDeBase<ColumnSpatial>::read_column_from_parquet( Review Comment: Deferred to a focused performance follow-up. The existing fallback preserves values and NULLs; this finding identifies extra decode calls without measured spatial throughput results. Fusion needs separate in-place StringView/arena-ownership validation and plain/dictionary benchmarks. -- 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]
