Example #1
0
        private List <IArrowArray> BuildArrays(
            Schema schema,
            ByteBuffer messageBuffer,
            Flatbuf.RecordBatch recordBatchMessage)
        {
            var arrays      = new List <IArrowArray>(recordBatchMessage.NodesLength);
            int bufferIndex = 0;

            for (var n = 0; n < recordBatchMessage.NodesLength; n++)
            {
                Field             field     = schema.GetFieldByIndex(n);
                Flatbuf.FieldNode fieldNode = recordBatchMessage.Nodes(n).GetValueOrDefault();

                ArrayData arrayData = field.DataType.IsFixedPrimitive() ?
                                      LoadPrimitiveField(field, fieldNode, recordBatchMessage, messageBuffer, ref bufferIndex) :
                                      LoadVariableField(field, fieldNode, recordBatchMessage, messageBuffer, ref bufferIndex);

                arrays.Add(ArrowArrayFactory.BuildArray(arrayData));
            }

            return(arrays);
        }
Example #2
0
        protected static IEnumerable <IArrowArray> BuildArrays(Schema schema,
                                                               FlatBuffers.ByteBuffer messageBuffer,
                                                               Flatbuf.RecordBatch recordBatchMessage)
        {
            var arrays      = new List <ArrayData>();
            var bufferIndex = 0;

            for (var n = 0; n < recordBatchMessage.NodesLength; n++)
            {
                var field     = schema.GetFieldByIndex(n);
                var fieldNode = recordBatchMessage.Nodes(n).GetValueOrDefault();

                if (field.DataType.IsFixedPrimitive())
                {
                    arrays.Add(LoadPrimitiveField(field, fieldNode, recordBatchMessage, messageBuffer, ref bufferIndex));
                }
                else
                {
                    arrays.Add(LoadVariableField(field, fieldNode, recordBatchMessage, messageBuffer, ref bufferIndex));
                }
            }

            return(arrays.Select(ArrowArrayFactory.BuildArray));
        }