github.com/apache/arrow/go/v14@v14.0.1/parquet/internal/encoding/delta_byte_array_test.go (about)

     1  // Licensed to the Apache Software Foundation (ASF) under one
     2  // or more contributor license agreements.  See the NOTICE file
     3  // distributed with this work for additional information
     4  // regarding copyright ownership.  The ASF licenses this file
     5  // to you under the Apache License, Version 2.0 (the
     6  // "License"); you may not use this file except in compliance
     7  // with the License.  You may obtain a copy of the License at
     8  //
     9  // http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  
    17  package encoding
    18  
    19  import (
    20  	"fmt"
    21  	"github.com/apache/arrow/go/v14/arrow/memory"
    22  	"github.com/apache/arrow/go/v14/parquet"
    23  	"github.com/stretchr/testify/assert"
    24  	"testing"
    25  )
    26  
    27  func TestDeltaByteArrayDecoder_SetData(t *testing.T) {
    28  	tests := []struct {
    29  		name    string
    30  		nvalues int
    31  		data    []byte
    32  		wantErr assert.ErrorAssertionFunc
    33  	}{
    34  		{
    35  			name:    "null only page",
    36  			nvalues: 126609,
    37  			data:    []byte{128, 1, 4, 0, 0},
    38  			wantErr: assert.NoError,
    39  		},
    40  	}
    41  	for _, tt := range tests {
    42  		d := NewDecoder(parquet.Types.ByteArray, parquet.Encodings.DeltaLengthByteArray, nil, memory.DefaultAllocator)
    43  		t.Run(tt.name, func(t *testing.T) {
    44  			tt.wantErr(t, d.SetData(tt.nvalues, tt.data), fmt.Sprintf("SetData(%v, %v)", tt.nvalues, tt.data))
    45  		})
    46  	}
    47  }