2020#pragma once
2121
2222#include < map>
23+ #include < memory>
2324#include < string>
2425#include < vector>
2526
@@ -35,10 +36,10 @@ class ICEBERG_EXPORT Table {
3536 virtual ~Table () = default ;
3637
3738 // / \brief Return the full name for this table
38- virtual std::string name () const = 0;
39+ virtual const std::string& name () const = 0;
3940
4041 // / \brief Returns the UUID of the table
41- virtual std::string uuid () const = 0;
42+ virtual const std::string& uuid () const = 0;
4243
4344 // / \brief Refresh the current table metadata
4445 virtual void Refresh () = 0;
@@ -47,25 +48,25 @@ class ICEBERG_EXPORT Table {
4748 virtual const std::shared_ptr<Schema>& schema () const = 0;
4849
4950 // / \brief Return a map of schema for this table
50- virtual std::map<int32_t , std::shared_ptr<Schema>> schemas () const = 0;
51+ virtual const std::map<int32_t , std::shared_ptr<Schema>>& schemas () const = 0;
5152
5253 // / \brief Return the partition spec for this table
5354 virtual const std::shared_ptr<PartitionSpec>& spec () const = 0;
5455
5556 // / \brief Return a map of partition specs for this table
56- virtual std::map<int32_t , std::shared_ptr<PartitionSpec>> specs () const = 0;
57+ virtual const std::map<int32_t , std::shared_ptr<PartitionSpec>>& specs () const = 0;
5758
5859 // / \brief Return the sort order for this table
5960 virtual const std::shared_ptr<SortOrder>& sort_order () const = 0;
6061
6162 // / \brief Return a map of sort order IDs to sort orders for this table
62- virtual std::map<int32_t , std::shared_ptr<SortOrder>> sort_orders () const = 0;
63+ virtual const std::map<int32_t , std::shared_ptr<SortOrder>>& sort_orders () const = 0;
6364
6465 // / \brief Return a map of string properties for this table
65- virtual std::map<std::string, std::string> properties () const = 0;
66+ virtual const std::map<std::string, std::string>& properties () const = 0;
6667
6768 // / \brief Return the table's base location
68- virtual std::string location () const = 0;
69+ virtual const std::string& location () const = 0;
6970
7071 // / \brief Return the table's current snapshot
7172 virtual const std::shared_ptr<Snapshot>& current_snapshot () const = 0;
@@ -75,21 +76,21 @@ class ICEBERG_EXPORT Table {
7576 // /
7677 // / \param snapshot_id the ID of the snapshot to get
7778 // / \return the Snapshot with the given id
78- virtual expected<std::shared_ptr<Snapshot>, Error > snapshot (
79+ virtual expected<std::shared_ptr<Snapshot>, ErrorKind > snapshot (
7980 int64_t snapshot_id) const = 0;
8081
8182 // / \brief Get the snapshots of this table
82- virtual std::vector<std::shared_ptr<Snapshot>> snapshots () const = 0;
83+ virtual const std::vector<std::shared_ptr<Snapshot>>& snapshots () const = 0;
8384
8485 // / \brief Get the snapshot history of this table
8586 // /
8687 // / \return a vector of history entries
87- virtual std::vector<std::shared_ptr<HistoryEntry>> history () const = 0;
88+ virtual const std::vector<std::shared_ptr<HistoryEntry>>& history () const = 0;
8889
8990 // / \brief Create a new table scan for this table
9091 // /
9192 // / Once a table scan is created, it can be refined to project columns and filter data.
92- virtual std::shared_ptr <TableScan> NewScan () const = 0;
93+ virtual std::unique_ptr <TableScan> NewScan () const = 0;
9394
9495 // / \brief Create a new append API to add files to this table and commit
9596 virtual std::shared_ptr<AppendFiles> NewAppend () = 0;
0 commit comments