testutil

package module
v0.0.0-...-5b908ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayFromJSON

func ArrayFromJSON(t *testing.T, mem memory.Allocator, dt arrow.DataType, json string) arrow.Array

ArrayFromJSON is the same as array.FromJSON, but fails the test on error.

func CheckedClose

func CheckedClose(t *testing.T, obj io.Closer)

CheckedClose validates that a deferred Close call did not fail. See: https://github.com/stretchr/testify/issues/1067

func CheckedCloseWithContext

func CheckedCloseWithContext(t *testing.T, obj CloserWithContext, ctx context.Context)

CheckedCloseWithContext validates that a deferred Close call did not fail. See: https://github.com/stretchr/testify/issues/1067

func RecordFromJSON

func RecordFromJSON(t *testing.T, mem memory.Allocator, schema *arrow.Schema, json string) arrow.RecordBatch

RecordFromJSON is the same as array.RecordFromJSON, but fails the test on error.

func StatisticsToLookupMap

func StatisticsToLookupMap(stats []Statistic) map[int16]Statistic

StatisticsToLookupMap converts a slice of statistics (from ExtractStatisticsForTable) into a lookup map for easier test assertions. Returns a map from statistic key to the full Statistic struct.

Types

type CloserWithContext

type CloserWithContext interface {
	Close(ctx context.Context) error
}

type Statistic

type Statistic struct {
	ColumnName     *string
	StatisticKey   int16
	StatisticValue any
	IsApproximate  bool
}

Statistic represents a single statistic extracted from ADBC GetStatistics results.

func ExtractStatisticsForTable

func ExtractStatisticsForTable(rec arrow.RecordBatch, catalog, schema, table string) []Statistic

ExtractStatisticsForTable extracts statistics for a specific table from GetStatistics result.

This helper navigates the nested ADBC GetStatistics schema:

catalog_name: string
catalog_db_schemas: list<struct{
    db_schema_name: string
    db_schema_statistics: list<struct{
        table_name: string
        column_name: string (nullable)
        statistic_key: int16
        statistic_value: dense_union<int64, uint64, float64, binary>
        statistic_is_approximate: bool
    }>
}>

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL