CurtHagenlocher commented on code in PR #332: URL: https://github.com/apache/arrow-dotnet/pull/332#discussion_r3143740347
########## src/Apache.Arrow.Operations/Shredding/ShreddingHelpers.cs: ########## @@ -0,0 +1,48 @@ +// 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 Apache.Arrow; +using Apache.Arrow.Types; + +namespace Apache.Arrow.Operations.Shredding +{ + /// <summary> + /// Internal helpers shared by the shredded-variant reader trio. + /// </summary> + internal static class ShreddingHelpers + { + /// <summary> + /// Builds a <see cref="ShreddedVariant"/> slot for the given index of an element-group + /// struct (one with <c>value</c> and/or <c>typed_value</c> sub-fields). Either sub-field + /// may be absent from the struct. + /// </summary> + public static ShreddedVariant BuildSlot( + ShredSchema slotSchema, + ReadOnlySpan<byte> metadata, + StructArray elementGroup, + int index) + { + StructType elementGroupType = (StructType)elementGroup.Data.DataType; + int valueIdx = elementGroupType.GetFieldIndex("value"); + int typedIdx = elementGroupType.GetFieldIndex("typed_value"); Review Comment: These should probably be cached; need to take a second look. -- 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]
