29 const int64_t num_rows = input_str.
size();
31 for (int64_t i = 0; i < num_rows; i++) {
32 out_str[i] = input_str[i];
33 const std::string str = input_str.
getString(i);
34 out_size[i] = str.
size();
43 const int64_t num_rows = input_strings.
size();
44 const int64_t num_cols = input_strings.
numCols();
46 for (int64_t r = 0; r < num_rows; r++) {
47 bool are_equal =
true;
49 std::string first_str = input_strings[0].getString(r);
50 for (int64_t c = 1; c != num_cols; ++c) {
51 if (input_strings[c].getString(r) != first_str) {
56 strings_are_equal[r] = are_equal;
57 if (are_equal && num_cols > 0) {
58 string_if_equal[r] = input_strings[0][r];
73 const int64_t num_rows = input_str.
size();
75 for (int64_t row_idx = 0; row_idx < num_rows; row_idx++) {
76 const std::string input_string{input_str.
getString(row_idx)};
77 const std::string
substring = input_string.substr(pos[row_idx], len[row_idx]);
79 output_substr[row_idx] = substr_id;
89 const int64_t num_rows = input_strings.
size();
90 const int64_t num_cols = input_strings.
numCols();
91 const std::string separator_str{separator.
getString()};
93 for (int64_t row_idx = 0; row_idx < num_rows; row_idx++) {
95 std::string concatted_output{input_strings[0].getString(row_idx)};
96 for (int64_t col_idx = 1; col_idx < num_cols; ++col_idx) {
97 concatted_output += separator_str;
98 concatted_output += input_strings[col_idx].getString(row_idx);
102 concatted_string[row_idx] = concatted_str_id;
104 concatted_string.
setNull(row_idx);
112 const int64_t num_strings,
115 for (int32_t s = 0; s < num_strings; ++s) {
118 new_dict_col[s] = string_id;
123 #endif // #ifndef __CUDACC__
128 const int32_t str_len = str1.
size() <= str2.
size() ? str1.
size() : str2.
size();
131 const int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
132 const int32_t step = blockDim.x * gridDim.x;
133 int32_t* output_ptr = hamming_distance.
ptr_;
135 const int32_t start = 0;
136 const int32_t step = 1;
139 int32_t num_chars_unequal = 0;
140 for (int32_t i = start; i < str_len; i += step) {
141 num_chars_unequal += (str1[i] != str2[i]) ? 1 : 0;
144 atomicAdd(output_ptr, num_chars_unequal);
146 hamming_distance[0] = num_chars_unequal;
151 template <
typename T>
154 const int32_t multiplier,
157 const int32_t str_len = str.
size();
160 if (multiplier != 1) {
163 const int32_t num_input_rows = indices.
size();
164 const int32_t num_output_rows = num_input_rows * multiplier;
167 const int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
168 const int32_t step = blockDim.x * gridDim.x;
170 const int32_t start = 0;
171 const int32_t step = 1;
174 for (int32_t i = start; i < num_output_rows; i += step) {
175 idx[i] = indices[i % num_output_rows];
176 char_bytes[i] = str[i % str_len];
178 return num_output_rows;
185 const int32_t multiplier,
191 const int32_t multiplier,
203 const std::string str{input.
getString()};
204 const int64_t str_size(str.size());
206 for (int32_t i = 0; i < str_size; ++i) {
208 char_bytes[i] = str[i];
213 #endif // #ifndef __CUDACC__
DEVICE const std::string getString(int64_t index) const
void set_output_row_size(int64_t num_rows)
EXTENSION_NOINLINE_HOST void set_output_row_size(int64_t num_rows)
#define EXTENSION_NOINLINE
TEMPLATE_NOINLINE int32_t ct_get_string_chars__template(const Column< T > &indices, const TextEncodingNone &str, const int32_t multiplier, Column< int32_t > &idx, Column< int8_t > &char_bytes)
std::string getString() const
DEVICE int64_t size() const
DEVICE int64_t size() const
DEVICE void setNull(int64_t index)
EXTENSION_NOINLINE_HOST int32_t ct_binding_str_length__cpu_(const Column< TextEncodingDict > &input_str, Column< TextEncodingDict > &out_str, Column< int64_t > &out_size)
DEVICE ALWAYS_INLINE int64_t size() const
EXTENSION_NOINLINE_HOST int32_t ct_binding_str_equals__cpu_(const ColumnList< TextEncodingDict > &input_strings, Column< TextEncodingDict > &string_if_equal, Column< bool > &strings_are_equal)
EXTENSION_NOINLINE int32_t ct_hamming_distance(const TextEncodingNone &str1, const TextEncodingNone &str2, Column< int32_t > &hamming_distance)
#define EXTENSION_NOINLINE_HOST
EXTENSION_NOINLINE_HOST int32_t ct_synthesize_new_dict__cpu_(TableFunctionManager &mgr, const int64_t num_strings, Column< TextEncodingDict > &new_dict_col)
DEVICE int64_t numCols() const
EXTENSION_NOINLINE_HOST int32_t ct_string_concat__cpu_(TableFunctionManager &mgr, const ColumnList< TextEncodingDict > &input_strings, const TextEncodingNone &separator, Column< TextEncodingDict > &concatted_string)
DEVICE int64_t size() const
DEVICE const TextEncodingDict getOrAddTransient(const std::string &str)
EXTENSION_NOINLINE_HOST int32_t ct_string_to_chars__cpu_(const TextEncodingNone &input, Column< int32_t > &char_idx, Column< int8_t > &char_bytes)
EXTENSION_NOINLINE_HOST int32_t ct_substr__cpu_(TableFunctionManager &mgr, const Column< TextEncodingDict > &input_str, const Column< int > &pos, const Column< int > &len, Column< TextEncodingDict > &output_substr)
#define TEMPLATE_NOINLINE