function

package
v1.0.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Distinct     = 0x8000000000000000
	DistinctMask = 0x7FFFFFFFFFFFFFFF
)
View Source
const (
	EQUAL              = iota // =
	NOT_EQUAL                 // <>
	GREAT_THAN                // >
	GREAT_EQUAL               // >=
	LESS_THAN                 // <
	LESS_EQUAL                // <=
	BETWEEN                   // BETWEEN
	UNARY_PLUS                // UNARY_PLUS +
	UNARY_MINUS               // UNARY_MINUS -
	UNARY_TILDE               // UNARY_TILDE ~
	PLUS                      // +
	MINUS                     // -
	MULTI                     // *
	DIV                       // /
	INTEGER_DIV               // Div
	MOD                       // %
	CONCAT                    // ||
	AND                       // AND
	OR                        // OR
	XOR                       // XOR
	NOT                       // NOT
	CAST                      // CAST
	BIT_CAST                  // BIT_CAST
	IS                        // IS
	ISNOT                     // ISNOT
	ISNULL                    // ISNULL
	ISNOTNULL                 // ISNOTNULL
	ISUNKNOWN                 // ISUNKNOWN
	ISNOTUNKNOWN              // ISNOTUNKNOWN
	ISTRUE                    // ISTRUE
	ISNOTTRUE                 // ISNOTTRUE
	ISFALSE                   // ISFALSE
	ISNOTFALSE                // ISNOTTRUE
	ISEMPTY                   // ISEMPTY
	NOT_IN_ROWS               // NOT_IN_ROWS
	OP_BIT_AND                // &
	OP_BIT_OR                 // |
	OP_BIT_XOR                // ^
	OP_BIT_SHIFT_LEFT         // <<
	OP_BIT_SHIFT_RIGHT        // >>

	ABS            // ABS
	ACOS           // ACOS
	ADDDATE        // ADDDATE
	ADDTIME        // ADDTIME
	AES_DECRYPT    // AES_DECRYPT
	AES_ENCRYPT    // AES_ENCRYPT
	ANY_VALUE      // ANY_VALUE
	APPROX_COUNT   // APPROX_COUNT
	ARRAY_AGG      // ARRAY_AGG
	ARRAY_APPEND   // ARRAY_APPEND
	ARRAY_CAT      // ARRAY_CAT
	ARRAY_CONTAINS // ARRAY_CONTAINS
	ARRAY_POSITION // ARRAY_POSITION
	ARRAY_SIZE     // ARRAY_SIZE
	ASCII          // ASCII
	ASIN           // ASIN
	ASSERT         // ASSERT
	ATAN           // ATAN
	ATAN2          // ATAN2
	AVG            // AVG
	BASE64_DECODE  // BASE64_DECODE
	BASE64_ENCODE  // BASE64_ENCODE
	BIT_AND        // BIT_AND
	BIT_LENGTH     // BIT_LENGTH
	BIT_NOT        // BIT_NOT
	BIT_OR         // BIT_OR
	BIT_XOR        // BIT_XOR
	BITAGG_AND     // BITAGG_AND
	BITAGG_OR      // BITAGG_OR
	BOOLAGG_AND    // BOOLAGG_AND
	BOOLAGG_OR     // BOOLAGG_OR
	CASE           // CASE
	CEIL           // CEIL
	CHR            // CHR
	COALESCE       // COALESCE
	FIELD          // FIELD
	CONCAT_WS
	CONTAINS          // CONTAINS
	CORR              // CORR
	COS               // COS
	COT               // COT
	COUNT             // COUNT
	COUNT_IF          // COUNT_IF
	COVAR_POP         // COVAR_POP
	COVAR_SAMPLE      // COVAR_SAMPLE
	CUME_DIST         // CUME_DIST
	CURRENT_DATE      // CURRENT_DATE
	CURRENT_TIMESTAMP // CURRENT_TIMESTAMP
	DATE_FROM_PARTS   // DATE_FROM_PARTS
	DATE_PART         // DATE_PART
	DATEADD           // DATEADD
	DATEDIFF          // DATEDIFF
	TIMEDIFF          // TIMEDIFF
	TIMESTAMPDIFF     // TIMESTAMPDIFF
	DENSE_RANK        // DENSE_RANK
	EMPTY
	ENDSWITH // ENDSWITH
	EXP      // EXP
	FINDINSET
	FIRST_VALUE // FIRST_VALUE
	FLOOR       // FLOOR
	GREATEST    // GREATEST
	GROUPING_ID // GROUPING_ID
	HASH        // HASH
	HASH_AGG    // HASH_AGG
	HEX_DECODE  // HEX_DECODE
	HEX_ENCODE  // HEX_ENCODE
	HEX         // HEX
	IFF         // IFF
	IFNULL      // IFNULL
	ILIKE       // ILIKE
	ILIKE_ALL   // ILIKE_ALL
	ILIKE_ANY   // ILIKE_ANY
	IN          // IN
	LAG         // LAG
	LAST_VALUE  // LAST_VALUE
	LEAD        // LEAD
	LEAST       // LEAST
	LEFT        // LEFT
	LENGTH      // LENGTH
	LENGTH_UTF8
	LIKE     // LIKE
	LIKE_ALL // LIKE_ALL
	LIKE_ANY // LIKE_ANY
	LN       // LN
	NOT_IN   // NOT_IN
	LOG      // LOG
	LOWER    // LOWER
	LPAD     // LPAD
	LTRIM    // LTRIM
	MAX      // MAX
	MEDIAN   // MEDIAN
	MIN      // MIN
	MODE     // MODE
	MONTH
	NORMAL         // NORMAL
	NTH_VALUE      // NTH_VALUE
	NTILE          // NTILE
	NULLIF         // NULLIF
	PERCENT_RANK   // PERCENT_RANK
	PI             // PI
	POSITION       // POSITION
	POW            // POW
	RADIAN         // RADIAN
	RANDOM         // RANDOM
	RANK           // RANK
	REGEXP         // REGEXP
	REGEXP_INSTR   // REGEXP_INSTR
	REGEXP_LIKE    // REGEXP_LIKE
	REGEXP_REPLACE // REGEXP_REPLACE
	REGEXP_SUBSTR  // REGEXP_SUBSTR
	REG_MATCH      // REG_MATHCH
	NOT_REG_MATCH  // NOT_REG_MATCH
	REPEAT         // REPEAT
	REPLACE        // REPLACE
	REVERSE
	RIGHT      // RIGHT
	ROUND      // ROUND
	ROW_NUMBER // ROW_NUMBER
	RPAD       // RPAD
	RTRIM      // RTRIM
	SIGN       // SIGN
	SIN        // SIN
	SINH       //SINH
	SPACE
	SPLIT         // SPLIT
	SPLIT_PART    // SPLIT_PART
	SQRT          // SQRT
	STARCOUNT     // STARTCOUNT
	STARTSWITH    // STARTSWITH
	STDDEV_POP    // STDDEV_POP
	STDDEV_SAMPLE // STDDEV_SAMPLE
	SUBSTR        // SUBSTR
	SUM           // SUM
	GROUP_CONCAT
	TAN // TAN
	TO_DATE
	STR_TO_DATE
	TO_INTERVAL // TO_INTERVAL
	TRANSLATE   // TRANSLATE
	TRIM        // TRIM
	UNIFORM     // UNIFORM
	UTC_TIMESTAMP
	UNIX_TIMESTAMP
	FROM_UNIXTIME
	UPPER      // UPPER
	VAR_POP    // VAR_POP
	VAR_SAMPLE // VAR_SAMPLE

	EXISTS // EXISTS
	ALL    // ALL
	ANY    // ANY

	DATE      // DATE
	TIME      //TIME
	DAY       //DAY
	DAYOFYEAR // DAYOFYEAR
	INTERVAL  // INTERVAL
	EXTRACT   // EXTRACT
	OCT
	SUBSTRING       // SUBSTRING
	SUBSTRING_INDEX //SUBSTRING_INDEX
	WEEK            //WEEK
	WEEKDAY
	YEAR   // YEAR
	HOUR   // HOUR
	MINUTE // MINUTE
	SECOND // SECOND
	TO_DAYS
	TO_SECONDS

	DATE_ADD              // DATE_ADD
	DATE_SUB              // DATE_SUB
	APPROX_COUNT_DISTINCT // APPROX_COUNT_DISTINCT, special aggregate

	LOAD_FILE // LOAD_FILE

	//information functions
	//Reference to : https://dev.mysql.com/doc/refman/8.0/en/information-functions.html
	DATABASE
	USER
	CONNECTION_ID
	CHARSET
	CONVERT
	CURRENT_ROLE
	FOUND_ROWS
	ICULIBVERSION
	LAST_INSERT_ID
	LAST_QUERY_ID
	LAST_UUID
	ROLES_GRAPHML
	ROW_COUNT
	VERSION
	COLLATION
	CURRENT_ACCOUNT_ID
	CURRENT_ACCOUNT_NAME
	CURRENT_ROLE_ID
	CURRENT_ROLE_NAME
	CURRENT_USER_ID
	CURRENT_USER_NAME

	TIMESTAMP    // TIMESTAMP
	DATE_FORMAT  // DATE_FORMAT
	JSON_EXTRACT // JSON_EXTRACT
	JSON_QUOTE   // JSON_QUOTE
	JSON_UNQUOTE // JSON_UNQUOTE
	FORMAT       // FORMAT
	SLEEP        // sleep for a while
	INSTR

	UUID
	SERIAL
	BIN //BIN

	ENABLE_FAULT_INJECTION
	DISABLE_FAULT_INJECTION
	ADD_FAULT_POINT     // Add a fault point
	REMOVE_FAULT_POINT  // Remove
	TRIGGER_FAULT_POINT // Trigger.

	MO_MEMORY_USAGE // Dump memory usage
	MO_ENABLE_MEMORY_USAGE_DETAIL
	MO_DISABLE_MEMORY_USAGE_DETAIL

	// MO_CTL is used to check some internal status, and issue some ctl commands to the service.
	// see builtin.ctl.ctl.go to get detail.
	MO_CTL

	MO_SHOW_VISIBLE_BIN // parse type/onUpdate/default []byte to visible string

	MO_TABLE_ROWS    // table rows
	MO_TABLE_SIZE    // table size
	MO_TABLE_COL_MAX // table column max value
	MO_TABLE_COL_MIN // table column min value

	MO_LOG_DATE // parse date from string, like __mo_filepath
	MO_CHECH_LEVEL
	PURGE_LOG // purge mo internal log, like rawlog, statement_info, metric

	GIT_VERSION
	BUILD_VERSION

	// be used: insert into t1 values(1,1) on duplicate key update a=values(a)+a+1
	VALUES
	BINARY
	INTERNAL_CHAR_LENGTH
	INTERNAL_CHAR_SIZE
	INTERNAL_NUMERIC_PRECISION
	INTERNAL_NUMERIC_SCALE
	INTERNAL_DATETIME_SCALE
	INTERNAL_COLUMN_CHARACTER_SET
	INTERNAL_AUTO_INCREMENT

	// be uesed: enum
	CAST_INDEX_TO_VALUE
	CAST_VALUE_TO_INDEX
	CAST_INDEX_VALUE_TO_INDEX

	//Sequence function
	NEXTVAL
	SETVAL
	CURRVAL
	LASTVAL

	// FUNCTION_END_NUMBER is not a function, just a flag to record the max number of function.
	// TODO: every one should put the new function id in front of this one if you want to make a new function.
	FUNCTION_END_NUMBER
)

All function IDs

View Source
const ADZeroDays = 366

The number of days in the year 0000 AD

View Source
const ADZeroSeconds = 31622400

Seconds in 0000 AD

View Source
const (
	AllColumns = "*"
)
View Source
const (
	DefaultEscapeChar = '\\'
)
View Source
const (
	MaxAllowedValue = 8000
)
View Source
const MaxTgtLen = int64(16 * 1024 * 1024)
View Source
const SecondsIn24Hours = 86400

24-hour seconds

Variables

View Source
var (
	// WeekdayNames lists names of weekdays, which are used in builtin function `date_format`.
	WeekdayNames = []string{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	}

	// MonthNames lists names of months, which are used in builtin function `date_format`.
	MonthNames = []string{
		"January",
		"February",
		"March",
		"April",
		"May",
		"June",
		"July",
		"August",
		"September",
		"October",
		"November",
		"December",
	}

	// AbbrevWeekdayName lists Abbreviation of week names, which are used int builtin function 'date_format'
	AbbrevWeekdayName = []string{
		"Sun",
		"Mon",
		"Tue",
		"Wed",
		"Thu",
		"Fri",
		"Sat",
	}
)
View Source
var AggSumOverloadID = encodeOverloadID(SUM, 0)
View Source
var AndFunctionEncodedID = encodeOverloadID(AND, 0)
View Source
var AndFunctionName = "and"
View Source
var EqualFunctionEncodedID = encodeOverloadID(EQUAL, 0)
View Source
var EqualFunctionName = "="
View Source
var GroupConcatFunctionID = encodeOverloadID(GROUP_CONCAT, 0)
View Source
var InFunctionEncodedID = encodeOverloadID(IN, 0)
View Source
var InFunctionName = "in"
View Source
var MaxInt64digits = numOfDigits(math.MaxInt64) // 19
View Source
var MaxUint64digits = numOfDigits(math.MaxUint64) // 20
View Source
var ScaleTable = [...]uint64{
	1,
	10,
	100,
	1000,
	10000,
	100000,
	1000000,
	10000000,
	100000000,
	1000000000,
	10000000000,
	100000000000,
	1000000000000,
	10000000000000,
	100000000000000,
	1000000000000000,
	10000000000000000,
	100000000000000000,
	1000000000000000000,
	10000000000000000000,
}

ScaleTable is a lookup array for digits

View Source
var SerialFunctionEncodeID = encodeOverloadID(SERIAL, 0)

Functions

func AbbrDayOfMonth added in v0.8.0

func AbbrDayOfMonth(day int) string

AbbrDayOfMonth: Get the abbreviation of month of day

func AbsDecimal128 added in v0.8.0

func AbsDecimal128(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func AbsFloat64 added in v0.8.0

func AbsFloat64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func AbsInt64 added in v0.8.0

func AbsInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func AbsUInt64 added in v0.8.0

func AbsUInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func AddFaultPoint added in v0.8.0

func AddFaultPoint(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func AsciiInt added in v0.8.0

func AsciiInt[T types.Ints](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func AsciiString added in v0.8.0

func AsciiString(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func AsciiUint added in v0.8.0

func AsciiUint[T types.UInts](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Bin added in v0.8.0

func BinFloat added in v0.8.0

func BinFloat[T constraints.Float](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Binary added in v0.8.0

func Binary(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func BitCast added in v1.0.0

func BitCast(
	parameters []*vector.Vector,
	result vector.FunctionResultWrapper,
	proc *process.Process,
	length int,
) error

func BitLengthFunc added in v0.8.0

func BitLengthFunc(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func BuildVersion added in v0.8.0

func BuildVersion(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func CalcToSeconds added in v0.8.0

func CalcToSeconds(ctx context.Context, datetimes []types.Datetime, ns *nulls.Nulls) ([]int64, error)

CalcToSeconds: CalcToDays is used to return a day number (the number of days since year 0)

func CastIndexToValue added in v1.0.0

func CastIndexToValue(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

CastIndexToValue returns enum type index according to the value

func CastIndexValueToIndex added in v1.0.0

func CastIndexValueToIndex(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

CastIndexValueToIndex returns enum type index according to the index value

func CastValueToIndex added in v1.0.0

func CastValueToIndex(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

CastValueToIndex returns enum type index according to the value

func CeilDecimal128 added in v0.8.0

func CeilDecimal128(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func CeilDecimal64 added in v0.8.0

func CeilDecimal64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func CeilFloat64 added in v0.8.0

func CeilFloat64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func CeilInt64 added in v0.8.0

func CeilInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func CeilStr added in v0.8.0

func CeilStr(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func CeilUint64 added in v0.8.0

func CeilUint64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Charset added in v0.8.0

func Charset(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func CoalesceGeneral added in v0.8.0

func CoalesceGeneral[T NormalType](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func CoalesceStr added in v0.8.0

func CoalesceStr(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func Collation added in v0.8.0

func Collation(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func ConcatWs added in v0.8.0

func ConcatWs(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func ConnectionID added in v0.8.0

func ConnectionID(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func CurrentDate added in v0.8.0

func CurrentDate(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Currval added in v0.8.0

func Currval(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DateAdd added in v0.8.0

func DateAdd(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DateFSP added in v0.8.0

func DateFSP(date string) (fsp int)

DateFSP gets fsp from date string.

func DateFormat added in v0.8.0

func DateFormat(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DateStringAdd added in v0.8.0

func DateStringAdd(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DateStringSub added in v0.8.0

func DateStringSub(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func DateStringToDate added in v0.8.0

func DateStringToDate(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

DateStringToDate can still speed up if vec is const. but we will do the constant fold. so it does not matter.

func DateStringToMonth added in v0.8.0

func DateStringToMonth(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

TODO: I will support template soon.

func DateStringToTime added in v0.8.0

func DateStringToTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateStringToTimestamp added in v0.8.0

func DateStringToTimestamp(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateStringToYear added in v0.8.0

func DateStringToYear(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateSub added in v0.8.0

func DateSub(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DateTimeDiff added in v0.8.0

func DateTimeDiff(intervalUnit string, t1 types.Datetime, t2 types.Datetime) int64

DateTimeDiff returns t2 - t1 where t1 and t2 are datetime expressions. The unit for the result is given by the unit argument. The values for interval unit are "QUARTER","YEAR","MONTH", "DAY", "HOUR", "SECOND", "MICROSECOND"

func DateToDate added in v0.8.0

func DateToDate(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToDay added in v0.8.0

func DateToDay(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToMonth added in v0.8.0

func DateToMonth(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToTime added in v0.8.0

func DateToTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToTimestamp added in v0.8.0

func DateToTimestamp(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToWeek added in v0.8.0

func DateToWeek(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToWeekday added in v0.8.0

func DateToWeekday(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DateToYear added in v0.8.0

func DateToYear(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeAdd added in v0.8.0

func DatetimeAdd(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DatetimeSub added in v0.8.0

func DatetimeSub(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func DatetimeToDate added in v0.8.0

func DatetimeToDate(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToDay added in v0.8.0

func DatetimeToDay(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToHour added in v0.8.0

func DatetimeToHour(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToMinute added in v0.8.0

func DatetimeToMinute(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToMonth added in v0.8.0

func DatetimeToMonth(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToSecond added in v0.8.0

func DatetimeToSecond(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToTime added in v0.8.0

func DatetimeToTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToTimestamp added in v0.8.0

func DatetimeToTimestamp(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToWeek added in v0.8.0

func DatetimeToWeek(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToWeekday added in v0.8.0

func DatetimeToWeekday(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DatetimeToYear added in v0.8.0

func DatetimeToYear(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DayOfYear added in v0.8.0

func DayOfYear(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Decimal128ToTime added in v0.8.0

func Decimal128ToTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func DecodeOverloadID

func DecodeOverloadID(overloadID int64) (fid int32, oIndex int32)

func DeduceNotNullable added in v0.7.0

func DeduceNotNullable(overloadID int64, args []*plan.Expr) bool

DeduceNotNullable helps optimization sometimes. deduce notNullable for function for example, create table t1(c1 int not null, c2 int, c3 int not null ,c4 int); sql select c1+1, abs(c2), cast(c3 as varchar(10)) from t1 where c1=c3; we can deduce that c1+1, cast c3 and c1=c3 is notNullable, abs(c2) is nullable.

func DisableFaultInjection added in v0.8.0

func DisableFaultInjection(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Empty added in v0.8.0

func Empty(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func EnableFaultInjection added in v0.8.0

func EnableFaultInjection(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func EndsWith added in v0.8.0

func EndsWith(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func ExtractFromDate added in v0.8.0

func ExtractFromDate(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func ExtractFromDatetime added in v0.8.0

func ExtractFromDatetime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func ExtractFromTime added in v0.8.0

func ExtractFromTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func ExtractFromVarchar added in v0.8.0

func ExtractFromVarchar(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FieldNumber added in v0.8.0

func FieldNumber[T number](ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func FieldString added in v0.8.0

func FieldString(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func FillSpaceNumber added in v0.8.0

func FillSpaceNumber[T types.BuiltinNumber](v T) (string, error)

func FindInSet added in v0.8.0

func FindInSet(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FloorDecimal128 added in v0.8.0

func FloorDecimal128(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FloorDecimal64 added in v0.8.0

func FloorDecimal64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FloorFloat64 added in v0.8.0

func FloorFloat64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FloorInt64 added in v0.8.0

func FloorInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FloorStr added in v0.8.0

func FloorStr(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FloorUInt64 added in v0.8.0

func FloorUInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FormatCastErrorForInsertValue added in v0.8.0

func FormatCastErrorForInsertValue(ctx context.Context, originStr string, typ types.Type, extraInfo string) error

func FormatIntByWidth added in v0.8.0

func FormatIntByWidth(num, n int) string

FormatIntByWidth: Formatintwidthn is used to format ints with width parameter n. Insufficient numbers are filled with 0.

func FormatWith2Args added in v0.8.0

func FormatWith2Args(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func FormatWith3Args added in v0.8.0

func FormatWith3Args(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func FoundRows added in v0.8.0

func FoundRows(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func FromUnixTimeFloat64 added in v0.8.0

func FromUnixTimeFloat64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FromUnixTimeFloat64Format added in v0.8.0

func FromUnixTimeFloat64Format(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FromUnixTimeInt64 added in v0.8.0

func FromUnixTimeInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FromUnixTimeInt64Format added in v0.8.0

func FromUnixTimeInt64Format(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FromUnixTimeUint64 added in v0.8.0

func FromUnixTimeUint64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func FromUnixTimeUint64Format added in v0.8.0

func FromUnixTimeUint64Format(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func GetAggFunctionNameByID added in v1.0.0

func GetAggFunctionNameByID(overloadID int64) string

func GetFunctionById added in v0.8.0

func GetFunctionById(ctx context.Context, overloadID int64) (f overload, err error)

func GetFunctionByIdWithoutError added in v0.8.0

func GetFunctionByIdWithoutError(overloadID int64) (f overload, exists bool)

func GetFunctionIsAggregateByName

func GetFunctionIsAggregateByName(name string) bool

func GetFunctionIsMonotonicById added in v0.6.0

func GetFunctionIsMonotonicById(ctx context.Context, overloadID int64) (bool, error)

func GetFunctionIsWinFunByName added in v0.8.0

func GetFunctionIsWinFunByName(name string) bool

func GetFunctionIsWinOrderFunById added in v1.0.0

func GetFunctionIsWinOrderFunById(overloadID int64) bool

func GetFunctionIsWinOrderFunByName added in v0.8.0

func GetFunctionIsWinOrderFunByName(name string) bool

func GitVersion added in v0.8.0

func GitVersion(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func HexInt64 added in v0.8.0

func HexInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func HexString added in v0.8.0

func HexString(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func ICULIBVersion added in v0.8.0

func ICULIBVersion(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func IfTypeCastSupported added in v0.8.0

func IfTypeCastSupported(sourceType, targetType types.T) bool

func Instr added in v0.8.0

func Instr(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Int64ToTime added in v0.8.0

func Int64ToTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func IntSingle added in v0.8.0

func IntSingle[T types.Ints](val T, start int) uint8

func JsonExtract added in v0.8.0

func JsonExtract(parameters []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func JsonQuote added in v0.8.0

func JsonQuote(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func JsonUnquote added in v0.8.0

func JsonUnquote(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func LastInsertID added in v0.8.0

func LastInsertID(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func LastQueryID added in v0.8.0

func LastQueryID(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func LastQueryIDWithoutParam added in v0.8.0

func LastQueryIDWithoutParam(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

TODO: may support soon.

func Lastval added in v0.8.0

func Lastval(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Left added in v0.8.0

func Left(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func Length added in v0.8.0

func Length(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func LengthUTF8 added in v0.8.0

func LengthUTF8(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func LoadFile added in v0.8.0

func LoadFile(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

Too confused.

func Ltrim added in v0.8.0

func Ltrim(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func MoDisableMemUsageDetail added in v0.8.0

func MoDisableMemUsageDetail(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func MoEnableMemUsageDetail added in v0.8.0

func MoEnableMemUsageDetail(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func MoMemUsage added in v0.8.0

func MoMemUsage(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func MoTableColMax added in v0.8.0

func MoTableColMax(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

MoTableColMax return the max value of the column

func MoTableColMin added in v0.8.0

func MoTableColMin(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

MoTableColMax return the max value of the column

func MoTableRows added in v0.8.0

func MoTableRows(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

MoTableRows returns an estimated row number of a table.

func MoTableSize added in v0.8.0

func MoTableSize(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

MoTableSize returns an estimated size of a table.

func NewCast added in v0.8.0

func NewCast(parameters []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Nextval added in v0.8.0

func Nextval(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Oct added in v0.8.0

func OctFloat added in v0.8.0

func OctFloat[T constraints.Float](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func OverflowForNumericToNumeric added in v0.8.0

func OverflowForNumericToNumeric[T1, T2 constraints.Integer | constraints.Float](ctx context.Context,
	xs []T1, nsp *nulls.Nulls) error

func Pi added in v0.8.0

func Pi(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Power added in v0.8.0

func Power(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func ReadFromFile added in v0.8.0

func ReadFromFile(Filepath string, fs fileservice.FileService) (io.ReadCloser, error)

func RemoveFaultPoint added in v0.8.0

func RemoveFaultPoint(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Replace added in v0.8.0

func Replace(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func Reverse added in v0.8.0

func Reverse(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func RolesGraphml added in v0.8.0

func RolesGraphml(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func RoundDecimal128 added in v0.8.0

func RoundDecimal128(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func RoundDecimal64 added in v0.8.0

func RoundDecimal64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func RoundFloat64 added in v0.8.0

func RoundFloat64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func RoundInt64 added in v0.8.0

func RoundInt64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func RoundUint64 added in v0.8.0

func RoundUint64(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func RowCount added in v0.8.0

func RowCount(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Rtrim added in v0.8.0

func Rtrim(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func RunFunctionDirectly added in v0.8.0

func RunFunctionDirectly(proc *process.Process, overloadID int64, inputs []*vector.Vector, length int) (*vector.Vector, error)

RunFunctionDirectly runs a function directly without any protections. It is dangerous and should be used only when you are sure that the overloadID is correct and the inputs are valid.

func Setval added in v0.8.0

func Setval(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Sleep added in v0.8.0

func Sleep[T uint64 | float64](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func SpaceNumber added in v0.8.0

func SpaceNumber[T types.BuiltinNumber](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func SplitPart added in v0.8.0

func SplitPart(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func SplitSingle added in v0.8.0

func SplitSingle(str, sep string, cnt uint32) (string, bool)

func StartsWith added in v0.8.0

func StartsWith(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func StringSingle added in v0.8.0

func StringSingle(val []byte) uint8

func SubStrIndex added in v0.8.0

func SubStrIndex[T number](ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func SubStringWith2Args added in v0.8.0

func SubStringWith2Args(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func SubStringWith3Args added in v0.8.0

func SubStringWith3Args(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func TimeAdd added in v0.8.0

func TimeAdd(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func TimeDiff added in v0.8.0

func TimeDiff[T types.Time | types.Datetime](ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func TimeToDate added in v0.8.0

func TimeToDate(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func TimeToTime added in v0.8.0

func TimeToTime(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func TimestampAdd added in v0.8.0

func TimestampAdd(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func TimestampDiff added in v0.8.0

func TimestampDiff(ivecs []*vector.Vector, result vector.FunctionResultWrapper, _ *process.Process, length int) (err error)

func TimestampSub added in v0.8.0

func TimestampSub(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func TimestampToHour added in v0.8.0

func TimestampToHour(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func TimestampToMinute added in v0.8.0

func TimestampToMinute(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func TimestampToSecond added in v0.8.0

func TimestampToSecond(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func TimestampToTimestamp added in v0.8.0

func TimestampToTimestamp(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func TriggerFaultPoint added in v0.8.0

func TriggerFaultPoint(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func Trim added in v0.8.0

func Trim(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) (err error)

func UTCTimestamp added in v0.8.0

func UTCTimestamp(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func UintSingle added in v0.8.0

func UintSingle[T types.UInts](val T, start int) uint8

func User added in v0.8.0

func User(ivecs []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Values added in v0.8.0

func Values(parameters []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

func Version added in v0.8.0

func Version(_ []*vector.Vector, result vector.FunctionResultWrapper, proc *process.Process, length int) error

Types

type FuncExplainLayout

type FuncExplainLayout int32
const (
	STANDARD_FUNCTION          FuncExplainLayout = 0 //standard function
	UNARY_ARITHMETIC_OPERATOR  FuncExplainLayout = 1 //unary arithmetic operator
	BINARY_ARITHMETIC_OPERATOR FuncExplainLayout = 2 //binary arithmetic operator
	UNARY_LOGICAL_OPERATOR     FuncExplainLayout = 3 // unary logical operator
	BINARY_LOGICAL_OPERATOR    FuncExplainLayout = 4 // binary logical operator
	COMPARISON_OPERATOR        FuncExplainLayout = 5 // comparison operator
	CAST_EXPRESSION            FuncExplainLayout = 6 // cast expression
	CASE_WHEN_EXPRESSION       FuncExplainLayout = 7 // case when expression
	BETWEEN_AND_EXPRESSION     FuncExplainLayout = 8
	IN_PREDICATE               FuncExplainLayout = 9  //query 'in' predicate
	EXISTS_ANY_PREDICATE       FuncExplainLayout = 10 //query predicate,such as exist,all,any
	IS_EXPRESSION              FuncExplainLayout = 11 // IS expression
	NOPARAMETER_FUNCTION       FuncExplainLayout = 12 // noparameter function
	DATE_INTERVAL_EXPRESSION   FuncExplainLayout = 13 // date expression,interval expression
	EXTRACT_FUNCTION           FuncExplainLayout = 14 // extract function,such as extract(MONTH/DAY/HOUR/MINUTE/SECOND FROM p)
	POSITION_FUNCTION          FuncExplainLayout = 15 // position function, such as POSITION(substr IN str)
	UNKNOW_KIND_FUNCTION       FuncExplainLayout = 16
	IS_NOT_EXPRESSION          FuncExplainLayout = 17 // IS NOT operator
)

func GetLayoutById added in v0.8.0

func GetLayoutById(ctx context.Context, overloadID int64) (FuncExplainLayout, error)

type FuncGetResult added in v0.8.0

type FuncGetResult struct {
	// contains filtered or unexported fields
}

func GetFunctionByName

func GetFunctionByName(ctx context.Context, name string, args []types.Type) (r FuncGetResult, err error)

func (*FuncGetResult) CannotRunInParallel added in v0.8.0

func (fr *FuncGetResult) CannotRunInParallel() bool

func (*FuncGetResult) GetEncodedOverloadID added in v0.8.0

func (fr *FuncGetResult) GetEncodedOverloadID() (overloadID int64)

func (*FuncGetResult) GetReturnType added in v0.8.0

func (fr *FuncGetResult) GetReturnType() types.Type

func (*FuncGetResult) ShouldDoImplicitTypeCast added in v0.8.0

func (fr *FuncGetResult) ShouldDoImplicitTypeCast() (typs []types.Type, should bool)

type FuncNew added in v0.8.0

type FuncNew struct {

	// All overloads of the function.
	Overloads []overload
	// contains filtered or unexported fields
}

FuncNew stores all information about a function. including the unique id that marks the function, the class which the function belongs to, and all overloads of the function.

type FunctionSpecialRule added in v0.8.0

type FunctionSpecialRule interface {
	RetTypeAdjust(p *types.Type)
}

func NewSpecialRule added in v0.8.0

func NewSpecialRule(name string, expressions []*plan.Expr) (FunctionSpecialRule, error)

type GeneralTime added in v0.8.0

type GeneralTime struct {
	// contains filtered or unexported fields
}

GeneralTime is the internal struct type for Time.

func FromDate added in v0.8.0

func FromDate(year int, month int, day int, hour int, minute int, second int, microsecond int) GeneralTime

func NewGeneralTime added in v0.8.0

func NewGeneralTime() *GeneralTime

func (GeneralTime) Minute added in v0.8.0

func (t GeneralTime) Minute() int

Minute returns the minute value.

func (*GeneralTime) ResetTime added in v0.8.0

func (t *GeneralTime) ResetTime()

Reset GeneralTime to initialization state

func (GeneralTime) String added in v0.8.0

func (t GeneralTime) String() string

String implements fmt.Stringer.

type Month added in v0.8.0

type Month int

The month represents one month of the year (January=1,...).

const (
	January Month = 1 + iota
	February
	March
	April
	May
	June
	July
	August
	September
	October
	November
	December
)

type NormalType added in v0.8.0

type TGenericOfIn added in v0.8.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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