MCPcopy Create free account
hub / github.com/apache/arrow / print_array

Function print_array

c_glib/example/receive-network.c:54–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54static void
55print_array(GArrowArray *array)
56{
57 GArrowType value_type;
58 gint64 i, n;
59
60 value_type = garrow_array_get_value_type(array);
61
62 g_print("[");
63 n = garrow_array_get_length(array);
64
65#define ARRAY_CASE(type, Type, TYPE, format) \
66 case GARROW_TYPE_##TYPE: \
67 { \
68 GArrow##Type##Array *real_array; \
69 real_array = GARROW_##TYPE##_ARRAY(array); \
70 for (i = 0; i < n; i++) { \
71 if (i > 0) { \
72 g_print(", "); \
73 } \
74 g_print(format, garrow_##type##_array_get_value(real_array, i)); \
75 } \
76 } \
77 break
78
79 switch (value_type) {
80 ARRAY_CASE(uint8, UInt8, UINT8, "%hhu");
81 ARRAY_CASE(uint16, UInt16, UINT16, "%" G_GUINT16_FORMAT);
82 ARRAY_CASE(uint32, UInt32, UINT32, "%" G_GUINT32_FORMAT);
83 ARRAY_CASE(uint64, UInt64, UINT64, "%" G_GUINT64_FORMAT);
84 ARRAY_CASE(int8, Int8, INT8, "%hhd");
85 ARRAY_CASE(int16, Int16, INT16, "%" G_GINT16_FORMAT);
86 ARRAY_CASE(int32, Int32, INT32, "%" G_GINT32_FORMAT);
87 ARRAY_CASE(int64, Int64, INT64, "%" G_GINT64_FORMAT);
88 ARRAY_CASE(float, Float, FLOAT, "%g");
89 ARRAY_CASE(double, Double, DOUBLE, "%g");
90 default:
91 break;
92 }
93#undef ARRAY_CASE
94
95 g_print("]\n");
96}
97
98static void
99print_record_batch(GArrowRecordBatch *record_batch)

Callers 1

print_record_batchFunction · 0.70

Calls 2

garrow_array_get_lengthFunction · 0.85

Tested by

no test coverage detected