forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
composite-data-type.cpp
720 lines (643 loc) · 20.4 KB
/
composite-data-type.cpp
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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
#include <arrow-glib/basic-array.hpp>
#include <arrow-glib/data-type.hpp>
#include <arrow-glib/enums.h>
#include <arrow-glib/error.hpp>
#include <arrow-glib/field.hpp>
#include <arrow-glib/type.hpp>
G_BEGIN_DECLS
/**
* SECTION: composite-data-type
* @section_id: composite-data-type-classes
* @title: Composite data type classes
* @include: arrow-glib/arrow-glib.h
*
* #GArrowListDataType is a class for list data type.
*
* #GArrowLargeListDataType is a class for 64-bit offsets list data type.
*
* #GArrowStructDataType is a class for struct data type.
*
* #GArrowMapDataType is a class for map data type.
*
* #GArrowUnionDataType is a base class for union data types.
*
* #GArrowSparseUnionDataType is a class for sparse union data type.
*
* #GArrowDenseUnionDataType is a class for dense union data type.
*
* #GArrowDictionaryDataType is a class for dictionary data type.
*/
G_DEFINE_TYPE(GArrowListDataType,
garrow_list_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_list_data_type_init(GArrowListDataType *object)
{
}
static void
garrow_list_data_type_class_init(GArrowListDataTypeClass *klass)
{
}
/**
* garrow_list_data_type_new:
* @field: The field of elements
*
* Returns: The newly created list data type.
*/
GArrowListDataType *
garrow_list_data_type_new(GArrowField *field)
{
auto arrow_field = garrow_field_get_raw(field);
auto arrow_data_type =
std::make_shared<arrow::ListType>(arrow_field);
GArrowListDataType *data_type =
GARROW_LIST_DATA_TYPE(g_object_new(GARROW_TYPE_LIST_DATA_TYPE,
"data-type", &arrow_data_type,
NULL));
return data_type;
}
/**
* garrow_list_data_type_get_value_field:
* @list_data_type: A #GArrowListDataType.
*
* Returns: (transfer full): The field of value.
*
* Deprecated: 0.13.0:
* Use garrow_list_data_type_get_field() instead.
*/
GArrowField *
garrow_list_data_type_get_value_field(GArrowListDataType *list_data_type)
{
return garrow_list_data_type_get_field(list_data_type);
}
/**
* garrow_list_data_type_get_field:
* @list_data_type: A #GArrowListDataType.
*
* Returns: (transfer full): The field of value.
*
* Since: 0.13.0
*/
GArrowField *
garrow_list_data_type_get_field(GArrowListDataType *list_data_type)
{
auto data_type = GARROW_DATA_TYPE(list_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_list_data_type =
static_cast<arrow::ListType *>(arrow_data_type.get());
auto arrow_field = arrow_list_data_type->value_field();
return garrow_field_new_raw(&arrow_field, nullptr);
}
G_DEFINE_TYPE(GArrowLargeListDataType,
garrow_large_list_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_large_list_data_type_init(GArrowLargeListDataType *object)
{
}
static void
garrow_large_list_data_type_class_init(GArrowLargeListDataTypeClass *klass)
{
}
/**
* garrow_large_list_data_type_new:
* @field: The field of elements
*
* Returns: The newly created large list data type.
*
* Since: 0.16.0
*/
GArrowLargeListDataType *
garrow_large_list_data_type_new(GArrowField *field)
{
auto arrow_field = garrow_field_get_raw(field);
auto arrow_data_type =
std::make_shared<arrow::LargeListType>(arrow_field);
GArrowLargeListDataType *data_type =
GARROW_LARGE_LIST_DATA_TYPE(g_object_new(GARROW_TYPE_LARGE_LIST_DATA_TYPE,
"data-type", &arrow_data_type,
NULL));
return data_type;
}
/**
* garrow_large_list_data_type_get_field:
* @large_list_data_type: A #GArrowLargeListDataType.
*
* Returns: (transfer full): The field of value.
*
* Since: 0.16.0
*/
GArrowField *
garrow_large_list_data_type_get_field(GArrowLargeListDataType *large_list_data_type)
{
auto data_type = GARROW_DATA_TYPE(large_list_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_large_list_data_type =
static_cast<arrow::LargeListType *>(arrow_data_type.get());
auto arrow_field = arrow_large_list_data_type->value_field();
return garrow_field_new_raw(&arrow_field, nullptr);
}
G_DEFINE_TYPE(GArrowStructDataType,
garrow_struct_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_struct_data_type_init(GArrowStructDataType *object)
{
}
static void
garrow_struct_data_type_class_init(GArrowStructDataTypeClass *klass)
{
}
/**
* garrow_struct_data_type_new:
* @fields: (element-type GArrowField): The fields of the struct.
*
* Returns: The newly created struct data type.
*/
GArrowStructDataType *
garrow_struct_data_type_new(GList *fields)
{
std::vector<std::shared_ptr<arrow::Field>> arrow_fields;
for (auto *node = fields; node; node = g_list_next(node)) {
auto field = GARROW_FIELD(node->data);
auto arrow_field = garrow_field_get_raw(field);
arrow_fields.push_back(arrow_field);
}
auto arrow_data_type = std::make_shared<arrow::StructType>(arrow_fields);
auto data_type = g_object_new(GARROW_TYPE_STRUCT_DATA_TYPE,
"data-type", &arrow_data_type,
NULL);
return GARROW_STRUCT_DATA_TYPE(data_type);
}
/**
* garrow_struct_data_type_get_n_fields:
* @struct_data_type: A #GArrowStructDataType.
*
* Returns: The number of fields of the struct data type.
*
* Since: 0.12.0
*/
gint
garrow_struct_data_type_get_n_fields(GArrowStructDataType *struct_data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(struct_data_type));
return arrow_data_type->num_fields();
}
/**
* garrow_struct_data_type_get_fields:
* @struct_data_type: A #GArrowStructDataType.
*
* Returns: (transfer full) (element-type GArrowField):
* The fields of the struct data type.
*
* Since: 0.12.0
*/
GList *
garrow_struct_data_type_get_fields(GArrowStructDataType *struct_data_type)
{
auto data_type = GARROW_DATA_TYPE(struct_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_fields = arrow_data_type->fields();
GList *fields = NULL;
for (auto arrow_field : arrow_fields) {
fields = g_list_prepend(fields, garrow_field_new_raw(&arrow_field, nullptr));
}
return g_list_reverse(fields);
}
/**
* garrow_struct_data_type_get_field:
* @struct_data_type: A #GArrowStructDataType.
* @i: The index of the target field.
*
* Returns: (transfer full) (nullable):
* The field at the index in the struct data type or %NULL on not found.
*
* Since: 0.12.0
*/
GArrowField *
garrow_struct_data_type_get_field(GArrowStructDataType *struct_data_type,
gint i)
{
auto data_type = GARROW_DATA_TYPE(struct_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
if (i < 0) {
i += arrow_data_type->num_fields();
}
if (i < 0) {
return NULL;
}
if (i >= arrow_data_type->num_fields()) {
return NULL;
}
auto arrow_field = arrow_data_type->field(i);
if (arrow_field) {
return garrow_field_new_raw(&arrow_field, nullptr);
} else {
return NULL;
}
}
/**
* garrow_struct_data_type_get_field_by_name:
* @struct_data_type: A #GArrowStructDataType.
* @name: The name of the target field.
*
* Returns: (transfer full) (nullable):
* The field that has the name in the struct data type or %NULL on not found.
*
* Since: 0.12.0
*/
GArrowField *
garrow_struct_data_type_get_field_by_name(GArrowStructDataType *struct_data_type,
const gchar *name)
{
auto data_type = GARROW_DATA_TYPE(struct_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_struct_data_type =
std::static_pointer_cast<arrow::StructType>(arrow_data_type);
auto arrow_field = arrow_struct_data_type->GetFieldByName(name);
if (arrow_field) {
return garrow_field_new_raw(&arrow_field, nullptr);
} else {
return NULL;
}
}
/**
* garrow_struct_data_type_get_field_index:
* @struct_data_type: A #GArrowStructDataType.
* @name: The name of the target field.
*
* Returns: The index of the target index in the struct data type
* or `-1` on not found.
*
* Since: 0.12.0
*/
gint
garrow_struct_data_type_get_field_index(GArrowStructDataType *struct_data_type,
const gchar *name)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(struct_data_type));
auto arrow_struct_data_type =
std::static_pointer_cast<arrow::StructType>(arrow_data_type);
return arrow_struct_data_type->GetFieldIndex(name);
}
G_DEFINE_TYPE(GArrowMapDataType,
garrow_map_data_type,
GARROW_TYPE_LIST_DATA_TYPE)
static void
garrow_map_data_type_init(GArrowMapDataType *object)
{
}
static void
garrow_map_data_type_class_init(GArrowMapDataTypeClass *klass)
{
}
/**
* garrow_map_data_type_new:
* @key_type: The key type of the map.
* @item_type: The item type of the map.
*
* Returns: The newly created map data type.
*
* Since: 0.17.0
*/
GArrowMapDataType *
garrow_map_data_type_new(GArrowDataType *key_type,
GArrowDataType *item_type)
{
auto arrow_key_type = garrow_data_type_get_raw(key_type);
auto arrow_item_type = garrow_data_type_get_raw(item_type);
auto arrow_data_type = std::make_shared<arrow::MapType>(arrow_key_type,
arrow_item_type);
auto data_type = g_object_new(GARROW_TYPE_MAP_DATA_TYPE,
"data-type", &arrow_data_type,
NULL);
return GARROW_MAP_DATA_TYPE(data_type);
}
/**
* garrow_map_data_type_get_key_type:
* @map_data_type: A #GArrowMapDataType.
*
* Returns: (transfer full): The key type of the map.
*
* Since: 0.17.0
*/
GArrowDataType *
garrow_map_data_type_get_key_type(GArrowMapDataType *map_data_type)
{
auto data_type = GARROW_DATA_TYPE(map_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_map_data_type =
std::static_pointer_cast<arrow::MapType>(arrow_data_type);
auto arrow_key_type = arrow_map_data_type->key_type();
return garrow_data_type_new_raw(&arrow_key_type);
}
/**
* garrow_map_data_type_get_item_type:
* @map_data_type: A #GArrowMapDataType.
*
* Returns: (transfer full): The item type of the map.
*
* Since: 0.17.0
*/
GArrowDataType *
garrow_map_data_type_get_item_type(GArrowMapDataType *map_data_type)
{
auto data_type = GARROW_DATA_TYPE(map_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_map_data_type =
std::static_pointer_cast<arrow::MapType>(arrow_data_type);
auto arrow_item_type = arrow_map_data_type->item_type();
return garrow_data_type_new_raw(&arrow_item_type);
}
G_DEFINE_ABSTRACT_TYPE(GArrowUnionDataType,
garrow_union_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_union_data_type_init(GArrowUnionDataType *object)
{
}
static void
garrow_union_data_type_class_init(GArrowUnionDataTypeClass *klass)
{
}
/**
* garrow_union_data_type_get_n_fields:
* @union_data_type: A #GArrowUnionDataType.
*
* Returns: The number of fields of the union data type.
*
* Since: 0.12.0
*/
gint
garrow_union_data_type_get_n_fields(GArrowUnionDataType *union_data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(union_data_type));
return arrow_data_type->num_fields();
}
/**
* garrow_union_data_type_get_fields:
* @union_data_type: A #GArrowUnionDataType.
*
* Returns: (transfer full) (element-type GArrowField):
* The fields of the union data type.
*
* Since: 0.12.0
*/
GList *
garrow_union_data_type_get_fields(GArrowUnionDataType *union_data_type)
{
auto data_type = GARROW_DATA_TYPE(union_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_fields = arrow_data_type->fields();
GList *fields = NULL;
for (auto arrow_field : arrow_fields) {
fields = g_list_prepend(fields, garrow_field_new_raw(&arrow_field, nullptr));
}
return g_list_reverse(fields);
}
/**
* garrow_union_data_type_get_field:
* @union_data_type: A #GArrowUnionDataType.
* @i: The index of the target field.
*
* Returns: (transfer full) (nullable):
* The field at the index in the union data type or %NULL on not found.
*
* Since: 0.12.0
*/
GArrowField *
garrow_union_data_type_get_field(GArrowUnionDataType *union_data_type,
gint i)
{
auto data_type = GARROW_DATA_TYPE(union_data_type);
auto arrow_data_type = garrow_data_type_get_raw(data_type);
if (i < 0) {
i += arrow_data_type->num_fields();
}
if (i < 0) {
return NULL;
}
if (i >= arrow_data_type->num_fields()) {
return NULL;
}
auto arrow_field = arrow_data_type->field(i);
if (arrow_field) {
return garrow_field_new_raw(&arrow_field, nullptr);
} else {
return NULL;
}
}
/**
* garrow_union_data_type_get_type_codes:
* @union_data_type: A #GArrowUnionDataType.
* @n_type_codes: (out): The number of type codes.
*
* Returns: (transfer full) (array length=n_type_codes):
* The codes for each field.
*
* It should be freed with g_free() when no longer needed.
*
* Since: 0.12.0
*/
gint8 *
garrow_union_data_type_get_type_codes(GArrowUnionDataType *union_data_type,
gsize *n_type_codes)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(union_data_type));
auto arrow_union_data_type =
std::static_pointer_cast<arrow::UnionType>(arrow_data_type);
const auto arrow_type_codes = arrow_union_data_type->type_codes();
const auto n = arrow_type_codes.size();
auto type_codes = static_cast<gint8 *>(g_new(gint8, n));
for (size_t i = 0; i < n; ++i) {
type_codes[i] = arrow_type_codes[i];
}
*n_type_codes = n;
return type_codes;
}
G_DEFINE_TYPE(GArrowSparseUnionDataType,
garrow_sparse_union_data_type,
GARROW_TYPE_UNION_DATA_TYPE)
static void
garrow_sparse_union_data_type_init(GArrowSparseUnionDataType *object)
{
}
static void
garrow_sparse_union_data_type_class_init(GArrowSparseUnionDataTypeClass *klass)
{
}
/**
* garrow_sparse_union_data_type_new:
* @fields: (element-type GArrowField): The fields of the union.
* @type_codes: (array length=n_type_codes): The codes to specify each field.
* @n_type_codes: The number of type codes.
*
* Returns: The newly created sparse union data type.
*/
GArrowSparseUnionDataType *
garrow_sparse_union_data_type_new(GList *fields,
gint8 *type_codes,
gsize n_type_codes)
{
std::vector<std::shared_ptr<arrow::Field>> arrow_fields;
for (auto node = fields; node; node = g_list_next(node)) {
auto field = GARROW_FIELD(node->data);
auto arrow_field = garrow_field_get_raw(field);
arrow_fields.push_back(arrow_field);
}
std::vector<int8_t> arrow_type_codes;
for (gsize i = 0; i < n_type_codes; ++i) {
arrow_type_codes.push_back(type_codes[i]);
}
auto arrow_data_type =
std::make_shared<arrow::SparseUnionType>(arrow_fields,
arrow_type_codes);
auto data_type = g_object_new(GARROW_TYPE_SPARSE_UNION_DATA_TYPE,
"data-type", &arrow_data_type,
NULL);
return GARROW_SPARSE_UNION_DATA_TYPE(data_type);
}
G_DEFINE_TYPE(GArrowDenseUnionDataType,
garrow_dense_union_data_type,
GARROW_TYPE_UNION_DATA_TYPE)
static void
garrow_dense_union_data_type_init(GArrowDenseUnionDataType *object)
{
}
static void
garrow_dense_union_data_type_class_init(GArrowDenseUnionDataTypeClass *klass)
{
}
/**
* garrow_dense_union_data_type_new:
* @fields: (element-type GArrowField): The fields of the union.
* @type_codes: (array length=n_type_codes): The codes to specify each field.
* @n_type_codes: The number of type codes.
*
* Returns: The newly created dense union data type.
*/
GArrowDenseUnionDataType *
garrow_dense_union_data_type_new(GList *fields,
gint8 *type_codes,
gsize n_type_codes)
{
std::vector<std::shared_ptr<arrow::Field>> arrow_fields;
for (auto node = fields; node; node = g_list_next(node)) {
auto field = GARROW_FIELD(node->data);
auto arrow_field = garrow_field_get_raw(field);
arrow_fields.push_back(arrow_field);
}
std::vector<int8_t> arrow_type_codes;
for (gsize i = 0; i < n_type_codes; ++i) {
arrow_type_codes.push_back(type_codes[i]);
}
auto arrow_data_type =
std::make_shared<arrow::DenseUnionType>(arrow_fields,
arrow_type_codes);
auto data_type = g_object_new(GARROW_TYPE_DENSE_UNION_DATA_TYPE,
"data-type", &arrow_data_type,
NULL);
return GARROW_DENSE_UNION_DATA_TYPE(data_type);
}
G_DEFINE_TYPE(GArrowDictionaryDataType,
garrow_dictionary_data_type,
GARROW_TYPE_FIXED_WIDTH_DATA_TYPE)
static void
garrow_dictionary_data_type_init(GArrowDictionaryDataType *object)
{
}
static void
garrow_dictionary_data_type_class_init(GArrowDictionaryDataTypeClass *klass)
{
}
/**
* garrow_dictionary_data_type_new:
* @index_data_type: The data type of index.
* @value_data_type: The data type of dictionary values.
* @ordered: Whether dictionary contents are ordered or not.
*
* Returns: The newly created dictionary data type.
*
* Since: 0.8.0
*/
GArrowDictionaryDataType *
garrow_dictionary_data_type_new(GArrowDataType *index_data_type,
GArrowDataType *value_data_type,
gboolean ordered)
{
auto arrow_index_data_type = garrow_data_type_get_raw(index_data_type);
auto arrow_value_data_type = garrow_data_type_get_raw(value_data_type);
auto arrow_data_type = arrow::dictionary(arrow_index_data_type,
arrow_value_data_type,
ordered);
return GARROW_DICTIONARY_DATA_TYPE(garrow_data_type_new_raw(&arrow_data_type));
}
/**
* garrow_dictionary_data_type_get_index_data_type:
* @dictionary_data_type: The #GArrowDictionaryDataType.
*
* Returns: (transfer full): The #GArrowDataType of index.
*
* Since: 0.8.0
*/
GArrowDataType *
garrow_dictionary_data_type_get_index_data_type(GArrowDictionaryDataType *dictionary_data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(dictionary_data_type));
auto arrow_dictionary_data_type =
std::static_pointer_cast<arrow::DictionaryType>(arrow_data_type);
auto arrow_index_data_type = arrow_dictionary_data_type->index_type();
return garrow_data_type_new_raw(&arrow_index_data_type);
}
/**
* garrow_dictionary_data_type_get_value_data_type:
* @dictionary_data_type: The #GArrowDictionaryDataType.
*
* Returns: (transfer full): The #GArrowDataType of dictionary values.
*
* Since: 0.14.0
*/
GArrowDataType *
garrow_dictionary_data_type_get_value_data_type(GArrowDictionaryDataType *dictionary_data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(dictionary_data_type));
auto arrow_dictionary_data_type =
std::static_pointer_cast<arrow::DictionaryType>(arrow_data_type);
auto arrow_value_data_type = arrow_dictionary_data_type->value_type();
return garrow_data_type_new_raw(&arrow_value_data_type);
}
/**
* garrow_dictionary_data_type_is_ordered:
* @dictionary_data_type: The #GArrowDictionaryDataType.
*
* Returns: Whether dictionary contents are ordered or not.
*
* Since: 0.8.0
*/
gboolean
garrow_dictionary_data_type_is_ordered(GArrowDictionaryDataType *dictionary_data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(dictionary_data_type));
auto arrow_dictionary_data_type =
std::static_pointer_cast<arrow::DictionaryType>(arrow_data_type);
return arrow_dictionary_data_type->ordered();
}
G_END_DECLS