OmniSciDB  a47db9e897
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StringOpsIR.cpp File Reference
#include "CodeGenerator.h"
#include "Execute.h"
#include "../Shared/sqldefs.h"
#include "Parser/ParserNode.h"
#include <boost/locale/conversion.hpp>
+ Include dependency graph for StringOpsIR.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{StringOpsIR.cpp}
 

Functions

uint64_t string_decode (int8_t *chunk_iter_, int64_t pos)
 
uint64_t string_decompress (const int32_t string_id, const int64_t string_dict_handle)
 
int32_t string_compress (const int64_t ptr_and_len, const int64_t string_dict_handle)
 
int32_t lower_encoded (int32_t string_id, int64_t string_dict_proxy_address)
 
std::vector< int32_t > anonymous_namespace{StringOpsIR.cpp}::get_compared_ids (const StringDictionaryProxy *dict, const SQLOps compare_operator, const std::string &pattern)
 

Function Documentation

int32_t lower_encoded ( int32_t  string_id,
int64_t  string_dict_proxy_address 
)

Definition at line 58 of file StringOpsIR.cpp.

References StringDictionaryProxy::getOrAddTransient(), and StringDictionaryProxy::getString().

58  {
59  StringDictionaryProxy* string_dict_proxy =
60  reinterpret_cast<StringDictionaryProxy*>(string_dict_proxy_address);
61  auto str = string_dict_proxy->getString(string_id);
62  return string_dict_proxy->getOrAddTransient(boost::locale::to_lower(str));
63 }
std::string getString(int32_t string_id) const
int32_t getOrAddTransient(const std::string &str)

+ Here is the call graph for this function:

int32_t string_compress ( const int64_t  ptr_and_len,
const int64_t  string_dict_handle 
)

Definition at line 49 of file StringOpsIR.cpp.

References extract_str_len_noinline(), extract_str_ptr_noinline(), and StringDictionaryProxy::getIdOfString().

50  {
51  std::string raw_str(reinterpret_cast<char*>(extract_str_ptr_noinline(ptr_and_len)),
52  extract_str_len_noinline(ptr_and_len));
53  auto string_dict_proxy =
54  reinterpret_cast<const StringDictionaryProxy*>(string_dict_handle);
55  return string_dict_proxy->getIdOfString(raw_str);
56 }
int8_t * extract_str_ptr_noinline(const uint64_t str_and_len)
int32_t extract_str_len_noinline(const uint64_t str_and_len)
int32_t getIdOfString(const std::string &str) const

+ Here is the call graph for this function:

uint64_t string_decode ( int8_t *  chunk_iter_,
int64_t  pos 
)

Definition at line 25 of file StringOpsIR.cpp.

References CHECK(), ChunkIter_get_nth(), VarlenDatum::is_null, VarlenDatum::length, and VarlenDatum::pointer.

25  {
26  auto chunk_iter = reinterpret_cast<ChunkIter*>(chunk_iter_);
27  VarlenDatum vd;
28  bool is_end;
29  ChunkIter_get_nth(chunk_iter, pos, false, &vd, &is_end);
30  CHECK(!is_end);
31  return vd.is_null ? 0
32  : (reinterpret_cast<uint64_t>(vd.pointer) & 0xffffffffffff) |
33  (static_cast<uint64_t>(vd.length) << 48);
34 }
bool is_null
Definition: sqltypes.h:76
DEVICE void ChunkIter_get_nth(ChunkIter *it, int n, bool uncompress, VarlenDatum *result, bool *is_end)
Definition: ChunkIter.cpp:181
int8_t * pointer
Definition: sqltypes.h:75
CHECK(cgen_state)
size_t length
Definition: sqltypes.h:74

+ Here is the call graph for this function:

uint64_t string_decompress ( const int32_t  string_id,
const int64_t  string_dict_handle 
)

Definition at line 36 of file StringOpsIR.cpp.

References CHECK(), StringDictionaryProxy::getStringBytes(), and NULL_INT.

37  {
38  if (string_id == NULL_INT) {
39  return 0;
40  }
41  auto string_dict_proxy =
42  reinterpret_cast<const StringDictionaryProxy*>(string_dict_handle);
43  auto string_bytes = string_dict_proxy->getStringBytes(string_id);
44  CHECK(string_bytes.first);
45  return (reinterpret_cast<uint64_t>(string_bytes.first) & 0xffffffffffff) |
46  (static_cast<uint64_t>(string_bytes.second) << 48);
47 }
std::pair< char *, size_t > getStringBytes(int32_t string_id) const noexcept
CHECK(cgen_state)
#define NULL_INT
Definition: sqltypes.h:176

+ Here is the call graph for this function: