CurtHagenlocher commented on code in PR #268:
URL: https://github.com/apache/arrow-dotnet/pull/268#discussion_r2838617873


##########
src/Apache.Arrow/Arrays/GuidArray.cs:
##########
@@ -0,0 +1,211 @@
+// 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.Collections;
+using System.Collections.Generic;
+using Apache.Arrow.Arrays;
+using Apache.Arrow.Types;
+
+namespace Apache.Arrow
+{
+    /// <summary>
+    /// Extension definition for the "arrow.uuid" extension type,
+    /// backed by FixedSizeBinary(16).
+    /// </summary>
+    public class GuidExtensionDefinition : ExtensionDefinition
+    {
+        public static GuidExtensionDefinition Instance = new 
GuidExtensionDefinition();
+
+        public override string ExtensionName => "arrow.uuid";
+
+        private GuidExtensionDefinition() { }
+
+        public override bool TryCreateType(IArrowType storageType, string 
metadata, out ExtensionType type)
+        {
+            if (storageType is FixedSizeBinaryType fsbType && 
fsbType.ByteWidth == GuidType.ByteWidth)
+            {
+                type = new GuidType(fsbType);
+                return true;
+            }
+            type = null;
+            return false;
+        }
+    }
+
+    /// <summary>
+    /// Extension type representing UUIDs/GUIDs, stored as FixedSizeBinary(16).
+    /// </summary>
+    public class GuidType : ExtensionType
+    {
+        public static GuidType Default = new GuidType();
+
+        internal const int ByteWidth = 16;
+
+        public override string Name => "arrow.uuid";
+        public override string ExtensionMetadata => "";
+
+        public GuidType() : base(new FixedSizeBinaryType(ByteWidth)) { }
+
+        internal GuidType(FixedSizeBinaryType storageType) : base(storageType) 
{ }
+
+        public override ExtensionArray CreateArray(IArrowArray storageArray)
+        {
+            return new GuidArray(this, storageArray);
+        }
+    }
+
+    /// <summary>
+    /// Extension array for UUID/GUID values, backed by a FixedSizeBinaryArray.
+    /// </summary>
+    public class GuidArray : ExtensionArray, IReadOnlyList<Guid?>
+    {
+        // TODO: construct builder

Review Comment:
   Heh, forgot to remove this after I implemented the `Builder`.



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