malinjawi commented on code in PR #12040: URL: https://github.com/apache/gluten/pull/12040#discussion_r3243726211
########## cpp/velox/compute/delta/DeltaSplit.h: ########## @@ -0,0 +1,151 @@ +/* + * 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. + */ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * Licensed 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. + */ + +#pragma once + +#include <algorithm> +#include <limits> +#include <optional> +#include <vector> + +#include "compute/Runtime.h" +#include "velox/connectors/hive/HiveConnectorSplit.h" + +namespace gluten::delta { + +using namespace facebook::velox; +using namespace facebook::velox::connector; +using namespace facebook::velox::connector::hive; + +enum class DeltaRowIndexFilterType { + kKeepAll, + kIfContained, + kIfNotContained, +}; + +/// Protocol version information for a Delta table. +/// Used to validate that the table supports deletion vectors. +/// Per Delta spec: DVs require Reader v3+ and Writer v7+ with +/// 'deletionVectors' feature flag. +struct DeltaProtocolInfo { + int32_t minReaderVersion; + int32_t minWriterVersion; + std::optional<std::vector<std::string>> readerFeatures; + std::optional<std::vector<std::string>> writerFeatures; + + /// Check if this protocol supports deletion vectors. + /// Returns true if: + /// - minReaderVersion >= 3 + /// - minWriterVersion >= 7 + /// - 'deletionVectors' is in readerFeatures + bool supportsDeletionVectors() const { + if (minReaderVersion < 3 || minWriterVersion < 7) { + return false; + } + if (!readerFeatures.has_value()) { + return false; + } + return std::find(readerFeatures->begin(), readerFeatures->end(), "deletionVectors") != readerFeatures->end(); + } +}; Review Comment: Good point @zhztheplayer, this was carried over from the earlier [delta-dv-read-foundation](https://github.com/apache/gluten/pull/11900) branch, where native had a broader/future-scoped DV descriptor path. For this split PR, native only consumes JVM-materialized DV payloads. The Java-side Delta integration is responsible for gating DV support before handing the payload to native, so this protocol struct and validation path are not needed in the current scope. I removed `DeltaProtocolInfo` and the related validation logic from this PR. Native now keeps only the checks it actually needs here: materialized payload presence, optional cardinality validation, and file statistics consistency. I will take a note of that and maybe we can reintroduce protocol validation later if/when native directly resolves Delta DV descriptors. -- 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]
