OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtensionFunctionsTextTesting.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc., 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 
17 #include "heavydbTypes.h"
18 
19 #ifdef __clang__
20 #pragma clang diagnostic push
21 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
22 #endif
23 
26  return t.size();
27 }
28 
29 #ifndef __CUDACC__
30 
33  const TextEncodingNone& t) {
34  return TextEncodingNone(mgr, t.getString());
35 }
36 
39  const TextEncodingNone& t1,
40  const TextEncodingNone& t2) {
41  return TextEncodingNone(mgr, t1.getString() + ' ' + t2.getString());
42 }
43 
46  const TextEncodingDict t_dict,
47  const TextEncodingNone& t_none) {
48  std::string str = mgr.getString(GET_DICT_DB_ID(mgr, 0), GET_DICT_ID(mgr, 0), t_dict);
49  return mgr.getOrAddTransient(
51 }
52 
55  const TextEncodingNone& t_none,
56  const TextEncodingDict t_dict) {
57  std::string str = mgr.getString(GET_DICT_DB_ID(mgr, 1), GET_DICT_ID(mgr, 1), t_dict);
58  return mgr.getOrAddTransient(
60 }
61 
64  const TextEncodingDict t1,
65  const TextEncodingDict t2) {
66  std::string s1 = mgr.getString(GET_DICT_DB_ID(mgr, 0), GET_DICT_ID(mgr, 0), t1);
67  std::string s2 = mgr.getString(GET_DICT_DB_ID(mgr, 1), GET_DICT_ID(mgr, 1), t2);
68  return mgr.getOrAddTransient(TRANSIENT_DICT_DB_ID, TRANSIENT_DICT_ID, s1 + ' ' + s2);
69 }
70 
73  const TextEncodingDict t) {
74  std::string str = mgr.getString(GET_DICT_DB_ID(mgr, 0), GET_DICT_ID(mgr, 0), t);
75  return mgr.getOrAddTransient(TRANSIENT_DICT_DB_ID, TRANSIENT_DICT_ID, "copy: " + str);
76 }
77 
80  const TextEncodingDict t1,
81  const TextEncodingDict t2,
82  const int32_t select) {
83  std::string str;
84  if (select == 1) {
85  str = mgr.getString(GET_DICT_DB_ID(mgr, 0), GET_DICT_ID(mgr, 0), t1);
86  } else {
87  str = mgr.getString(GET_DICT_DB_ID(mgr, 1), GET_DICT_ID(mgr, 1), t1);
88  }
89  return mgr.getOrAddTransient(TRANSIENT_DICT_DB_ID, TRANSIENT_DICT_ID, "copy: " + str);
90 }
91 
94  std::string s = t.getString();
95  return TextEncodingNone(mgr, s);
96 }
97 
98 #endif // #ifndef __CUDACC__
99 
100 #ifdef __clang__
101 #pragma clang diagnostic pop
102 #endif
#define EXTENSION_NOINLINE
Definition: heavydbTypes.h:58
std::string getString() const
Definition: heavydbTypes.h:641
EXTENSION_NOINLINE TextEncodingDict text_encoding_dict_copy(RowFunctionManager &mgr, const TextEncodingDict t)
#define TRANSIENT_DICT_DB_ID
Definition: DbObjectKeys.h:25
#define TRANSIENT_DICT_ID
Definition: DbObjectKeys.h:24
DEVICE ALWAYS_INLINE int64_t size() const
Definition: heavydbTypes.h:688
#define GET_DICT_ID(mgr, arg_idx)
Definition: heavydbTypes.h:141
EXTENSION_NOINLINE TextEncodingNone text_encoding_none_copy(RowFunctionManager &mgr, const TextEncodingNone &t)
EXTENSION_NOINLINE int32_t text_encoding_none_length(const TextEncodingNone &t)
EXTENSION_NOINLINE TextEncodingDict text_encoding_dict_concat(RowFunctionManager &mgr, const TextEncodingDict t_dict, const TextEncodingNone &t_none)
EXTENSION_NOINLINE TextEncodingNone text_encoding_none_concat(RowFunctionManager &mgr, const TextEncodingNone &t1, const TextEncodingNone &t2)
#define GET_DICT_DB_ID(mgr, arg_idx)
Definition: heavydbTypes.h:139
EXTENSION_NOINLINE TextEncodingDict text_encoding_dict_concat2(RowFunctionManager &mgr, const TextEncodingNone &t_none, const TextEncodingDict t_dict)
int32_t getOrAddTransient(int32_t db_id, int32_t dict_id, std::string str)
Definition: heavydbTypes.h:314
EXTENSION_NOINLINE TextEncodingNone udf_identity(RowFunctionManager &mgr, const TextEncodingNone &t)
EXTENSION_NOINLINE TextEncodingDict text_encoding_dict_copy_from(RowFunctionManager &mgr, const TextEncodingDict t1, const TextEncodingDict t2, const int32_t select)
std::string getString(int32_t db_id, int32_t dict_id, int32_t string_id)
Definition: heavydbTypes.h:299
EXTENSION_NOINLINE TextEncodingDict text_encoding_dict_concat3(RowFunctionManager &mgr, const TextEncodingDict t1, const TextEncodingDict t2)