Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit 0b200cf

Browse files
committed
Make StringDictionaryProxy::storageEntryCount private.
Signed-off-by: ienkovich <[email protected]>
1 parent 73d181e commit 0b200cf

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

omniscidb/QueryEngine/StringOpsIR.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ llvm::Value* CodeGenerator::codegenDictLike(const hdk::ir::ExprPtr like_arg,
206206
dict_like_arg_type->as<hdk::ir::ExtDictionaryType>()->dictId(),
207207
executor()->getRowSetMemoryOwner(),
208208
true);
209-
if (sdp->storageEntryCount() > 200000000) {
209+
if (sdp->entryCount() > 200000000) {
210210
return nullptr;
211211
}
212212
const auto& pattern_type = pattern->type();
@@ -324,7 +324,7 @@ llvm::Value* CodeGenerator::codegenDictStrCmp(const hdk::ir::ExprPtr lhs,
324324
executor()->getRowSetMemoryOwner(),
325325
true);
326326

327-
if (sdp->storageEntryCount() > 200000000) {
327+
if (sdp->entryCount() > 200000000) {
328328
std::runtime_error("Cardinality for string dictionary is too high");
329329
return nullptr;
330330
}
@@ -413,7 +413,7 @@ llvm::Value* CodeGenerator::codegenDictRegexp(const hdk::ir::ExprPtr pattern_arg
413413
const auto dict_id = dict_regexp_arg_type->as<hdk::ir::ExtDictionaryType>()->dictId();
414414
const auto sdp = executor()->getStringDictionaryProxy(
415415
dict_id, executor()->getRowSetMemoryOwner(), true);
416-
if (sdp->storageEntryCount() > 15000000) {
416+
if (sdp->entryCount() > 15000000) {
417417
return nullptr;
418418
}
419419
const auto& pattern_type = pattern->type();

omniscidb/ResultSet/ResultSet.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,12 @@ std::string ResultSet::getStrScalarVal(const ScalarTargetValue& current_scalar,
237237
if (col_type->isExtDictionary()) {
238238
const int32_t dict_id = col_type->as<hdk::ir::ExtDictionaryType>()->dictId();
239239
const auto sdp = getStringDictionaryProxy(dict_id);
240-
oss << "idx:" << ((sdp->storageEntryCount()) ? current_scalar : "null") << ", str:"
241-
<< "\"" << sdp->getString(boost::get<int64_t>(current_scalar)) << "\"";
240+
const auto string_id = boost::get<int64_t>(current_scalar);
241+
oss << "idx:"
242+
<< ((string_id == inline_int_null_value<int32_t>()) ? "null"
243+
: std::to_string(string_id))
244+
<< ", str:"
245+
<< "\"" << sdp->getString(string_id) << "\"";
242246
} else {
243247
if ((col_type->isInt64() &&
244248
boost::get<int64_t>(current_scalar) == std::numeric_limits<int64_t>::min()) ||

omniscidb/StringDictionary/StringDictionaryProxy.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,6 @@ class StringDictionaryProxy {
145145

146146
IdMap buildUnionTranslationMapToOtherProxy(StringDictionaryProxy* dest_proxy) const;
147147

148-
/**
149-
* @brief Returns the number of string entries in the underlying string dictionary,
150-
* at this proxy's generation_ if it is set/valid, otherwise just the current
151-
* size of the dictionary
152-
*
153-
* @return size_t Number of entries in the string dictionary
154-
* (at this proxy's generation if set)
155-
*
156-
*/
157-
size_t storageEntryCount() const;
158-
159148
/**
160149
* @brief Returns the number of transient string entries for this proxy,
161150
*
@@ -211,6 +200,17 @@ class StringDictionaryProxy {
211200
void eachStringSerially(StringDictionary::StringCallback&) const;
212201

213202
private:
203+
/**
204+
* @brief Returns the number of string entries in the underlying string dictionary,
205+
* at this proxy's generation_ if it is set/valid, otherwise just the current
206+
* size of the dictionary
207+
*
208+
* @return size_t Number of entries in the string dictionary
209+
* (at this proxy's generation if set)
210+
*
211+
*/
212+
size_t storageEntryCount() const;
213+
214214
std::string getStringUnlocked(const int32_t string_id) const;
215215
size_t transientEntryCountUnlocked() const;
216216
size_t entryCountUnlocked() const;

omniscidb/Tests/StringDictionaryTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,15 @@ TEST(StringDictionaryProxy, BuildUnionTranslationMapToPartialOverlapProxy) {
717717
const auto transient_source_strings = add_strings_numeric_range(
718718
source_sdp, num_source_transient_entries, source_transient_start_val);
719719
ASSERT_EQ(source_sdp.getBaseDictionary()->getDictId(), 1);
720-
ASSERT_EQ(source_sdp.storageEntryCount(), num_source_persisted_entries);
720+
ASSERT_EQ(source_sdp.getBaseDictionary()->storageEntryCount(),
721+
num_source_persisted_entries);
721722
ASSERT_EQ(source_sdp.transientEntryCount(), num_source_transient_entries);
722723

723724
const auto transient_dest_strings = add_strings_numeric_range(
724725
dest_sdp, num_dest_transient_entries, dest_transient_start_val);
725726
ASSERT_EQ(dest_sdp.getBaseDictionary()->getDictId(), 2);
726-
ASSERT_EQ(dest_sdp.storageEntryCount(), num_dest_persisted_entries);
727+
ASSERT_EQ(dest_sdp.getBaseDictionary()->storageEntryCount(),
728+
num_dest_persisted_entries);
727729
ASSERT_EQ(dest_sdp.transientEntryCount(), num_dest_transient_entries);
728730

729731
const auto id_map = source_sdp.buildUnionTranslationMapToOtherProxy(&dest_sdp);

0 commit comments

Comments
 (0)