public void Visit(StructType type)
            {
                // TODO: Make data from type fields.

                // The following can be improved with a Builder class for StructArray.
                StringArray.Builder resultStringBuilder = new StringArray.Builder();
                Int32Array.Builder  resultInt32Builder  = new Int32Array.Builder();
                ArrowBuffer         nullBitmapBuffer    = new ArrowBuffer.BitmapBuilder().Append(true).Append(true).Append(false).Build();

                for (int i = 0; i < 3; i++)
                {
                    resultStringBuilder.Append("joe").AppendNull().AppendNull().Append("mark");
                    resultInt32Builder.Append(1).Append(2).AppendNull().Append(4);
                    StringArray  stringArray = new StringArray.Builder().Append("joe").AppendNull().AppendNull().Append("mark").Build();
                    Int32Array   intArray    = new Int32Array.Builder().Append(1).Append(2).AppendNull().Append(4).Build();
                    List <Array> arrays      = new List <Array>
                    {
                        stringArray,
                        intArray
                    };

                    TestTargetArrayList.Add(new StructArray(type, 3, arrays, nullBitmapBuffer, 1));
                }

                StringArray resultStringArray = resultStringBuilder.Build();
                Int32Array  resultInt32Array  = resultInt32Builder.Build();

                ExpectedArray = new StructArray(type, 3, new List <Array> {
                    resultStringArray, resultInt32Array
                }, nullBitmapBuffer, 1);
            }
Exemplo n.º 2
0
            public void Visit(StructType type)
            {
                StringArray.Builder stringBuilder = new StringArray.Builder();
                for (int i = 0; i < Length; i++)
                {
                    stringBuilder.Append(i.ToString());
                }
                StringArray stringArray = stringBuilder.Build();

                Int32Array.Builder intBuilder = new Int32Array.Builder();
                for (int i = 0; i < Length; i++)
                {
                    intBuilder.Append(i);
                }
                Int32Array intArray = intBuilder.Build();

                List <Array> arrays = new List <Array>();

                arrays.Add(stringArray);
                arrays.Add(intArray);

                ArrowBuffer.BitmapBuilder nullBitmap = new ArrowBuffer.BitmapBuilder();
                for (int i = 0; i < Length; i++)
                {
                    nullBitmap.Append(true);
                }

                Array = new StructArray(type, Length, arrays, nullBitmap.Build());
            }
Exemplo n.º 3
0
        private RecordBatch CreateTestBatch(int startValue, int length)
        {
            var batchBuilder = new RecordBatch.Builder();

            Int32Array.Builder builder = new Int32Array.Builder();
            for (int i = 0; i < length; i++)
            {
                builder.Append(startValue + i);
            }
            batchBuilder.Append("test", true, builder.Build());
            return(batchBuilder.Build());
        }
Exemplo n.º 4
0
            public void Visit(DictionaryType type)
            {
                Int32Array.Builder  indicesBuilder = new Int32Array.Builder().Reserve(Length);
                StringArray.Builder valueBuilder   = new StringArray.Builder().Reserve(Length);

                for (int i = 0; i < Length; i++)
                {
                    indicesBuilder.Append(i);
                    valueBuilder.Append($"{i}");
                }

                Array = new DictionaryArray(type, indicesBuilder.Build(), valueBuilder.Build());
            }
Exemplo n.º 5
0
 public IArrowArray BuildArray()
 {
     return(_builder.Build());
 }