OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StringDictionaryTranslationMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 #pragma once
24 
25 #include "DataMgr/MemoryLevel.h"
26 #include "StringOps/StringOpInfo.h"
27 
28 #include <vector>
29 
31 struct StringDictionaryProxyTranslationMgr;
32 struct CompilationOptions;
33 
34 namespace Data_Namespace {
35 class DataMgr;
36 class AbstractBuffer;
37 } // namespace Data_Namespace
38 
39 class Executor;
40 namespace llvm {
41 class Value;
42 }
43 
44 namespace StringFunctors {
45 enum StringFunctorType : unsigned int;
46 }
48  public:
50  const int32_t source_string_dict_id,
51  const int32_t dest_string_dict_id,
52  const bool translate_intersection_only,
53  const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos,
54  const Data_Namespace::MemoryLevel memory_level,
55  const int device_count,
56  Executor* executor,
57  Data_Namespace::DataMgr* data_mgr,
58  const bool delay_translation);
59 
61  void buildTranslationMap();
62  void createKernelBuffers();
63  llvm::Value* codegen(llvm::Value* str_id_input,
64  const SQLTypeInfo& input_ti,
65  const bool add_nullcheck,
66  const CompilationOptions& co) const;
67 
68  bool isMapValid() const;
69  const int32_t* data() const;
70  int32_t minSourceStringId() const;
71 
72  private:
73  const int32_t source_string_dict_id_;
74  const int32_t dest_string_dict_id_;
76  const std::vector<StringOps_Namespace::StringOpInfo> string_op_infos_;
77  const bool has_null_string_op_;
79  const int device_count_;
82  const StringDictionaryProxy::IdMap* host_translation_map_{nullptr};
83  std::vector<const int32_t*> kernel_translation_maps_;
84  std::vector<Data_Namespace::AbstractBuffer*> device_buffers_;
85 };
const Data_Namespace::MemoryLevel memory_level_
StringDictionaryTranslationMgr(const int32_t source_string_dict_id, const int32_t dest_string_dict_id, const bool translate_intersection_only, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos, const Data_Namespace::MemoryLevel memory_level, const int device_count, Executor *executor, Data_Namespace::DataMgr *data_mgr, const bool delay_translation)
std::vector< const int32_t * > kernel_translation_maps_
std::vector< Data_Namespace::AbstractBuffer * > device_buffers_
llvm::Value * codegen(llvm::Value *str_id_input, const SQLTypeInfo &input_ti, const bool add_nullcheck, const CompilationOptions &co) const
const std::vector< StringOps_Namespace::StringOpInfo > string_op_infos_