From user-return-440-archive-asf-public=cust-asf.ponee.io@arrow.apache.org Tue May 5 05:43:16 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8AD20180665 for ; Tue, 5 May 2020 07:43:16 +0200 (CEST) Received: (qmail 53221 invoked by uid 500); 5 May 2020 05:43:15 -0000 Mailing-List: contact user-help@arrow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@arrow.apache.org Delivered-To: mailing list user@arrow.apache.org Received: (qmail 53201 invoked by uid 99); 5 May 2020 05:43:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2020 05:43:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C8404C20AC for ; Tue, 5 May 2020 05:43:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-he-de.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id UEvbTRN8kkj8 for ; Tue, 5 May 2020 05:43:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::f2f; helo=mail-qv1-xf2f.google.com; envelope-from=soswizzy@gmail.com; receiver= Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id B0CFD7DC67 for ; Tue, 5 May 2020 05:43:12 +0000 (UTC) Received: by mail-qv1-xf2f.google.com with SMTP id ep1so477205qvb.0 for ; Mon, 04 May 2020 22:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=6c34vTlZUetMN6cnnQBAVG/w7D8IXt4p1nkcA4gYobk=; b=fdK7stRdZOOtbw8S/4htoLaoKnPQ/pYNvz4PYWPEI0vLzOtQc6e9y+Tz7g+SpRYFBE U76IcNA16vatccEVzAS97sKXAimIYWfZeQbjqtwM2VLh8V4ceyhYg13J5Q0FG8y3fMem KNF8GjDvjly6zB1QxctRLCT+8JYZ0med2Ph6kdOSwZr0FCxu1Fsk1dkEPsPyG3TPE+ZS Ab/Axn1UmLTveLKzBsin1jR0TVB221qHM9MSzHbl9VYOpQx/Kuy5mF0miWj6ML1BE+UC wOcch1AGo3KS+lTzuBkOcA+WXRQPzCk7D6kzEKquT2LsmZibL5KQnwP8vVMhxzs4B/vW gb0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=6c34vTlZUetMN6cnnQBAVG/w7D8IXt4p1nkcA4gYobk=; b=X0a8KIfIcXlQ+O4q7rPPt6mbRIdhllRmSPoV2bXZFe3n/HZqCi54Hb5+sCa8AqHe7+ aRWNZgVZU9T/U+3gwcX9rLM20NFt8hThEtdKavPO+nOir7LZ+MqG0i1jHSd1Ajg5M1U7 RIOSetejfyP8M1F/9FexN8+KeMU+wjB9DG39+BfEk9csJgClaGt1TSGxcqZP0BGoXege AL6E3RmLBjvvEFPEfnzEfbRB9Ge43oa+BAfLRflpYL9GXNoydiIK4H0HwjU8+z6cTqHO FEj+MT3TGN5XlTTSLtn5avzDHPgo21pVwG4Z8AzGNTTau5dLOaoujssqwcAnYK15oWP3 0Uww== X-Gm-Message-State: AGi0PubtfQGo+gbS5N/X0yHI2qmIiB4saX0S62aKTiVvu91OiUak1DOR BL7Y4NwYVbBtQvVKu9LSW5qoNADMOGUuX+3GsX5OBTjP X-Google-Smtp-Source: APiQypLF4KIojIWcMLYqH65mDZjrX6ltFGH6rpbEyffIAafwWbZo49SHvl+/y7rUcgvDvzXqmQCU1hR/nkanS/e4kiA= X-Received: by 2002:a0c:90e7:: with SMTP id p94mr1105960qvp.219.1588657391191; Mon, 04 May 2020 22:43:11 -0700 (PDT) MIME-Version: 1.0 From: swizz one Date: Tue, 5 May 2020 07:42:59 +0200 Message-ID: Subject: Fixed array created with buffer To: user@arrow.apache.org Content-Type: multipart/alternative; boundary="00000000000078cca205a4e01f15" --00000000000078cca205a4e01f15 Content-Type: text/plain; charset="UTF-8" Please, I am trying to make a fix size array without using the append method but i keep getting the wrong number read out. I am thinking that the array is not reading the correct buffer. The code is the follwing GError *error = NULL; // First we create the array for each of the members of the position structure object GArrowFloatArray * x_array; GArrowFloatArray * y_array; GArrowFloatArray * z_array; // The number of rows per record batch/ array would be 500 // defining array length which must be equal for all array gint64 len = 2; // not Null element in the array- GArrowBuffer *data = NULL // no Null element -> gint64 n_nulls = 0; // creating the data to input into the array GArrowBuffer * x_buffer; GArrowBuffer * y_buffer; GArrowBuffer * z_buffer; guint8 data_x[len]; guint8 data_y[len]; guint8 data_z[len]; //generating the values for ( int i = 0; i < len; i++){ data_x[i] = 1; data_y[i] = 1; data_z[i] = 1; g_print("%d ", data_x[i]); g_print("%d ", data_y[i]); g_print("%d ", data_z[i]); } // Creating the buffer x_buffer = garrow_buffer_new(data_x, len * sizeof(gint64)); y_buffer = garrow_buffer_new(data_y, len* sizeof(gint64)); z_buffer = garrow_buffer_new(data_z, len* sizeof(gint64)); // creating arrow float aray x_array = garrow_float_array_new(len, x_buffer, NULL, 0); y_array = garrow_float_array_new(len, y_buffer, NULL, 0); z_array = garrow_float_array_new(len, z_buffer, NULL, 0); //g_print("%s", garrow_array_to_string (GARROW_ARRAY(x_array),NULL)); const gfloat * to_print = garrow_float_array_get_values (x_array,&len); g_print("%g\n", *to_print); // declaring fields GArrowField *field_x, *field_y, *field_z; // all the array are the same type // finding the data type //GArrowDataType * data_type_x = garrow_array_get_value_data_type(x_array); // GArrowDataType * data_type_y = garrow_array_get_value_data_type(x_array); // GArrowDataType * data_type_z = garrow_array_get_value_data_type(x_array); field_x = garrow_field_new ("x_column", GARROW_DATA_TYPE(garrow_float_data_type_new())); field_y = garrow_field_new ("y_column", GARROW_DATA_TYPE(garrow_float_data_type_new())); field_z = garrow_field_new ("z_column", GARROW_DATA_TYPE(garrow_float_data_type_new())); Result 1 1 1 1 1 1 2.36943e-38 x_column: [ 2.36943e-38, 1.34222e+08 ] y_column: [ 2.36943e-38, 0.000265695 ] z_column: [ 1.34222e+08, -1.0248e-23 ] columns[0](x_column): [2.36943e-38, 1.34222e+08] columns[1](y_column): [2.36943e-38, 0.000265695] columns[2](z_column): [1.34222e+08, -1.0248e-23] --00000000000078cca205a4e01f15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Please, I am trying to make a fix size array without usin= g the append method but i keep getting the wrong number read out. I am thin= king that the array is not reading the correct buffer. The code is the foll= wing=C2=A0

GError *error =3D NULL;
=C2=A0= // First we create the array for each of the members of the position struc= ture object
=C2=A0 GArrowFloatArray * x_array;
=C2=A0 GArrowFloatArra= y * y_array;
=C2=A0 GArrowFloatArray * z_array;

=C2=A0 // The num= ber of rows per record batch/ array would be 500
=C2=A0 // defining arra= y length which must be equal for all array

=C2=A0 gint64 len =3D 2;<= br>=C2=A0 // not Null element in the array- GArrowBuffer *data =3D NULL
= =C2=A0 // no Null element -> gint64 n_nulls =3D 0;

=C2=A0 // crea= ting the data to input into the array
=C2=A0 GArrowBuffer * x_buffer;=C2=A0 GArrowBuffer * y_buffer;
=C2=A0 GArrowBuffer * z_buffer;

= =C2=A0 guint8 data_x[len];
=C2=A0 guint8 data_y[len];
=C2=A0 guint8 d= ata_z[len];
=C2=A0 //generating the values
=C2=A0 for ( int i =3D 0; = i < len; i++){
=C2=A0 =C2=A0 data_x[i] =3D 1;
=C2=A0 =C2=A0 data_y= [i] =3D 1;
=C2=A0 =C2=A0 data_z[i] =3D 1;
=C2=A0 =C2=A0 g_print("= ;%d ", data_x[i]);
=C2=A0 =C2=A0 g_print("%d ", data_y[i]= );
=C2=A0 =C2=A0 g_print("%d ", data_z[i]);

=C2=A0 }=C2=A0



=C2=A0 // Creating the buffer
=C2=A0 x_buffer =3D= garrow_buffer_new(data_x, len * sizeof(gint64));
=C2=A0 y_buffer =3D ga= rrow_buffer_new(data_y, len* sizeof(gint64));
=C2=A0 z_buffer =3D garrow= _buffer_new(data_z, len* sizeof(gint64));

=C2=A0 // creating arrow f= loat aray
=C2=A0 x_array =3D garrow_float_array_new(len, x_buffer, NULL,= 0);
=C2=A0 y_array =3D garrow_float_array_new(len, y_buffer, NULL, 0);<= br>=C2=A0 z_array =3D garrow_float_array_new(len, z_buffer, NULL, 0);
= =C2=A0 //g_print("%s", garrow_array_to_string (GARROW_ARRAY(x_arr= ay),NULL));
=C2=A0 const gfloat * to_print =3D garrow_float_array_get_va= lues (x_array,&len);
=C2=A0 g_print("%g\n", *to_print);=C2=A0 // declaring fields
=C2=A0 GArrowField *field_x, *field_y, *fiel= d_z;
=C2=A0 // all the array are the same type
=C2=A0 // finding the = data type
=C2=A0 //GArrowDataType * data_type_x =3D garrow_array_get_val= ue_data_type(x_array);
=C2=A0 // GArrowDataType * data_type_y =3D garrow= _array_get_value_data_type(x_array);
=C2=A0 // GArrowDataType * data_typ= e_z =3D garrow_array_get_value_data_type(x_array);

=C2=A0 field_x = =3D garrow_field_new ("x_column", GARROW_DATA_TYPE(garrow_float_d= ata_type_new()));
=C2=A0 field_y =3D garrow_field_new ("y_column&qu= ot;, GARROW_DATA_TYPE(garrow_float_data_type_new()));
=C2=A0 field_= z =3D garrow_field_new ("z_column", GARROW_DATA_TYPE(garrow_float= _data_type_new()));



=
Result

1 1 1 1 1 1 2.36943e-38<= br>x_column: =C2=A0 [
=C2=A0 =C2=A0 2.36943e-38,
=C2=A0 =C2=A0 1.3422= 2e+08
=C2=A0 ]
y_column: =C2=A0 [
=C2=A0 =C2=A0 2.36943e-38,
= =C2=A0 =C2=A0 0.000265695
=C2=A0 ]
z_column: =C2=A0 [
=C2=A0 =C2= =A0 1.34222e+08,
=C2=A0 =C2=A0 -1.0248e-23
=C2=A0 ]
columns[0](x_c= olumn): [2.36943e-38, 1.34222e+08]
columns[1](y_column): [2.36943e-38, 0= .000265695]
columns[2](z_column): [1.34222e+08, -1.0248e-23]

--00000000000078cca205a4e01f15--