提交 ea10d4b4 编写于 作者: 自凡

add flag used to mark partitioned dependent column

上级 b5406db2
......@@ -110,6 +110,10 @@ public:
virtual void setGenerated(bool Generated);
virtual void setHiddenRowKey();
virtual bool isHiddenRowKey();
virtual void setPartitioned();
virtual bool isPartitioned();
virtual void setDependent();
virtual bool isDependent();
public:
int appendTo(std::string& s);
......
......@@ -142,6 +142,8 @@ public:
};
#define COL_FLAG_GENERATED 0x01 // col is generated
#define COL_FLAG_HIDDEN_ROWKEY (0x01 << 1) // 0x02
#define COL_FLAG_PARTITIONED (0x01 << 2) // 0x04
#define COL_FLAG_DEPENDENT (0x01 << 3) // 0x08
// ---------------------ColMeta-----------------------
struct ColMetaHeader {
uint32_t m_nameOffset;
......@@ -406,7 +408,12 @@ void IColMeta::setFlag(unsigned char flag)
}
void IColMeta::setGenerated(bool Generated)
{
m_col->m_colMetaHeader->m_flag |= COL_FLAG_GENERATED;
if (Generated) {
m_col->m_colMetaHeader->m_flag |= COL_FLAG_GENERATED;
} else {
// 0xffff - COL_FLAG_GENERATED to binary 0b11111110
m_col->m_colMetaHeader->m_flag &= (0xffff - COL_FLAG_GENERATED);
}
}
void IColMeta::setHiddenRowKey()
{
......@@ -416,6 +423,22 @@ bool IColMeta::isHiddenRowKey()
{
return m_col->m_colMetaHeader->m_flag & COL_FLAG_HIDDEN_ROWKEY;
}
void IColMeta::setPartitioned()
{
m_col->m_colMetaHeader->m_flag |= COL_FLAG_PARTITIONED;
}
bool IColMeta::isPartitioned()
{
return m_col->m_colMetaHeader->m_flag & COL_FLAG_PARTITIONED;
}
void IColMeta::setDependent()
{
m_col->m_colMetaHeader->m_flag |= COL_FLAG_DEPENDENT;
}
bool IColMeta::isDependent()
{
return m_col->m_colMetaHeader->m_flag & COL_FLAG_DEPENDENT;
}
int IColMeta::appendTo(std::string& s)
{
return m_col->appendTo(s);
......@@ -440,7 +463,6 @@ void IColMeta::setUserData(void* data)
{
m_userData = data;
}
void* IColMeta::getUserData()
{
return m_userData;
......@@ -528,8 +550,7 @@ struct TableMetaInfo : public MetaInfo {
size_t colCount = m_tblMetaHeader->m_colCount;
size_t dataSize = m_tblMetaHeader->m_colsSize;
const size_t maxColCount = 5120;
if (m_data.getRealSize() + dataSize > size ||
colCount > maxColCount)
if (m_data.getRealSize() + dataSize > size || colCount > maxColCount)
return -11;
// parse col meta
......@@ -1678,7 +1699,7 @@ struct MetaDataCollectionInfo : public MetaInfo {
~MetaDataCollectionInfo()
{
if (m_removePtr)
delete[](char*) m_ptr;
delete[] (char*)m_ptr;
clear();
}
......
......@@ -39,7 +39,11 @@ IColMeta* createColMeta(const char* name, int type, int length)
colMeta->setNotNull(NN);
colMeta->setDefault(DEF);
colMeta->setEncoding(ENC);
colMeta->setGenerated(false);
colMeta->setGenerated(true);
colMeta->setHiddenRowKey();
colMeta->setPartitioned();
colMeta->setDependent();
colMeta->setOriginType("varchar");
colMeta->setPrecision(5);
colMeta->setScale(3);
......@@ -351,6 +355,12 @@ TEST(LogRecordImpl, LogRecordImplAPI)
ASSERT_EQ(12345, col_meta->getDecimals());
bool is_generated_column = col_meta->isGenerated();
ASSERT_TRUE(is_generated_column);
bool is_hidden_row_key = col_meta->isHiddenRowKey();
ASSERT_TRUE(is_hidden_row_key);
bool is_partitioned_column = col_meta->isPartitioned();
ASSERT_TRUE(is_partitioned_column);
bool is_dependent_column = col_meta->isDependent();
ASSERT_TRUE(is_dependent_column);
LogMsgFactory::destroy(table_meta);
// 224
......@@ -537,6 +547,12 @@ TEST(LogRecordImpl, LogRecordImplTestPKS1)
ASSERT_EQ(12345, col_meta->getDecimals());
bool is_generated_column = col_meta->isGenerated();
ASSERT_TRUE(is_generated_column);
bool is_hidden_row_key = col_meta->isHiddenRowKey();
ASSERT_TRUE(is_hidden_row_key);
bool is_partitioned_column = col_meta->isPartitioned();
ASSERT_TRUE(is_partitioned_column);
bool is_dependent_column = col_meta->isDependent();
ASSERT_TRUE(is_dependent_column);
// LogMsgFactory::destroy(table_meta);
}
......
......@@ -36,7 +36,11 @@ IColMeta* createColMeta(const char* name, int type, int length)
colMeta->setNotNull(NN);
colMeta->setDefault(DEF);
colMeta->setEncoding(ENC);
colMeta->setGenerated(false);
colMeta->setGenerated(true);
colMeta->setHiddenRowKey();
colMeta->setPartitioned();
colMeta->setDependent();
colMeta->setOriginType("varchar");
colMeta->setPrecision(5);
colMeta->setScale(4);
......@@ -146,7 +150,12 @@ void parseAndcheckRecord(LogRecordImpl& parser, const char* m, size_t msgSize)
ASSERT_EQ(12345, col_meta->getDecimals());
bool is_generated_column = col_meta->isGenerated();
ASSERT_TRUE(is_generated_column);
bool is_hidden_row_key = col_meta->isHiddenRowKey();
ASSERT_TRUE(is_hidden_row_key);
bool is_partitioned_column = col_meta->isPartitioned();
ASSERT_TRUE(is_partitioned_column);
bool is_dependent_column = col_meta->isDependent();
ASSERT_TRUE(is_dependent_column);
LogMsgFactory::destroy(table_meta);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册