rowscanner

package
v0.0.0-...-3e647be Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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
	Close() error
	Delimiter
}

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

func NewResultPageIterator

func NewResultPageIterator(
	delimiter Delimiter,
	maxPageSize int64,
	opHandle *cli_service.TOperationHandle,
	closedOnServer bool,
	client cli_service.TCLIService,
	connectionId string,
	correlationId string,
	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)
}

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