From 56b3436365aac95d98f04322869b138dcef31d3a Mon Sep 17 00:00:00 2001 From: Zuyu Zhang Date: Mon, 19 Jun 2017 15:53:52 -0500 Subject: [PATCH] QUICKSTEP-95: Fixed the exception due to zero tuple estimation for the empty project expression. --- storage/CMakeLists.txt | 1 + storage/SplitRowStoreTupleStorageSubBlock.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index 6446a831..92a32924 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -907,6 +907,7 @@ target_link_libraries(quickstep_storage_SimpleScalarSeparateChainingHashTable quickstep_utility_Macros quickstep_utility_PrimeNumber) target_link_libraries(quickstep_storage_SplitRowStoreTupleStorageSubBlock + glog quickstep_catalog_CatalogRelationSchema quickstep_expressions_predicate_PredicateCost quickstep_storage_SplitRowStoreValueAccessor diff --git a/storage/SplitRowStoreTupleStorageSubBlock.cpp b/storage/SplitRowStoreTupleStorageSubBlock.cpp index 0e5cfe60..50602085 100644 --- a/storage/SplitRowStoreTupleStorageSubBlock.cpp +++ b/storage/SplitRowStoreTupleStorageSubBlock.cpp @@ -37,6 +37,8 @@ #include "utility/Macros.hpp" #include "utility/ScopedBuffer.hpp" +#include "glog/logging.h" + namespace quickstep { QUICKSTEP_REGISTER_TUPLE_STORE(SplitRowStoreTupleStorageSubBlock, SPLIT_ROW_STORE); @@ -128,6 +130,13 @@ SplitRowStoreTupleStorageSubBlock::SplitRowStoreTupleStorageSubBlock( tuple_slot_bytes_ = per_tuple_null_bitmap_bytes_ + relation.getFixedByteLength() + relation.numVariableLengthAttributes() * (sizeof(std::uint32_t) * 2); + if (tuple_slot_bytes_ == 0) { + LOG(WARNING) + << "Estimated zero bytes per tuple for relation \"" << relation.getName() + << "\" (relation_id: " << relation.getID() + << "). Adjusting to 1 byte."; + tuple_slot_bytes_ = 1; + } // Size the occupancy bitmap by calculating the maximum tuples that can fit // assuming the bare-minimum per tuple storage is used (no variable-length