Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 05e042c

Browse files
committed
Modify types of column catalog object & add function for layout type
1 parent 9142968 commit 05e042c

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/catalog/column_catalog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ ColumnCatalogObject::ColumnCatalogObject(executor::LogicalTile *tile,
3030
column_name(tile->GetValue(tupleId, ColumnCatalog::ColumnId::COLUMN_NAME)
3131
.ToString()),
3232
column_id(tile->GetValue(tupleId, ColumnCatalog::ColumnId::COLUMN_ID)
33-
.GetAs<uint32_t>()),
33+
.GetAs<oid_t>()),
3434
column_offset(
3535
tile->GetValue(tupleId, ColumnCatalog::ColumnId::COLUMN_OFFSET)
36-
.GetAs<uint32_t>()),
36+
.GetAs<oid_t>()),
3737
column_type(StringToTypeId(
3838
tile->GetValue(tupleId, ColumnCatalog::ColumnId::COLUMN_TYPE)
3939
.ToString())),

src/include/catalog/column_catalog.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class ColumnCatalogObject {
4444

4545
inline oid_t GetTableOid() { return table_oid; }
4646
inline const std::string &GetColumnName() { return column_name; }
47-
inline uint32_t GetColumnId() { return column_id; }
48-
inline uint32_t GetColumnOffset() { return column_offset; }
47+
inline oid_t GetColumnId() { return column_id; }
48+
inline oid_t GetColumnOffset() { return column_offset; }
4949
inline type::TypeId GetColumnType() { return column_type; }
5050
inline size_t GetColumnLength() { return column_length; }
5151
inline bool IsInlined() { return is_inlined; }
@@ -56,8 +56,8 @@ class ColumnCatalogObject {
5656
// member variables
5757
oid_t table_oid;
5858
std::string column_name;
59-
uint32_t column_id;
60-
uint32_t column_offset;
59+
oid_t column_id;
60+
oid_t column_offset;
6161
type::TypeId column_type;
6262
size_t column_length;
6363
bool is_inlined;

src/include/storage/layout.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class Layout : public Printable {
6868
/** @brief Check whether this layout is a column store. */
6969
bool IsColumnStore() const { return (layout_type_ == LayoutType::COLUMN); }
7070

71+
/** @brief Check whether this layout is a hybrid store. */
72+
bool IsHybridStore() const { return (layout_type_ == LayoutType::HYBRID); }
73+
7174
/** @brief Return the layout_oid_ of this object. */
7275
oid_t GetOid() const { return layout_oid_; }
7376

test/catalog/catalog_test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ TEST_F(CatalogTests, LayoutCatalogTest) {
387387
auto first_default_layout = table->GetDefaultLayout();
388388
EXPECT_EQ(ROW_STORE_LAYOUT_OID, first_default_layout->GetOid());
389389
EXPECT_TRUE(first_default_layout->IsRowStore());
390+
EXPECT_FALSE(first_default_layout->IsColumnStore());
391+
EXPECT_FALSE(first_default_layout->IsHybridStore());
390392

391393
// Check the first default layout in pg_layout and pg_table
392394
txn = txn_manager.BeginTransaction();
@@ -416,6 +418,7 @@ TEST_F(CatalogTests, LayoutCatalogTest) {
416418
EXPECT_EQ(default_layout_oid, table->GetDefaultLayout()->GetOid());
417419
EXPECT_FALSE(default_layout->IsColumnStore());
418420
EXPECT_FALSE(default_layout->IsRowStore());
421+
EXPECT_TRUE(default_layout->IsHybridStore());
419422

420423
// Check the changed default layout in pg_layout and pg_table
421424
txn = txn_manager.BeginTransaction();
@@ -442,6 +445,7 @@ TEST_F(CatalogTests, LayoutCatalogTest) {
442445
// Check the created layout
443446
EXPECT_FALSE(other_layout->IsColumnStore());
444447
EXPECT_FALSE(other_layout->IsRowStore());
448+
EXPECT_TRUE(other_layout->IsHybridStore());
445449

446450
// Check the created layout in pg_layout
447451
txn = txn_manager.BeginTransaction();
@@ -465,6 +469,8 @@ TEST_F(CatalogTests, LayoutCatalogTest) {
465469
// Check that default layout is reset and set to row_store.
466470
EXPECT_NE(default_layout, table->GetDefaultLayout());
467471
EXPECT_TRUE(table->GetDefaultLayout()->IsRowStore());
472+
EXPECT_FALSE(table->GetDefaultLayout()->IsColumnStore());
473+
EXPECT_FALSE(table->GetDefaultLayout()->IsHybridStore());
468474
EXPECT_EQ(ROW_STORE_LAYOUT_OID, table->GetDefaultLayout()->GetOid());
469475

470476
// Query pg_layout and pg_table to ensure that the entry is dropped

0 commit comments

Comments
 (0)