|
| 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/catalog/rest/types.h" |
| 21 | + |
| 22 | +#include "iceberg/partition_spec.h" |
| 23 | +#include "iceberg/schema.h" |
| 24 | +#include "iceberg/sort_order.h" |
| 25 | +#include "iceberg/table_metadata.h" |
| 26 | + |
| 27 | +namespace iceberg::rest { |
| 28 | + |
| 29 | +bool CreateTableRequest::operator==(const CreateTableRequest& other) const { |
| 30 | + if (name != other.name || location != other.location || |
| 31 | + stage_create != other.stage_create || properties != other.properties) { |
| 32 | + return false; |
| 33 | + } |
| 34 | + |
| 35 | + if (!schema != !other.schema) { |
| 36 | + return false; |
| 37 | + } |
| 38 | + if (schema && *schema != *other.schema) { |
| 39 | + return false; |
| 40 | + } |
| 41 | + |
| 42 | + if (!partition_spec != !other.partition_spec) { |
| 43 | + return false; |
| 44 | + } |
| 45 | + if (partition_spec && *partition_spec != *other.partition_spec) { |
| 46 | + return false; |
| 47 | + } |
| 48 | + |
| 49 | + if (!write_order != !other.write_order) { |
| 50 | + return false; |
| 51 | + } |
| 52 | + if (write_order && *write_order != *other.write_order) { |
| 53 | + return false; |
| 54 | + } |
| 55 | + |
| 56 | + return true; |
| 57 | +} |
| 58 | + |
| 59 | +bool LoadTableResult::operator==(const LoadTableResult& other) const { |
| 60 | + // Compare primitive fields |
| 61 | + if (metadata_location != other.metadata_location || config != other.config) { |
| 62 | + return false; |
| 63 | + } |
| 64 | + |
| 65 | + // Compare metadata (required) - deep comparison |
| 66 | + if (!metadata != !other.metadata) { |
| 67 | + return false; // One is null, the other isn't |
| 68 | + } |
| 69 | + if (metadata && *metadata != *other.metadata) { |
| 70 | + return false; |
| 71 | + } |
| 72 | + |
| 73 | + return true; |
| 74 | +} |
| 75 | + |
| 76 | +} // namespace iceberg::rest |
0 commit comments