eerhardt commented on a change in pull request #11874:
URL: https://github.com/apache/arrow/pull/11874#discussion_r773296758



##########
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;

Review comment:
       Is this field necessary?

##########
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;

Review comment:
       I find it confusing to use two different names here. Can we pick one and 
use it both for the field and the parameter?

##########
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:
       ConcurrentBag is unordered. Meaning when you enumerate it, you can get 
the results in a different order than what they went in. Is that intended?
   
   
https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentbag-1?view=net-6.0




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to