zixi-bwang commented on a change in pull request #11874:
URL: https://github.com/apache/arrow/pull/11874#discussion_r773548623



##########
File path: csharp/examples/IoTExample/Model/SampleDataPipeline.cs
##########
@@ -0,0 +1,197 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using Apache.Arrow;
+using Apache.Arrow.Ipc;
+using Apache.Arrow.Memory;
+using System.Threading.Channels;
+using System.Threading;
+using System.Collections.Concurrent;
+
+namespace IoTPipelineExample
+{
+    public class SampleDataPipeline
+    {
+        private int _size;
+        private int _partitions;
+        private readonly int _inputs;
+        private readonly int _capacity;
+        private readonly Channel<SensorData> _channel;
+        ChannelWriter<SensorData> _writer;
+        ChannelReader<SensorData> _reader;
+
+        private readonly List<ConcurrentBag<int>> _colSubjectIdArrays;
+        private readonly List<ConcurrentBag<string>> _colActivityLabelArrays;
+        private readonly List<ConcurrentBag<long>> _colTimestampArrays;
+        private readonly List<ConcurrentBag<double>> _colXAxisArrays;
+        private readonly List<ConcurrentBag<double>> _colYAxisArrays;
+        private readonly List<ConcurrentBag<double>> _colZAxisArrays;
+
+        public Dictionary<string, string> activityLabel = new 
Dictionary<string, string>()
+            {
+                {"walking", "A"},
+                {"jogging", "B"},
+                {"stairs", "C"},
+                {"sitting", "D"},
+                {"standing", "E"},
+                {"typing", "F"},
+                {"teeth", "G"},
+                {"soup", "H"},
+                {"chips", "I"},
+                {"pasta", "J"},
+                {"drinking", "K"},
+                {"sandwich", "L"},
+                {"kicking", "M"},
+                {"catch", "O"},
+                {"dribbling", "P"},
+                {"writing", "Q"},
+                {"clapping", "R"},
+                {"folding", "S"},
+            };
+
+        public SampleDataPipeline(int concurrencyLevel, int totalSensorData, 
int queueCapacity)
+        {
+            _partitions = concurrencyLevel;
+            _inputs = totalSensorData;
+            _capacity = queueCapacity;
+            _channel = Channel.CreateBounded<SensorData>(_capacity);
+            _writer = _channel.Writer;
+            _reader = _channel.Reader;
+
+            _colSubjectIdArrays = new List<ConcurrentBag<int>>();
+            _colActivityLabelArrays = new List<ConcurrentBag<string>>();
+            _colTimestampArrays = new List<ConcurrentBag<long>>();
+            _colXAxisArrays = new List<ConcurrentBag<double>>();
+            _colYAxisArrays = new List<ConcurrentBag<double>>();
+            _colZAxisArrays = new List<ConcurrentBag<double>>();
+
+            for (int i = 0; i < _partitions; i++)
+            {
+                _colSubjectIdArrays.Add(new ConcurrentBag<int>());

Review comment:
       My intention was to find a data structure that has below characteristics:
   
   1. Inserting by row
   2. Querying by column
   3. The "results in a different order than what they went in" does not 
matter, but the kth item in one column should belong to the same row as the kth 
item in another column
   4. So all of the column arrays can be appended to a RecordBatch
   
   It seems DataTable is a good candidate, or could you recommend other light 
weight data structures instead?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to