rowscanner

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DateTimeFormats map[string]string = map[string]string{
	"TIMESTAMP": "2006-01-02 15:04:05.999999999",
	"DATE":      "2006-01-02",
}

Expected formats for TIMESTAMP and DATE types when represented by a string value

View Source
var ErrRowsFetchPriorToStart = "databricks: unable to fetch row page prior to start of results"
View Source
var ErrRowsParseValue = "databricks: unable to parse %s value '%v' from column %s"

Functions

func CountRows

func CountRows(rowSet *cli_service.TRowSet) int64

countRows returns the number of rows in the TRowSet

func GetDBType

func GetDBType(column *cli_service.TColumnDesc) cli_service.TTypeId

func GetDBTypeID

func GetDBTypeID(column *cli_service.TColumnDesc) cli_service.TTypeId

GetDBTypeID returns the database type ID from a TColumnDesc

func GetDBTypeName

func GetDBTypeName(column *cli_service.TColumnDesc) string

GetDBTypeName returns the database type name from a TColumnDesc

func GetDBTypeQualifiers

func GetDBTypeQualifiers(column *cli_service.TColumnDesc) *cli_service.TTypeQualifiers

GetDBTypeQualifiers returns the TTypeQualifiers from a TColumnDesc. Return value may be nil.

func HandleDateTime

func HandleDateTime(val any, dbType, columnName string, location *time.Location) (result any, err error)

handleDateTime will convert the passed val to a time.Time value if necessary

func IsNull

func IsNull(nulls []byte, position int64) bool

IsNull return true if the bit at the provided position is set

Types

type Delimiter

type Delimiter interface {
	Start() int64
	End() int64
	Count() int64
	Contains(int64) bool
	Direction(int64) Direction
}

func NewDelimiter

func NewDelimiter(start, count int64) Delimiter

type Direction

type Direction int

Define directions for seeking in the pages of a query result

const (
	DirUnknown Direction = iota
	DirNone
	DirForward
	DirBack
)

func (Direction) String

func (d Direction) String() string

type ResultPageIterator

type ResultPageIterator interface {
	Next() (*cli_service.TFetchResultsResp, error)
	HasNext() bool
	// Err returns the error, if any, that caused HasNext() to report that there
	// are no more pages. It returns nil when the iterator finished normally
	// (i.e. the result set was fully consumed).
	Err() error
	Close() error
	// ResultSetMetadata returns the result-set metadata carried by the first
	// fetched page that included it, or nil if no fetched page has. It never
	// issues an RPC.
	ResultSetMetadata() *cli_service.TGetResultSetMetadataResp
	Delimiter
}

Interface for iterating over the pages in the result set of a query

func NewResultPageIterator

func NewResultPageIterator(
	ctx context.Context,
	delimiter Delimiter,
	maxPageSize int64,
	opHandle *cli_service.TOperationHandle,
	hasMoreRows *bool,
	closedOnServer bool,
	client cli_service.TCLIService,
	logger *dbsqllog.DBSQLLogger,
) ResultPageIterator

Create a new result page iterator.

type RowScanner

type RowScanner interface {
	Delimiter
	// ScanRow is called to populate the provided slice with the
	// content of the current row. The provided slice will be the same
	// size as the number of columns.
	// The dest should not be written to outside of ScanRow. Care
	// should be taken when closing a RowScanner not to modify
	// a buffer held in dest.
	ScanRow(dest []driver.Value, rowNumber int64) dbsqlerr.DBError

	// NRows returns the number of rows in the current result page
	NRows() int64

	// Close any open resources
	Close()

	GetArrowBatches(ctx context.Context, cfg config.Config, rpi ResultPageIterator) (dbsqlrows.ArrowBatchIterator, error)
	GetArrowIPCStreams(ctx context.Context, cfg config.Config, rpi ResultPageIterator) (dbsqlrows.ArrowIPCStreamIterator, error)
}

RowScanner is an interface defining the behaviours that are specific to the formats in which query results can be returned.

Jump to

Keyboard shortcuts

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