adamreeve commented on code in PR #257: URL: https://github.com/apache/arrow-dotnet/pull/257#discussion_r2920699561
########## src/Apache.Arrow.Operations/Select.cs: ########## @@ -0,0 +1,703 @@ +// 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.Numerics; + +using Apache.Arrow; +using Apache.Arrow.Memory; +using Apache.Arrow.Types; + +namespace Apache.Arrow.Operations; + +public static class Select +{ + /// <summary> + /// Returns a copy of the positions in the array where the mask is true. All other values in the array will be + /// excluded. + /// + /// This internally reduces to building a true-value run index map and calling `Take` + /// </summary> + /// <param name="array">The array to select from</param> + /// <param name="mask">The mask defining which values to keep or exclude</param> + /// <param name="allocator">The memory allocator to build the new array from</param> + /// <returns></returns> + /// <exception cref="InvalidOperationException">If the mask and the array are not of equal size</exception> + public static Array Filter(Array array, BooleanArray mask, MemoryAllocator? allocator = null) Review Comment: I think I aimed to support all types at the time I wrote it, but it may be out of date now. If something like this was integrated into arrow-dotnet it might make sense to have a unit test to check that it works for all available types. -- 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]
