forked from oceanbase/seekdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathob_array_expr_utils.h
More file actions
466 lines (432 loc) · 21.1 KB
/
Copy pathob_array_expr_utils.h
File metadata and controls
466 lines (432 loc) · 21.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
/*
* Copyright (c) 2025 OceanBase.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OCEANBASE_SQL_OB_ARRAY_EXPR_UTILS_H_
#define OCEANBASE_SQL_OB_ARRAY_EXPR_UTILS_H_
#define USING_LOG_PREFIX SQL_ENG
#include "lib/allocator/ob_allocator.h"
#include "lib/string/ob_string.h"
#include "lib/udt/ob_array_utils.h"
#include "sql/engine/expr/ob_expr.h" // for ObExpr
#include "sql/engine/expr/ob_expr_lob_utils.h"
#include "sql/engine/expr/ob_expr_array_map.h"
namespace oceanbase
{
namespace sql
{
class ObExecContext;
struct ObVectorCastInfo
{
ObVectorCastInfo()
: is_vector_(false),
is_sparse_vector_(false),
need_cast_(false),
subschema_id_(UINT16_MAX),
dim_cnt_(0)
{}
bool is_vector_;
bool is_sparse_vector_;
bool need_cast_;
uint16_t subschema_id_;
uint16_t dim_cnt_;
};
struct ObCollectionExprCell
{
static const uint32_t COLLECTION_VEC_FORMAT = 0;
ObCollectionExprCell() : format_(0), row_idx_(-1), expr_(nullptr), eval_ctx_(nullptr)
{}
ObCollectionExprCell(int32_t row_idx, ObExpr *expr, ObEvalCtx *eval_ctx) :
format_(0), row_idx_(row_idx), expr_(expr), eval_ctx_(eval_ctx)
{}
uint32_t format_; // 0: arr_vec_foramt(data in attrs_expr), > 0: arr_compact_foramt(lob)
int32_t row_idx_;
ObExpr *expr_;
ObEvalCtx *eval_ctx_;
} __attribute__(( packed ));
class ObArrayExprUtils
{
public:
ObArrayExprUtils();
virtual ~ObArrayExprUtils() = default;
static int set_array_res(ObIArrayType *arr_obj, const int32_t data_len, const ObExpr &expr, ObEvalCtx &ctx, common::ObString &res,
const char *data = nullptr);
static int set_array_res(ObIArrayType *arr_obj, const int32_t data_len, ObIAllocator &allocator, common::ObString &res,
const char *data = nullptr);
static int set_array_obj_res(ObIArrayType *arr_obj, ObObjCastParams *params, ObObj *obj);
template <typename ResVec>
static int set_array_res(ObIArrayType *arr_obj, const ObExpr &expr, ObEvalCtx &ctx,
ResVec *res_vec, int64_t batch_idx)
{
int ret = OB_SUCCESS;
int32_t res_size = arr_obj->get_raw_binary_len();
char *res_buf = nullptr;
int64_t res_buf_len = 0;
ObTextStringVectorResult<ResVec> str_result(expr.datum_meta_.type_, &expr, &ctx, res_vec, batch_idx);
if (OB_FAIL(str_result.init_with_batch_idx(res_size, batch_idx))) {
SQL_ENG_LOG(WARN, "fail to init result", K(ret), K(res_size));
} else if (OB_FAIL(str_result.get_reserved_buffer(res_buf, res_buf_len))) {
SQL_ENG_LOG(WARN, "fail to get reserver buffer", K(ret));
} else if (res_buf_len < res_size) {
ret = OB_ERR_UNEXPECTED;
SQL_ENG_LOG(WARN, "get invalid res buf len", K(ret), K(res_buf_len), K(res_size));
} else if (OB_FAIL(arr_obj->get_raw_binary(res_buf, res_buf_len))) {
SQL_ENG_LOG(WARN, "get array raw binary failed", K(ret), K(res_buf_len), K(res_size));
} else if (OB_FAIL(str_result.lseek(res_size, 0))) {
SQL_ENG_LOG(WARN, "failed to lseek res.", K(ret), K(str_result), K(res_size));
} else {
str_result.set_result();
}
return ret;
}
static int deduce_array_element_type(ObExecContext *exec_ctx, ObExprResType* types_stack, int64_t param_num, ObDataType &elem_type);
static int deduce_nested_array_subschema_id(ObExecContext *exec_ctx, ObDataType &elem_type, uint16_t &subschema_id);
static int deduce_map_subschema_id(ObExecContext *exec_ctx, uint16_t key_subid, uint16_t value_subid, uint16_t &subschema_id);
static int deduce_array_type(ObExecContext *exec_ctx, ObExprResType &type1, ObExprResType &type2,uint16_t &subschema_id);
static int check_array_type_compatibility(ObExecContext *exec_ctx, uint16_t l_subid, uint16_t r_subid, bool &is_compatiable);
static int get_coll_info_by_subschema_id(ObExecContext*exec_ctx, uint16_t subid, const ObSqlCollectionInfo *&coll_info);
static int get_array_element_type(ObExecContext *exec_ctx, uint16_t subid, ObObjType &obj_type, uint32_t &depth, bool &is_vec);
static int get_array_element_type(ObExecContext *exec_ctx, uint16_t subid, ObDataType &elem_type, uint32_t &depth, bool &is_vec);
static int dispatch_array_attrs_inner(ObEvalCtx &ctx, ObIArrayType *arr_obj, ObExpr **attrs, uint32_t attr_count, const int64_t row_idx, bool is_shallow = true);
static int transform_coll_to_uniform(ObEvalCtx &ctx, const ObExpr &expr, const int64_t batch_size, const ObBitVector *skip);
static int get_array_type_by_subschema_id(ObEvalCtx &ctx, const uint16_t subschema_id, ObCollectionArrayType *&arr_type);
static int get_coll_type_by_subschema_id(ObExecContext *exec_ctx, const uint16_t subschema_id, ObCollectionTypeBase *&coll_type);
static int construct_array_obj(ObIAllocator &alloc, ObEvalCtx &ctx, const uint16_t subschema_id, ObIArrayType *&res, bool read_only = true);
static int calc_nested_expr_data_size(const ObExpr &expr, ObEvalCtx &ctx, const int64_t batch_idx, int64_t &size);
static int get_array_obj(ObIAllocator &alloc, ObEvalCtx &ctx, const uint16_t subschema_id, const ObString &raw_data, ObIArrayType *&res);
static int dispatch_array_attrs_rows(ObEvalCtx &ctx, ObIArrayType *arr_obj, const int64_t row_idx,
ObExpr **attrs, uint32_t attr_count, bool is_shallow = true);
static int nested_expr_to_row(const ObExpr &expr, ObEvalCtx &ctx, char *row_buf,
const int64_t col_offset, const uint64_t row_idx, int64_t &cell_len, const int64_t *remain_size = nullptr);
static int assemble_array_attrs(ObEvalCtx &ctx, const ObExpr &expr, int64_t row_idx, ObIArrayType *arr_obj);
static void set_expr_attrs_null(const ObExpr &expr, ObEvalCtx &ctx, const int64_t idx);
static int add_elem_to_array(const ObExpr &expr, ObEvalCtx &ctx, ObIAllocator &alloc,
ObCollectionArrayType *value_type, ObIArrayType *value_arr, int args_idx);
static int add_elem_to_nested_array(ObIAllocator &tmp_allocator, ObEvalCtx &ctx, uint16_t subschema_id,
const ObDatum &datum, ObArrayNested *nest_array);
static int get_child_subschema_id(ObExecContext *exec_ctx, uint16_t subid, uint16_t &child_subid);
static int get_collection_payload(ObIAllocator &allocator, ObEvalCtx &ctx, const ObExpr &expr,
const int64_t row_idx, const char *&res_data, int32_t &data_len,
bool with_lob_head = true);
static int calc_collection_hash_val(const ObObjMeta &meta, const void *data, ObLength len, hash_algo hash_func, uint64_t seed, uint64_t &hash_val);
static int collection_compare(const ObObjMeta &l_meta, const ObObjMeta &r_meta,
const void *l_v, const ObLength l_len,
const void *r_v, const ObLength r_len,
int &cmp_ret);
// collection object is read only
static int get_collection_obj(ObEvalCtx &ctx, const uint16_t subschema_id, ObIArrayType *&res);
static int calc_collection_rows_size(ObIVector &vec, const uint16_t selector[],
const int64_t size, uint32_t row_size_arr[],
const ObBatchRows *brs = nullptr);
template <typename T1, typename T>
static int calc_array_sum_by_type(uint32_t data_len, uint32_t len, const char *data_ptr,
uint8_t *null_bitmaps, T &sum)
{
int ret = OB_SUCCESS;
if (data_len / sizeof(T1) != len) {
ret = OB_ERR_UNEXPECTED;
OB_LOG(WARN, "unexpected array length", K(ret), K(len), K(data_len));
} else {
T1 *data = reinterpret_cast<T1 *>(const_cast<char *>(data_ptr));
for (uint32_t i = 0; i < len; ++i) {
if (null_bitmaps != nullptr && null_bitmaps[i] > 0) {
/* do nothing */
} else if (OB_FAIL(raw_check_add<T>(sum + data[i], static_cast<T>(data[i]), sum))) {
LOG_WARN("array_sum overflow", K(ret), K(sum), K(data[i]));
break;
} else {
sum += static_cast<T>(data[i]);
}
}
}
return ret;
}
template <typename T>
static int calc_array_sum(uint32_t len, uint8_t *nullbitmaps, const char *data_ptr,
uint32_t data_len, ObCollectionArrayType *arr_type, T &sum)
{
int ret = OB_SUCCESS;
ObCollectionBasicType *elem_type = NULL;
if (OB_ISNULL(elem_type = static_cast<ObCollectionBasicType *>(arr_type->element_type_))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("source array collection element type is null", K(ret));
} else if (arr_type->element_type_->type_id_ != ObNestedType::OB_BASIC_TYPE) {
ret = OB_NOT_SUPPORTED;
LOG_WARN("not supported element type", K(ret), K(arr_type->element_type_->type_id_));
} else {
ObObjType obj_type = elem_type->basic_meta_.get_obj_type();
switch (obj_type) {
case ObTinyIntType: {
ret = calc_array_sum_by_type<int8_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObSmallIntType: {
ret = calc_array_sum_by_type<int16_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObInt32Type: {
ret = calc_array_sum_by_type<int32_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObIntType: {
ret = calc_array_sum_by_type<int64_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObUTinyIntType: {
ret = calc_array_sum_by_type<uint8_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObUSmallIntType: {
ret = calc_array_sum_by_type<uint16_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObUInt32Type: {
ret = calc_array_sum_by_type<uint32_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObUInt64Type: {
ret = calc_array_sum_by_type<uint64_t>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObUFloatType:
case ObFloatType: {
ret = calc_array_sum_by_type<float>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
case ObUDoubleType:
case ObDoubleType: {
ret = calc_array_sum_by_type<double>(data_len, len, data_ptr, nullbitmaps, sum);
break;
}
default: {
ret = OB_NOT_SUPPORTED;
OB_LOG(WARN, "not supported element type", K(ret), K(elem_type->basic_meta_.get_type_class()));
}
} // end switch
}
return ret;
}
static int get_array_data(ObString &data_str, ObCollectionArrayType *arr_type, uint32_t &len,
uint8_t *&null_bitmaps, const char *&data, uint32_t &data_len);
static int get_array_data(ObIVector *len_vec, ObIVector *nullbitmap_vec, ObIVector *data_vec,
int64_t idx, ObCollectionArrayType *arr_type, uint32_t &len,
uint8_t *&null_bitmaps, const char *&data, uint32_t &data_len);
static int convert_to_string(common::ObIAllocator &allocator, ObEvalCtx &ctx, const uint16_t subschema_id, const common::ObString &data, ObString &res_str);
// for vector
static int get_type_vector(const ObExpr &expr,
ObEvalCtx &ctx,
ObIAllocator &allocator,
ObIArrayType *&result,
bool &is_null);
static int get_type_vector(const ObExpr &expr,
const ObDatum &datum,
ObEvalCtx &ctx,
ObIAllocator &allocator,
ObIArrayType *&result);
static int calc_cast_type(const ObExprOperatorType &expr_type, ObExprResType &type, common::ObExprTypeCtx &type_ctx, const bool only_vector = false);
static int calc_cast_type2(const ObExprOperatorType &expr_type, ObExprResType &type1, ObExprResType &type2, common::ObExprTypeCtx &type_ctx, uint16_t &res_subschema_id,
const bool only_vector = false);
static int collect_vector_cast_info(ObExprResType &type, ObExecContext &exec_ctx, ObVectorCastInfo &info);
static bool is_sparse_vector_supported(const ObExprOperatorType &type) {
return type == T_FUN_SYS_INNER_PRODUCT ||
type == T_FUN_SYS_NEGATIVE_INNER_PRODUCT ||
type == T_FUN_SYS_VECTOR_DIMS;
};
// update inplace
static int vector_datum_add(ObDatum &res, const ObDatum &data, ObIAllocator &allocator, ObDatum *tmp_res = nullptr, bool negative = false);
static int get_basic_elem(ObIArrayType *src, uint32_t idx, ObObj &elem_obj, bool &is_null);
static int set_obj_to_vector(ObIVector *vec, int64_t idx, ObObj obj, ObIAllocator &allocator);
// check
template<typename T>
static int raw_check_add(const T &res, const T &l, const T &r);
template<typename T>
static int raw_check_minus(const T &res, const T &l, const T &r);
template <typename T>
static int calc_fixed_size_key_index(ObIArrayType *src_key_arr, uint32_t *idx_arr, uint32_t &idx_count);
static int calc_string_key_index(ObIArrayType *src_key_arr, uint32_t *idx_arr, uint32_t &idx_count);
private:
static const char* DEFAULT_CAST_TYPE_NAME;
static const ObString DEFAULT_CAST_TYPE_STR;
static int get_collection_raw_data(ObIAllocator &allocator, const ObObjMeta &meta, const void *data, ObLength len, ObString &bin_str);
};
struct ObVectorArithFunc
{
enum ArithType
{
ADD = 0,
MINUS,
MUL,
DIV,
};
};
struct ObVectorVectorArithFunc : public ObVectorArithFunc
{
int operator()(ObDatum &res, const ObDatum &l, const ObDatum &r, const ObExpr &expr, ObEvalCtx &ctx, ArithType type) const;
};
struct ObVectorElemArithFunc : public ObVectorArithFunc
{
int operator()(ObDatum &res, const ObDatum &l, const ObDatum &r, const ObExpr &expr, ObEvalCtx &ctx, ArithType type) const;
};
class ObNestedVectorFunc
{
public:
static int construct_attr_param(ObIAllocator &alloc, ObEvalCtx &ctx, ObExpr ¶m_expr,
const uint16_t meta_id, int64_t row_idx, ObIArrayType *¶m_obj);
static int construct_param(ObIAllocator &alloc, ObEvalCtx &ctx, const uint16_t meta_id,
ObString &str_data, ObIArrayType *¶m_obj);
};
class ObCollectionExprUtil
{
private:
// using ATTR0_FMT = ObFixedLengthFormat<RTCType<VEC_TC_INTEGER>>;
public:
OB_INLINE static bool is_compact_fmt_cell(const void *ptr)
{
OB_ASSERT(ptr != nullptr);
// uniform cell is a lob data, first uint32_t is version of lob, must >= 1
// for discrete/continous cell, we set first uint32_t to 0
return (reinterpret_cast<const uint32_t *>(ptr))[0] >= 1;
}
OB_INLINE static bool is_vector_fmt_cell(const void *ptr)
{
OB_ASSERT(ptr != nullptr);
return (reinterpret_cast<const uint32_t *>(ptr))[0] == 0;
}
template <typename ColumnFmt>
OB_INLINE static void get_attrN_value(const ObCollectionExprCell *cell, int32_t attr_idx,
const char *&out_ptr, int32_t &out_len)
{
OB_ASSERT(cell != nullptr && cell->expr_ != nullptr && cell->eval_ctx_ != nullptr);
OB_ASSERT(cell->expr_->attrs_cnt_ > attr_idx);
ObIVector *attrN_ivec = cell->expr_->attrs_[attr_idx]->get_vector(*cell->eval_ctx_);
return static_cast<ColumnFmt *>(attrN_ivec)->get_payload(cell->row_idx_, out_ptr, out_len);
}
template <typename ColumnFmt>
OB_INLINE static void set_attrN_value(ObCollectionExprCell *cell, int32_t attr_idx,
const char *src, int32_t src_len)
{
OB_ASSERT(cell != nullptr && cell->expr_ != nullptr && cell->eval_ctx_ != nullptr);
OB_ASSERT(cell->expr_->attrs_cnt_ > attr_idx);
ObIVector *attrN_ivec = cell->expr_->attrs_[attr_idx]->get_vector(*cell->eval_ctx_);
static_cast<ColumnFmt *>(attrN_ivec)->set_payload(cell->row_idx_, src, src_len);
}
template <typename ColumnFmt>
OB_INLINE static void set_attrN_value_shallow(ObCollectionExprCell *cell, int32_t attr_idx,
const char *src, int32_t src_len)
{
OB_ASSERT(cell != nullptr && cell->expr_ != nullptr && cell->eval_ctx_ != nullptr);
OB_ASSERT(cell->expr_->attrs_cnt_ > attr_idx);
ObIVector *attrN_ivec = cell->expr_->attrs_[attr_idx]->get_vector(*cell->eval_ctx_);
static_cast<ColumnFmt *>(attrN_ivec)->set_payload_shallow(cell->row_idx_, src, src_len);
}
template <typename ColumnFmt>
OB_INLINE static int write_collection_to_row(const ColumnFmt *column, const sql::RowMeta &row_meta,
sql::ObCompactRow *stored_row,
const uint64_t row_idx, const int64_t col_idx)
{
int ret = OB_SUCCESS;
const char *payload = nullptr;
int32_t len = 0;
bool is_null = false;
column->get_payload(row_idx, is_null, payload, len);
if (OB_UNLIKELY(is_null)) {
stored_row->set_null(row_meta, col_idx);
} else if (is_vector_fmt_cell(payload)) {
// assemble attr data and write to row
const ObCollectionExprCell* coll_cell = reinterpret_cast<const ObCollectionExprCell*>(payload);
OB_ASSERT(coll_cell != nullptr && coll_cell->expr_ != nullptr && coll_cell->eval_ctx_ != nullptr);
int64_t offset = stored_row->offset(row_meta, col_idx);
char *row_buf = stored_row->payload();
int64_t cell_len = 0;
if (OB_FAIL(ObArrayExprUtils::nested_expr_to_row(*coll_cell->expr_, *coll_cell->eval_ctx_, row_buf,
offset, row_idx, cell_len))) {
SQL_LOG(WARN, "nested expr to row failed", K(ret));
} else {
stored_row->update_var_offset(row_meta, col_idx, cell_len);
}
} else {
stored_row->set_cell_payload(row_meta, col_idx, payload, len);
}
// tonghui TODO: get attr data and build lob, set to stored row
return ret;
}
template <typename ColumnFmt>
OB_INLINE static int write_collection_to_row(const ColumnFmt *column, const sql::RowMeta &row_meta,
sql::ObCompactRow *stored_row, const uint64_t row_idx,
const int64_t col_idx, const int64_t remain_size,
const bool is_fixed_length_data, int64_t &row_size)
{
int ret = OB_SUCCESS;
const char *payload = nullptr;
int32_t len = 0;
bool is_null = false;
column->get_payload(row_idx, is_null, payload, len);
if (OB_UNLIKELY(is_null)) {
stored_row->set_null(row_meta, col_idx);
} else if (is_vector_fmt_cell(payload)) {
// assemble attr datas and write to row
const ObCollectionExprCell* coll_cell = reinterpret_cast<const ObCollectionExprCell*>(payload);
OB_ASSERT(coll_cell != nullptr && coll_cell->expr_ != nullptr && coll_cell->eval_ctx_ != nullptr);
int64_t offset = stored_row->offset(row_meta, col_idx);
char *row_buf = stored_row->payload();
int64_t cell_len = 0;
if (OB_FAIL(ObArrayExprUtils::nested_expr_to_row(*coll_cell->expr_, *coll_cell->eval_ctx_, row_buf,
offset, row_idx, cell_len, &remain_size))) {
SQL_LOG(WARN, "nested expr to row failed", K(ret));
} else {
stored_row->update_var_offset(row_meta, col_idx, cell_len);
}
} else {
if (len > remain_size) {
ret = OB_BUF_NOT_ENOUGH;
} else {
row_size += len;
stored_row->set_cell_payload(row_meta, col_idx, payload, len);
}
}
return ret;
}
template <typename ColumnFmt>
OB_INLINE static int write_collections_to_rows(const ColumnFmt *column, const sql::RowMeta &row_meta,
sql::ObCompactRow **stored_rows, const uint16_t selector[],
const int64_t size, const int64_t col_idx)
{
int ret = OB_SUCCESS;
for (int i = 0; OB_SUCC(ret) && i < size; i++) {
int64_t row_idx = selector[i];
if (OB_FAIL(column->to_row(row_meta, stored_rows[i], row_idx, col_idx))) {
SQL_LOG(WARN, "to row failed", K(ret));
}
}
return ret;
}
template <typename ColumnFmt>
OB_INLINE static int write_collections_to_rows(const ColumnFmt *column,
const sql::RowMeta &row_meta,
sql::ObCompactRow **stored_rows,
const int64_t size, const int64_t col_idx)
{
int ret = OB_SUCCESS;
for (int i = 0; OB_SUCC(ret) && i < size; i++) {
int64_t row_idx = i;
if (OB_FAIL(column->to_row(row_meta, stored_rows[i], row_idx, col_idx))) {
SQL_LOG(WARN, "to row failed", K(ret));
}
}
return ret;
}
};
} // sql
} // oceanbase
#endif // OCEANBASE_SQL_OB_ARRAY_EXPR_UTILS_H_