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

Function main

c_glib/example/build.c:24–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#include <arrow-glib/arrow-glib.h>
23
24int
25main(int argc, char **argv)
26{
27 GArrowArray *array;
28
29 {
30 GArrowInt32ArrayBuilder *builder;
31 gboolean success = TRUE;
32 GError *error = NULL;
33
34 builder = garrow_int32_array_builder_new();
35 if (success) {
36 success = garrow_int32_array_builder_append_value(builder, 29, &error);
37 }
38 if (success) {
39 success = garrow_int32_array_builder_append_value(builder, 2929, &error);
40 }
41 if (success) {
42 success = garrow_int32_array_builder_append_value(builder, 292929, &error);
43 }
44 if (!success) {
45 g_print("failed to append: %s\n", error->message);
46 g_error_free(error);
47 g_object_unref(builder);
48 return EXIT_FAILURE;
49 }
50 array = garrow_array_builder_finish(GARROW_ARRAY_BUILDER(builder), &error);
51 if (!array) {
52 g_print("failed to finish: %s\n", error->message);
53 g_error_free(error);
54 g_object_unref(builder);
55 return EXIT_FAILURE;
56 }
57 g_object_unref(builder);
58 }
59
60 {
61 gint64 i, n;
62
63 n = garrow_array_get_length(array);
64 g_print("length: %" G_GINT64_FORMAT "\n", n);
65 for (i = 0; i < n; i++) {
66 gint32 value;
67
68 value = garrow_int32_array_get_value(GARROW_INT32_ARRAY(array), i);
69 g_print("array[%" G_GINT64_FORMAT "] = %d\n", i, value);
70 }
71 }
72
73 g_object_unref(array);
74
75 return EXIT_SUCCESS;
76}

Callers

nothing calls this directly

Tested by

no test coverage detected