OmniSciDB  c07336695a
StringOpsIR.cpp File Reference
#include "CodeGenerator.h"
#include "Execute.h"
#include "../Shared/sqldefs.h"
#include "Parser/ParserNode.h"
+ 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)
 
std::vector< int32_t > anonymous_namespace{StringOpsIR.cpp}::get_compared_ids (const StringDictionaryProxy *dict, const SQLOps compare_operator, const std::string &pattern)
 

Function Documentation

◆ string_compress()

int32_t string_compress ( const int64_t  ptr_and_len,
const int64_t  string_dict_handle 
)

Definition at line 47 of file StringOpsIR.cpp.

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

48  {
49  std::string raw_str(reinterpret_cast<char*>(extract_str_ptr_noinline(ptr_and_len)),
50  extract_str_len_noinline(ptr_and_len));
51  auto string_dict_proxy =
52  reinterpret_cast<const StringDictionaryProxy*>(string_dict_handle);
53  return string_dict_proxy->getIdOfString(raw_str);
54 }
int32_t getIdOfString(const std::string &str) const
int8_t * extract_str_ptr_noinline(const uint64_t str_and_len)
int32_t extract_str_len_noinline(const uint64_t str_and_len)
+ Here is the call graph for this function:

◆ string_decode()

uint64_t string_decode ( int8_t *  chunk_iter_,
int64_t  pos 
)

Definition at line 23 of file StringOpsIR.cpp.

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

23  {
24  auto chunk_iter = reinterpret_cast<ChunkIter*>(chunk_iter_);
25  VarlenDatum vd;
26  bool is_end;
27  ChunkIter_get_nth(chunk_iter, pos, false, &vd, &is_end);
28  CHECK(!is_end);
29  return vd.is_null ? 0
30  : (reinterpret_cast<uint64_t>(vd.pointer) & 0xffffffffffff) |
31  (static_cast<uint64_t>(vd.length) << 48);
32 }
bool is_null
Definition: sqltypes.h:73
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:72
#define CHECK(condition)
Definition: Logger.h:187
size_t length
Definition: sqltypes.h:71
+ Here is the call graph for this function:

◆ string_decompress()

uint64_t string_decompress ( const int32_t  string_id,
const int64_t  string_dict_handle 
)

Definition at line 34 of file StringOpsIR.cpp.

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

35  {
36  if (string_id == NULL_INT) {
37  return 0;
38  }
39  auto string_dict_proxy =
40  reinterpret_cast<const StringDictionaryProxy*>(string_dict_handle);
41  auto string_bytes = string_dict_proxy->getStringBytes(string_id);
42  CHECK(string_bytes.first);
43  return (reinterpret_cast<uint64_t>(string_bytes.first) & 0xffffffffffff) |
44  (static_cast<uint64_t>(string_bytes.second) << 48);
45 }
std::pair< char *, size_t > getStringBytes(int32_t string_id) const noexcept
#define NULL_INT
Definition: sqltypes.h:174
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function: