avevad commented on code in PR #9397: URL: https://github.com/apache/incubator-gluten/pull/9397#discussion_r2200827686
########## cpp/velox/compute/iceberg/IcebergWriter.cc: ########## @@ -0,0 +1,174 @@ +/* + * 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 "IcebergWriter.h" + +#include "IcebergPartitionSpec.pb.h" +#include "compute/ProtobufUtils.h" +#include "compute/iceberg/IcebergFormat.h" +#include "utils/ConfigExtractor.h" +#include "velox/connectors/hive/iceberg/IcebergDataSink.h" +#include "velox/connectors/hive/iceberg/IcebergDeleteFile.h" + +using namespace facebook::velox; +using namespace facebook::velox::connector::hive; +using namespace facebook::velox::connector::hive::iceberg; +namespace { + +std::shared_ptr<connector::hive::LocationHandle> makeLocationHandle( + std::string targetDirectory, + std::optional<std::string> writeDirectory = std::nullopt, + connector::hive::LocationHandle::TableType tableType = connector::hive::LocationHandle::TableType::kExisting) { + return; Review Comment: Return what? Does this PR even compile? I keep seeing syntax errors here and there, but I don't really understand how can one write such amount of code without compiling it ########## cpp/velox/compute/iceberg/IcebergWriter.cc: ########## @@ -0,0 +1,174 @@ +/* + * 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 "IcebergWriter.h" + +#include "IcebergPartitionSpec.pb.h" +#include "compute/ProtobufUtils.h" +#include "compute/iceberg/IcebergFormat.h" +#include "utils/ConfigExtractor.h" +#include "velox/connectors/hive/iceberg/IcebergDataSink.h" +#include "velox/connectors/hive/iceberg/IcebergDeleteFile.h" + +using namespace facebook::velox; +using namespace facebook::velox::connector::hive; +using namespace facebook::velox::connector::hive::iceberg; +namespace { + +std::shared_ptr<connector::hive::LocationHandle> makeLocationHandle( + std::string targetDirectory, + std::optional<std::string> writeDirectory = std::nullopt, + connector::hive::LocationHandle::TableType tableType = connector::hive::LocationHandle::TableType::kExisting) { + return; +} + +std::shared_ptr<IcebergInsertTableHandle> createIcebergInsertTableHandle( + const RowTypePtr& outputRowType, + const std::string& outputDirectoryPath, + dwio::common::FileFormat fileFormat, + facebook::velox::common::CompressionKind compressionKind, + std::shared_ptr<const IcebergPartitionSpec> spec) { + std::cout <<"output directory" << outputDirectoryPath << std::endl; + std::vector<std::shared_ptr<const connector::hive::HiveColumnHandle>> columnHandles; + + std::vector<std::string> columnNames = outputRowType->names(); + std::vector<TypePtr> columnTypes = outputRowType->children(); + std::vector<std::string> partitionColumns; + partitionColumns.reserve(spec->fields.size()); + for (const auto& field : spec->fields) { + partitionColumns.push_back(field.name); + } + for (auto i = 0; i < columnNames.size(); ++i) { + if (std::find(partitionColumns.begin(), partitionColumns.end(), columnNames[i]) != partitionColumns.end()) { + columnHandles.push_back( + std::make_shared<connector::hive::HiveColumnHandle>( + columnNames.at(i), + connector::hive::HiveColumnHandle::ColumnType::kPartitionKey, + columnTypes.at(i), + columnTypes.at(i))); + } else { + columnHandles.push_back( + std::make_shared<connector::hive::HiveColumnHandle>( + columnNames.at(i), + connector::hive::HiveColumnHandle::ColumnType::kRegular, + columnTypes.at(i), + columnTypes.at(i))); + } Review Comment: Looks like the '}' of else-clause is absent -- 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]
