|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#include "iceberg/inspect/metadata_table.h" |
| 21 | + |
| 22 | +#include <memory> |
| 23 | +#include <string> |
| 24 | +#include <utility> |
| 25 | + |
| 26 | +#include "iceberg/file_io.h" |
| 27 | +#include "iceberg/schema.h" |
| 28 | +#include "iceberg/schema_field.h" |
| 29 | +#include "iceberg/table_identifier.h" |
| 30 | +#include "iceberg/table_metadata.h" |
| 31 | +#include "iceberg/table_scan.h" |
| 32 | +#include "iceberg/type.h" |
| 33 | +#include "iceberg/util/uuid.h" |
| 34 | + |
| 35 | +namespace iceberg { |
| 36 | + |
| 37 | +BaseMetadataTable::BaseMetadataTable(std::shared_ptr<Table> source_table, |
| 38 | + TableIdentifier identifier, |
| 39 | + std::shared_ptr<Schema> schema) |
| 40 | + : Table(identifier, source_table->metadata(), |
| 41 | + std::string(source_table->metadata_file_location()), source_table->io(), |
| 42 | + source_table->catalog()), |
| 43 | + source_table_(std::move(source_table)), |
| 44 | + schema_(schema) { |
| 45 | + uuid_ = Uuid::GenerateV4().ToString(); |
| 46 | + schemas_[schema->schema_id()] = schema; |
| 47 | +} |
| 48 | + |
| 49 | +BaseMetadataTable::~BaseMetadataTable() = default; |
| 50 | + |
| 51 | +Status BaseMetadataTable::Refresh() { |
| 52 | + return NotSupported("Cannot refresh a metadata table"); |
| 53 | +} |
| 54 | + |
| 55 | +Result<std::unique_ptr<TableScanBuilder>> BaseMetadataTable::NewScan() const { |
| 56 | + return NotSupported("TODO: Scanning metadata tables is not yet supported"); |
| 57 | +}; |
| 58 | + |
| 59 | +Result<std::shared_ptr<Transaction>> BaseMetadataTable::NewTransaction() { |
| 60 | + return NotSupported("Cannot create a transaction for a metadata table"); |
| 61 | +} |
| 62 | + |
| 63 | +Result<std::shared_ptr<UpdateProperties>> BaseMetadataTable::NewUpdateProperties() { |
| 64 | + return NotSupported("Cannot create an update properties for a metadata table"); |
| 65 | +} |
| 66 | + |
| 67 | +Result<std::shared_ptr<UpdateSchema>> BaseMetadataTable::NewUpdateSchema() { |
| 68 | + return NotSupported("Cannot create an update schema for a metadata table"); |
| 69 | +} |
| 70 | + |
| 71 | +Result<std::shared_ptr<UpdateLocation>> BaseMetadataTable::NewUpdateLocation() { |
| 72 | + return NotSupported("Cannot create an update location for a metadata table"); |
| 73 | +} |
| 74 | + |
| 75 | +Result<std::shared_ptr<UpdatePartitionSpec>> BaseMetadataTable::NewUpdatePartitionSpec() { |
| 76 | + return NotSupported("Cannot create an update partition spec for a metadata table"); |
| 77 | +} |
| 78 | + |
| 79 | +Result<std::shared_ptr<UpdateSortOrder>> BaseMetadataTable::NewUpdateSortOrder() { |
| 80 | + return NotSupported("Cannot create an update sort order for a metadata table"); |
| 81 | +} |
| 82 | + |
| 83 | +Result<std::shared_ptr<ExpireSnapshots>> BaseMetadataTable::NewExpireSnapshots() { |
| 84 | + return NotSupported("Cannot create an expire snapshots for a metadata table"); |
| 85 | +} |
| 86 | + |
| 87 | +} // namespace iceberg |
0 commit comments