// 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.package computeimport ()// MatchSubstringOptions controls the substring matching functions such as// starts_with, which match Pattern literally, not as a regular// expression. With IgnoreCase, string and string_view input match Unicode// simple case folds and require a valid UTF-8 pattern, while binary and// binary_view input match ASCII case folds only. String case folding uses// the tables of the Go toolchain's unicode package, so results can differ// between Go versions.typeMatchSubstringOptions = kernels.MatchSubstringOptionsvar startsWithDoc = FunctionDoc{Summary: "Check if strings start with a literal pattern",Description: "For each string in \"strings\", emit true iff it starts with a\n" +"given pattern. The pattern must be given in MatchSubstringOptions.\n" +"Null inputs emit null. Dictionary inputs are decoded to their value\n" +"type, and extension inputs use their storage type.",ArgNames: []string{"strings"},OptionsType: "MatchSubstringOptions",OptionsRequired: true,}type matchSubstringFunc struct {ScalarFunction}func ( *matchSubstringFunc) ( context.Context, FunctionOptions, ...Datum) (Datum, error) {iflen() == 1 { , := coalesceMultiBufferViewDatum(, [0])if != nil {returnnil, }if != nil {defer .Release() = []Datum{} } }returnexecInternal(, , , -1, ...)}func ( *matchSubstringFunc) ( ...arrow.DataType) (exec.Kernel, error) {ensureDictionaryDecoded(...)ensureNoExtensionType(...)return .DispatchExact(...)}// RegisterScalarString registers the starts_with function.func ( FunctionRegistry) { := &matchSubstringFunc{*NewScalarFunction("starts_with", Unary(), startsWithDoc)}for , := rangekernels.GetStartsWithKernels() {if := .AddKernel(); != nil {panic() } } .AddFunction(, false)}// StartsWith returns, for each value in input, whether it starts with// opts.Pattern. Null values produce null. Dictionary inputs are decoded// to their value type, and extension inputs use their storage type.func ( context.Context, MatchSubstringOptions, Datum) (Datum, error) {returnCallFunction(, "starts_with", &, )}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.