-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathbasic-data-type.cpp
2262 lines (2002 loc) · 62.6 KB
/
basic-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
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* 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/array.hpp>
#include <arrow-glib/chunked-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>
#include <arrow/c/bridge.h>
G_BEGIN_DECLS
/**
* SECTION: basic-data-type
* @section_id: basic-data-type-classes
* @title: Basic data type classes
* @include: arrow-glib/arrow-glib.h
*
* #GArrowDataType is a base class for all data type classes such as
* #GArrowBooleanDataType.
*
* #GArrowNullDataType is a class for the null data type.
*
* #GArrowBooleanDataType is a class for the boolean data type.
*
* #GArrowInt8DataType is a class for the 8-bit integer data type.
*
* #GArrowUInt8DataType is a class for the 8-bit unsigned integer data type.
*
* #GArrowInt16DataType is a class for the 16-bit integer data type.
*
* #GArrowUInt16DataType is a class for the 16-bit unsigned integer data type.
*
* #GArrowInt32DataType is a class for the 32-bit integer data type.
*
* #GArrowUInt32DataType is a class for the 32-bit unsigned integer data type.
*
* #GArrowInt64DataType is a class for the 64-bit integer data type.
*
* #GArrowUInt64DataType is a class for the 64-bit unsigned integer data type.
*
* #GArrowHalfFloatDataType is a class for the 16-bit floating point
* data type.
*
* #GArrowFloatDataType is a class for the 32-bit floating point data
* type.
*
* #GArrowDoubleDataType is a class for the 64-bit floating point data
* type.
*
* #GArrowBinaryDataType is a class for the binary data type.
*
* #GArrowLargeBinaryDataType is a class for the 64-bit offsets binary
* data type.
*
* #GArrowFixedSizeBinaryDataType is a class for the fixed-size binary
* data type.
*
* #GArrowStringDataType is a class for the UTF-8 encoded string data
* type.
*
* #GArrowLargeStringDataType is a class for the 64-bit offsets UTF-8
* encoded string data type.
*
* #GArrowTemporalDataType is an abstract class for temporal related data type
* such as #GArrowDate32DataType.
*
* #GArrowDate32DataType is a class for the number of days since UNIX
* epoch in the 32-bit signed integer data type.
*
* #GArrowDate64DataType is a class for the number of milliseconds
* since UNIX epoch in the 64-bit signed integer data type.
*
* #GArrowTimestampDataType is a class for the number of
* seconds/milliseconds/microseconds/nanoseconds since UNIX epoch in
* the 64-bit signed integer data type.
*
* #GArrowTime32DataType is a class for the number of seconds or
* milliseconds since midnight in the 32-bit signed integer data type.
*
* #GArrowTime64DataType is a class for the number of microseconds or
* nanoseconds since midnight in the 64-bit signed integer data type.
*
* #GArrowIntervalDataType is an abstract class for interval related
* data type such as #GArrowMonthIntervalDataType.
*
* #GArrowMonthIntervalDataType is a class for the month intarval data
* type.
*
* #GArrowDayTimeIntervalDataType is a class for the day time intarval
* data type.
*
* #GArrowMonthDayNanoIntervalDataType is a class for the month day
* nano intarval data type.
*
* #GArrowDecimalDataType is a base class for the decimal data types.
*
* #GArrowDecimal128DataType is a class for the 128-bit decimal data type.
*
* #GArrowDecimal256DataType is a class for the 256-bit decimal data type.
*
* #GArrowExtensionDataType is a base class for user-defined extension
* data types.
*
* #GArrowExtensionDataTypeRegistry is a class to manage extension
* data types.
*/
struct GArrowDataTypePrivate
{
std::shared_ptr<arrow::DataType> data_type;
};
enum {
PROP_DATA_TYPE = 1
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowDataType, garrow_data_type, G_TYPE_OBJECT)
#define GARROW_DATA_TYPE_GET_PRIVATE(obj) \
static_cast<GArrowDataTypePrivate *>( \
garrow_data_type_get_instance_private(GARROW_DATA_TYPE(obj)))
static void
garrow_data_type_finalize(GObject *object)
{
auto priv = GARROW_DATA_TYPE_GET_PRIVATE(object);
priv->data_type.~shared_ptr();
G_OBJECT_CLASS(garrow_data_type_parent_class)->finalize(object);
}
static void
garrow_data_type_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
auto priv = GARROW_DATA_TYPE_GET_PRIVATE(object);
switch (prop_id) {
case PROP_DATA_TYPE:
{
auto data_type = g_value_get_pointer(value);
if (data_type) {
priv->data_type = *static_cast<std::shared_ptr<arrow::DataType> *>(data_type);
}
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
garrow_data_type_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
garrow_data_type_init(GArrowDataType *object)
{
auto priv = GARROW_DATA_TYPE_GET_PRIVATE(object);
new (&priv->data_type) std::shared_ptr<arrow::DataType>;
}
static void
garrow_data_type_class_init(GArrowDataTypeClass *klass)
{
GObjectClass *gobject_class;
GParamSpec *spec;
gobject_class = G_OBJECT_CLASS(klass);
gobject_class->finalize = garrow_data_type_finalize;
gobject_class->set_property = garrow_data_type_set_property;
gobject_class->get_property = garrow_data_type_get_property;
spec = g_param_spec_pointer(
"data-type",
"Data type",
"The raw std::shared<arrow::DataType> *",
static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_DATA_TYPE, spec);
}
/**
* garrow_data_type_import:
* @c_abi_schema: (not nullable): A `struct ArrowSchema *`.
* @error: (nullable): Return location for a #GError or %NULL.
*
* Returns: (transfer full) (nullable): An imported #GArrowDataType on success,
* %NULL on error.
*
* You don't need to release the passed `struct ArrowSchema *`,
* even if this function reports an error.
*
* Since: 6.0.0
*/
GArrowDataType *
garrow_data_type_import(gpointer c_abi_schema, GError **error)
{
auto arrow_data_type_result =
arrow::ImportType(static_cast<ArrowSchema *>(c_abi_schema));
if (garrow::check(error, arrow_data_type_result, "[data-type][import]")) {
return garrow_data_type_new_raw(&(*arrow_data_type_result));
} else {
return NULL;
}
}
/**
* garrow_data_type_export:
* @data_type: A #GArrowDataType.
* @error: (nullable): Return location for a #GError or %NULL.
*
* Returns: (transfer full) (nullable): An exported #GArrowDataType as
* `struct ArrowStruct *` on success, %NULL on error.
*
* It should be freed with the `ArrowSchema::release` callback then
* g_free() when no longer needed.
*
* Since: 6.0.0
*/
gpointer
garrow_data_type_export(GArrowDataType *data_type, GError **error)
{
const auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto c_abi_schema = g_new(ArrowSchema, 1);
auto status = arrow::ExportType(*arrow_data_type, c_abi_schema);
if (garrow::check(error, status, "[data-type][export]")) {
return c_abi_schema;
} else {
g_free(c_abi_schema);
return NULL;
}
}
/**
* garrow_data_type_equal:
* @data_type: A #GArrowDataType.
* @other_data_type: A #GArrowDataType to be compared.
*
* Returns: %TRUE if both of them have the same data, %FALSE
* otherwise.
*/
gboolean
garrow_data_type_equal(GArrowDataType *data_type, GArrowDataType *other_data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(data_type);
const auto arrow_other_data_type = garrow_data_type_get_raw(other_data_type);
return arrow_data_type->Equals(arrow_other_data_type);
}
/**
* garrow_data_type_to_string:
* @data_type: A #GArrowDataType.
*
* Returns: The string representation of the data type.
*
* It should be freed with g_free() when no longer needed.
*/
gchar *
garrow_data_type_to_string(GArrowDataType *data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(data_type);
const auto string = arrow_data_type->ToString();
return g_strdup(string.c_str());
}
/**
* garrow_data_type_get_id:
* @data_type: A #GArrowDataType.
*
* Returns: The #GArrowType of the data type.
*/
GArrowType
garrow_data_type_get_id(GArrowDataType *data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(data_type);
return garrow_type_from_raw(arrow_data_type->id());
}
/**
* garrow_data_type_get_name:
* @data_type: A #GArrowDataType.
*
* Returns: The name of the data type.
*
* It should be freed with g_free() when no longer needed.
*
* Since: 3.0.0
*/
gchar *
garrow_data_type_get_name(GArrowDataType *data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(data_type);
const auto name = arrow_data_type->name();
return g_strdup(name.c_str());
}
G_DEFINE_ABSTRACT_TYPE(GArrowFixedWidthDataType,
garrow_fixed_width_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_fixed_width_data_type_init(GArrowFixedWidthDataType *object)
{
}
static void
garrow_fixed_width_data_type_class_init(GArrowFixedWidthDataTypeClass *klass)
{
}
/**
* garrow_fixed_width_data_type_get_bit_width:
* @data_type: A #GArrowFixedWidthDataType.
*
* Returns: The number of bits for one data.
*/
gint
garrow_fixed_width_data_type_get_bit_width(GArrowFixedWidthDataType *data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
const auto arrow_fixed_width_type =
std::static_pointer_cast<arrow::FixedWidthType>(arrow_data_type);
return arrow_fixed_width_type->bit_width();
}
G_DEFINE_TYPE(GArrowNullDataType, garrow_null_data_type, GARROW_TYPE_DATA_TYPE)
static void
garrow_null_data_type_init(GArrowNullDataType *object)
{
}
static void
garrow_null_data_type_class_init(GArrowNullDataTypeClass *klass)
{
}
/**
* garrow_null_data_type_new:
*
* Returns: The newly created null data type.
*/
GArrowNullDataType *
garrow_null_data_type_new(void)
{
auto arrow_data_type = arrow::null();
GArrowNullDataType *data_type = GARROW_NULL_DATA_TYPE(
g_object_new(GARROW_TYPE_NULL_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowBooleanDataType,
garrow_boolean_data_type,
GARROW_TYPE_FIXED_WIDTH_DATA_TYPE)
static void
garrow_boolean_data_type_init(GArrowBooleanDataType *object)
{
}
static void
garrow_boolean_data_type_class_init(GArrowBooleanDataTypeClass *klass)
{
}
/**
* garrow_boolean_data_type_new:
*
* Returns: The newly created boolean data type.
*/
GArrowBooleanDataType *
garrow_boolean_data_type_new(void)
{
auto arrow_data_type = arrow::boolean();
GArrowBooleanDataType *data_type = GARROW_BOOLEAN_DATA_TYPE(
g_object_new(GARROW_TYPE_BOOLEAN_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_ABSTRACT_TYPE(GArrowNumericDataType,
garrow_numeric_data_type,
GARROW_TYPE_FIXED_WIDTH_DATA_TYPE)
static void
garrow_numeric_data_type_init(GArrowNumericDataType *object)
{
}
static void
garrow_numeric_data_type_class_init(GArrowNumericDataTypeClass *klass)
{
}
G_DEFINE_ABSTRACT_TYPE(GArrowIntegerDataType,
garrow_integer_data_type,
GARROW_TYPE_NUMERIC_DATA_TYPE)
static void
garrow_integer_data_type_init(GArrowIntegerDataType *object)
{
}
static void
garrow_integer_data_type_class_init(GArrowIntegerDataTypeClass *klass)
{
}
/**
* garrow_integer_data_type_is_signed:
* @data_type: A #GArrowIntegerDataType.
*
* Returns: %TRUE if the data type is signed, %FALSE otherwise.
*
* Since: 0.16.0
*/
gboolean
garrow_integer_data_type_is_signed(GArrowIntegerDataType *data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
const auto arrow_integer_type =
std::static_pointer_cast<arrow::IntegerType>(arrow_data_type);
return arrow_integer_type->is_signed();
}
G_DEFINE_TYPE(GArrowInt8DataType, garrow_int8_data_type, GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_int8_data_type_init(GArrowInt8DataType *object)
{
}
static void
garrow_int8_data_type_class_init(GArrowInt8DataTypeClass *klass)
{
}
/**
* garrow_int8_data_type_new:
*
* Returns: The newly created 8-bit integer data type.
*/
GArrowInt8DataType *
garrow_int8_data_type_new(void)
{
auto arrow_data_type = arrow::int8();
GArrowInt8DataType *data_type = GARROW_INT8_DATA_TYPE(
g_object_new(GARROW_TYPE_INT8_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowUInt8DataType, garrow_uint8_data_type, GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_uint8_data_type_init(GArrowUInt8DataType *object)
{
}
static void
garrow_uint8_data_type_class_init(GArrowUInt8DataTypeClass *klass)
{
}
/**
* garrow_uint8_data_type_new:
*
* Returns: The newly created 8-bit unsigned integer data type.
*/
GArrowUInt8DataType *
garrow_uint8_data_type_new(void)
{
auto arrow_data_type = arrow::uint8();
GArrowUInt8DataType *data_type = GARROW_UINT8_DATA_TYPE(
g_object_new(GARROW_TYPE_UINT8_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowInt16DataType, garrow_int16_data_type, GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_int16_data_type_init(GArrowInt16DataType *object)
{
}
static void
garrow_int16_data_type_class_init(GArrowInt16DataTypeClass *klass)
{
}
/**
* garrow_int16_data_type_new:
*
* Returns: The newly created 16-bit integer data type.
*/
GArrowInt16DataType *
garrow_int16_data_type_new(void)
{
auto arrow_data_type = arrow::int16();
GArrowInt16DataType *data_type = GARROW_INT16_DATA_TYPE(
g_object_new(GARROW_TYPE_INT16_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowUInt16DataType,
garrow_uint16_data_type,
GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_uint16_data_type_init(GArrowUInt16DataType *object)
{
}
static void
garrow_uint16_data_type_class_init(GArrowUInt16DataTypeClass *klass)
{
}
/**
* garrow_uint16_data_type_new:
*
* Returns: The newly created 16-bit unsigned integer data type.
*/
GArrowUInt16DataType *
garrow_uint16_data_type_new(void)
{
auto arrow_data_type = arrow::uint16();
GArrowUInt16DataType *data_type = GARROW_UINT16_DATA_TYPE(
g_object_new(GARROW_TYPE_UINT16_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowInt32DataType, garrow_int32_data_type, GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_int32_data_type_init(GArrowInt32DataType *object)
{
}
static void
garrow_int32_data_type_class_init(GArrowInt32DataTypeClass *klass)
{
}
/**
* garrow_int32_data_type_new:
*
* Returns: The newly created 32-bit integer data type.
*/
GArrowInt32DataType *
garrow_int32_data_type_new(void)
{
auto arrow_data_type = arrow::int32();
GArrowInt32DataType *data_type = GARROW_INT32_DATA_TYPE(
g_object_new(GARROW_TYPE_INT32_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowUInt32DataType,
garrow_uint32_data_type,
GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_uint32_data_type_init(GArrowUInt32DataType *object)
{
}
static void
garrow_uint32_data_type_class_init(GArrowUInt32DataTypeClass *klass)
{
}
/**
* garrow_uint32_data_type_new:
*
* Returns: The newly created 32-bit unsigned integer data type.
*/
GArrowUInt32DataType *
garrow_uint32_data_type_new(void)
{
auto arrow_data_type = arrow::uint32();
GArrowUInt32DataType *data_type = GARROW_UINT32_DATA_TYPE(
g_object_new(GARROW_TYPE_UINT32_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowInt64DataType, garrow_int64_data_type, GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_int64_data_type_init(GArrowInt64DataType *object)
{
}
static void
garrow_int64_data_type_class_init(GArrowInt64DataTypeClass *klass)
{
}
/**
* garrow_int64_data_type_new:
*
* Returns: The newly created 64-bit integer data type.
*/
GArrowInt64DataType *
garrow_int64_data_type_new(void)
{
auto arrow_data_type = arrow::int64();
GArrowInt64DataType *data_type = GARROW_INT64_DATA_TYPE(
g_object_new(GARROW_TYPE_INT64_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowUInt64DataType,
garrow_uint64_data_type,
GARROW_TYPE_INTEGER_DATA_TYPE)
static void
garrow_uint64_data_type_init(GArrowUInt64DataType *object)
{
}
static void
garrow_uint64_data_type_class_init(GArrowUInt64DataTypeClass *klass)
{
}
/**
* garrow_uint64_data_type_new:
*
* Returns: The newly created 64-bit unsigned integer data type.
*/
GArrowUInt64DataType *
garrow_uint64_data_type_new(void)
{
auto arrow_data_type = arrow::uint64();
GArrowUInt64DataType *data_type = GARROW_UINT64_DATA_TYPE(
g_object_new(GARROW_TYPE_UINT64_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_ABSTRACT_TYPE(GArrowFloatingPointDataType,
garrow_floating_point_data_type,
GARROW_TYPE_NUMERIC_DATA_TYPE)
static void
garrow_floating_point_data_type_init(GArrowFloatingPointDataType *object)
{
}
static void
garrow_floating_point_data_type_class_init(GArrowFloatingPointDataTypeClass *klass)
{
}
G_DEFINE_TYPE(GArrowHalfFloatDataType,
garrow_half_float_data_type,
GARROW_TYPE_FLOATING_POINT_DATA_TYPE)
static void
garrow_half_float_data_type_init(GArrowHalfFloatDataType *object)
{
}
static void
garrow_half_float_data_type_class_init(GArrowHalfFloatDataTypeClass *klass)
{
}
/**
* garrow_half_float_data_type_new:
*
* Returns: The newly created half float data type.
*
* Since: 11.0.0
*/
GArrowHalfFloatDataType *
garrow_half_float_data_type_new(void)
{
auto arrow_data_type = arrow::float16();
auto data_type = GARROW_HALF_FLOAT_DATA_TYPE(
g_object_new(GARROW_TYPE_HALF_FLOAT_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowFloatDataType,
garrow_float_data_type,
GARROW_TYPE_FLOATING_POINT_DATA_TYPE)
static void
garrow_float_data_type_init(GArrowFloatDataType *object)
{
}
static void
garrow_float_data_type_class_init(GArrowFloatDataTypeClass *klass)
{
}
/**
* garrow_float_data_type_new:
*
* Returns: The newly created float data type.
*/
GArrowFloatDataType *
garrow_float_data_type_new(void)
{
auto arrow_data_type = arrow::float32();
GArrowFloatDataType *data_type = GARROW_FLOAT_DATA_TYPE(
g_object_new(GARROW_TYPE_FLOAT_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowDoubleDataType,
garrow_double_data_type,
GARROW_TYPE_FLOATING_POINT_DATA_TYPE)
static void
garrow_double_data_type_init(GArrowDoubleDataType *object)
{
}
static void
garrow_double_data_type_class_init(GArrowDoubleDataTypeClass *klass)
{
}
/**
* garrow_double_data_type_new:
*
* Returns: The newly created 64-bit floating point data type.
*/
GArrowDoubleDataType *
garrow_double_data_type_new(void)
{
auto arrow_data_type = arrow::float64();
GArrowDoubleDataType *data_type = GARROW_DOUBLE_DATA_TYPE(
g_object_new(GARROW_TYPE_DOUBLE_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowBinaryDataType, garrow_binary_data_type, GARROW_TYPE_DATA_TYPE)
static void
garrow_binary_data_type_init(GArrowBinaryDataType *object)
{
}
static void
garrow_binary_data_type_class_init(GArrowBinaryDataTypeClass *klass)
{
}
/**
* garrow_binary_data_type_new:
*
* Returns: The newly created binary data type.
*/
GArrowBinaryDataType *
garrow_binary_data_type_new(void)
{
auto arrow_data_type = arrow::binary();
GArrowBinaryDataType *data_type = GARROW_BINARY_DATA_TYPE(
g_object_new(GARROW_TYPE_BINARY_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowFixedSizeBinaryDataType,
garrow_fixed_size_binary_data_type,
GARROW_TYPE_FIXED_WIDTH_DATA_TYPE)
static void
garrow_fixed_size_binary_data_type_init(GArrowFixedSizeBinaryDataType *object)
{
}
static void
garrow_fixed_size_binary_data_type_class_init(GArrowFixedSizeBinaryDataTypeClass *klass)
{
}
/**
* garrow_fixed_size_binary_data_type:
* @byte_width: The byte width.
*
* Returns: The newly created fixed-size binary data type.
*
* Since: 0.12.0
*/
GArrowFixedSizeBinaryDataType *
garrow_fixed_size_binary_data_type_new(gint32 byte_width)
{
auto arrow_fixed_size_binary_data_type = arrow::fixed_size_binary(byte_width);
auto fixed_size_binary_data_type = GARROW_FIXED_SIZE_BINARY_DATA_TYPE(
g_object_new(GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE,
"data-type",
&arrow_fixed_size_binary_data_type,
NULL));
return fixed_size_binary_data_type;
}
/**
* garrow_fixed_size_binary_data_type_get_byte_width:
* @data_type: A #GArrowFixedSizeBinaryDataType.
*
* Returns: The number of bytes for one data.
*
* Since: 0.12.0
*/
gint32
garrow_fixed_size_binary_data_type_get_byte_width(
GArrowFixedSizeBinaryDataType *data_type)
{
const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
const auto arrow_fixed_size_binary_type =
std::static_pointer_cast<arrow::FixedSizeBinaryType>(arrow_data_type);
return arrow_fixed_size_binary_type->byte_width();
}
G_DEFINE_TYPE(GArrowLargeBinaryDataType,
garrow_large_binary_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_large_binary_data_type_init(GArrowLargeBinaryDataType *object)
{
}
static void
garrow_large_binary_data_type_class_init(GArrowLargeBinaryDataTypeClass *klass)
{
}
/**
* garrow_large_binary_data_type_new:
*
* Returns: The newly created #GArrowLargeBinaryDataType.
*
* Since: 0.17.0
*/
GArrowLargeBinaryDataType *
garrow_large_binary_data_type_new(void)
{
auto arrow_data_type = arrow::large_binary();
GArrowLargeBinaryDataType *data_type =
GARROW_LARGE_BINARY_DATA_TYPE(g_object_new(GARROW_TYPE_LARGE_BINARY_DATA_TYPE,
"data-type",
&arrow_data_type,
NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowStringDataType, garrow_string_data_type, GARROW_TYPE_DATA_TYPE)
static void
garrow_string_data_type_init(GArrowStringDataType *object)
{
}
static void
garrow_string_data_type_class_init(GArrowStringDataTypeClass *klass)
{
}
/**
* garrow_string_data_type_new:
*
* Returns: The newly created UTF-8 encoded string data type.
*/
GArrowStringDataType *
garrow_string_data_type_new(void)
{
auto arrow_data_type = arrow::utf8();
GArrowStringDataType *data_type = GARROW_STRING_DATA_TYPE(
g_object_new(GARROW_TYPE_STRING_DATA_TYPE, "data-type", &arrow_data_type, NULL));
return data_type;
}
G_DEFINE_TYPE(GArrowLargeStringDataType,
garrow_large_string_data_type,
GARROW_TYPE_DATA_TYPE)
static void
garrow_large_string_data_type_init(GArrowLargeStringDataType *object)
{
}
static void
garrow_large_string_data_type_class_init(GArrowLargeStringDataTypeClass *klass)
{
}
/**
* garrow_large_string_data_type_new:
*
* Returns: The newly created #GArrowLargeStringDataType.
*
* Since: 0.17.0
*/
GArrowLargeStringDataType *
garrow_large_string_data_type_new(void)
{
auto arrow_data_type = arrow::large_utf8();
GArrowLargeStringDataType *data_type =
GARROW_LARGE_STRING_DATA_TYPE(g_object_new(GARROW_TYPE_LARGE_STRING_DATA_TYPE,
"data-type",
&arrow_data_type,
NULL));
return data_type;
}
G_DEFINE_ABSTRACT_TYPE(GArrowTemporalDataType,
garrow_temporal_data_type,
GARROW_TYPE_FIXED_WIDTH_DATA_TYPE)
static void
garrow_temporal_data_type_init(GArrowTemporalDataType *object)
{
}
static void
garrow_temporal_data_type_class_init(GArrowTemporalDataTypeClass *klass)
{
}
G_DEFINE_TYPE(GArrowDate32DataType,
garrow_date32_data_type,
GARROW_TYPE_TEMPORAL_DATA_TYPE)
static void
garrow_date32_data_type_init(GArrowDate32DataType *object)
{
}
static void
garrow_date32_data_type_class_init(GArrowDate32DataTypeClass *klass)
{
}
/**
* garrow_date32_data_type_new:
*
* Returns: A newly created the number of milliseconds
* since UNIX epoch in 32-bit signed integer data type.
*
* Since: 0.7.0
*/
GArrowDate32DataType *
garrow_date32_data_type_new(void)
{
auto arrow_data_type = arrow::date32();