コード例 #1
0
            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);
            }
コード例 #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());
            }
コード例 #3
0
            public void Visit(StringType type)
            {
                var str     = "helloworld";
                var builder = new StringArray.Builder();

                for (var i = 0; i < Length; i++)
                {
                    builder.Append(str);
                }

                Array = builder.Build();
            }
コード例 #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());
            }
コード例 #5
0
            public void Visit(StringType type)
            {
                StringArray.Builder resultBuilder = new StringArray.Builder().Reserve(_baseDataTotalElementCount);

                for (int i = 0; i < _baseDataListCount; i++)
                {
                    List <int?>         dataList = _baseData[i];
                    StringArray.Builder builder  = new StringArray.Builder().Reserve(dataList.Count);

                    foreach (string value in dataList.Select(_ => _.ToString() ?? null))
                    {
                        builder.Append(value);
                        resultBuilder.Append(value);
                    }
                    TestTargetArrayList.Add(builder.Build());
                }

                ExpectedArray = resultBuilder.Build();
            }
コード例 #6
0
ファイル: EnumEncoder.cs プロジェクト: koralium/Koralium
 public IArrowArray BuildArray()
 {
     return(_builder.Build());
 }