摘要:
记录聚合调试相关
数据准备:
数据库准备:
create database test;
表结构准备:
CREATE TABLE IF NOT EXISTS `runoob_tb4`(
`runoob_id` INT AUTO_INCREMENT,
`runoob_title` VARCHAR(100) NOT NULL,
`runoob_author` VARCHAR(40) NOT NULL,
`submission_date` DATE,
PRIMARY KEY ( `runoob_id` )
)ENGINE=TIANMU;
插入数据:
INSERT INTO runoob_tb4
(runoob_title, runoob_author, submission_date)
VALUES
("LEARN-15", "STUDY-151", NOW());
聚合查询:
select runoob_id,runoob_title,count(*) from runoob_tb4 where runoob_title='LEARN-15' GROUP BY runoob_title;
调试处:
dimension_group.h:34
DimensionGroup() : dim_group_type(DGType::DG_NOT_KNOWN), no_obj(0), locks(0) {}
rc_attr.cpp:395
types::BString RCAttr::GetNotNullValueString(const int64_t obj) {
int pack = row2pack(obj);
int offset = row2offset(obj);
static const types::BString void_bs;
if (GetPackType() == common::PackType::STR) {
auto cur_pack = get_packS(pack);
if (!cur_pack) {
TIANMU_LOG(LogCtl_Level::INFO, "rc_attr:GetNotNullValueString get_packS NULL, obj: %d pack: %d offset: %d", obj,
pack, offset);
return void_bs;
}
uint64_t p = reinterpret_cast<uint64_t>(cur_pack);
if (0xffffffffffff == p) {
TIANMU_LOG(LogCtl_Level::INFO, "rc_attr:GetNotNullValueString get_packS 0xffffffffffff, obj: %d pack: %d offset: %d", obj,
pack, offset);
return void_bs;
}
ASSERT(cur_pack != NULL, "Pack ptr is null");
ASSERT(cur_pack->IsLocked(), "Access unlocked pack");
return cur_pack->GetValueBinary(offset);
}
int64_t v = GetNotNullValueInt64(obj);
return DecodeValue_S(v);
}
Pack *RCAttr::get_pack(size_t i) { return reinterpret_cast<Pack *>(get_dpn(i).GetPackPtr() & tag_mask); }
DPN &get_dpn(size_t i) {
if (i >= m_idx.size()) {
TIANMU_LOG(LogCtl_Level::INFO, "rc_attr:get_dpn i: %d >= m_idx.size(): %d", i, m_idx.size());
}
ASSERT(i < m_idx.size(), "bad dpn index " + std::to_string(i) + "/" + std::to_string(m_idx.size()));
return *m_share->get_dpn_ptr(m_idx[i]);
}