udf

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguagePython = "python"
)

Variables

View Source
var (
	RequestType_name = map[int32]string{
		0: "UnknownRequest",
		1: "DataRequest",
		2: "PkgResponse",
	}
	RequestType_value = map[string]int32{
		"UnknownRequest": 0,
		"DataRequest":    1,
		"PkgResponse":    2,
	}
)

Enum value maps for RequestType.

View Source
var (
	ResponseType_name = map[int32]string{
		0: "UnknownResponse",
		1: "DataResponse",
		2: "PkgRequest",
	}
	ResponseType_value = map[string]int32{
		"UnknownResponse": 0,
		"DataResponse":    1,
		"PkgRequest":      2,
	}
)

Enum value maps for ResponseType.

View Source
var (
	DataType_name = map[int32]string{
		0:  "UNKNOWN",
		10: "BOOL",
		20: "INT8",
		21: "INT16",
		22: "INT32",
		23: "INT64",
		30: "UINT8",
		31: "UINT16",
		32: "UINT32",
		33: "UINT64",
		40: "FLOAT32",
		41: "FLOAT64",
		50: "CHAR",
		51: "VARCHAR",
		52: "TEXT",
		53: "JSON",
		54: "UUID",
		60: "TIME",
		61: "DATE",
		62: "DATETIME",
		63: "TIMESTAMP",
		70: "DECIMAL64",
		71: "DECIMAL128",
		80: "BINARY",
		81: "VARBINARY",
		82: "BLOB",
	}
	DataType_value = map[string]int32{
		"UNKNOWN":    0,
		"BOOL":       10,
		"INT8":       20,
		"INT16":      21,
		"INT32":      22,
		"INT64":      23,
		"UINT8":      30,
		"UINT16":     31,
		"UINT32":     32,
		"UINT64":     33,
		"FLOAT32":    40,
		"FLOAT64":    41,
		"CHAR":       50,
		"VARCHAR":    51,
		"TEXT":       52,
		"JSON":       53,
		"UUID":       54,
		"TIME":       60,
		"DATE":       61,
		"DATETIME":   62,
		"TIMESTAMP":  63,
		"DECIMAL64":  70,
		"DECIMAL128": 71,
		"BINARY":     80,
		"VARBINARY":  81,
		"BLOB":       82,
	}
)

Enum value maps for DataType.

View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "udf.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "run",
			Handler:       _Service_Run_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "udf.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Data

type Data struct {

	// Types that are assignable to Val:
	//
	//	*Data_BoolVal
	//	*Data_IntVal
	//	*Data_Int64Val
	//	*Data_UintVal
	//	*Data_Uint64Val
	//	*Data_FloatVal
	//	*Data_DoubleVal
	//	*Data_StringVal
	//	*Data_BytesVal
	Val isData_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*Data) Descriptor deprecated

func (*Data) Descriptor() ([]byte, []int)

Deprecated: Use Data.ProtoReflect.Descriptor instead.

func (*Data) GetBoolVal

func (x *Data) GetBoolVal() bool

func (*Data) GetBytesVal

func (x *Data) GetBytesVal() []byte

func (*Data) GetDoubleVal

func (x *Data) GetDoubleVal() float64

func (*Data) GetFloatVal

func (x *Data) GetFloatVal() float32

func (*Data) GetInt64Val

func (x *Data) GetInt64Val() int64

func (*Data) GetIntVal

func (x *Data) GetIntVal() int32

func (*Data) GetStringVal

func (x *Data) GetStringVal() string

func (*Data) GetUint64Val

func (x *Data) GetUint64Val() uint64

func (*Data) GetUintVal

func (x *Data) GetUintVal() uint32

func (*Data) GetVal

func (m *Data) GetVal() isData_Val

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) ProtoReflect

func (x *Data) ProtoReflect() protoreflect.Message

func (*Data) Reset

func (x *Data) Reset()

func (*Data) String

func (x *Data) String() string

type DataType

type DataType int32
const (
	DataType_UNKNOWN    DataType = 0
	DataType_BOOL       DataType = 10
	DataType_INT8       DataType = 20
	DataType_INT16      DataType = 21
	DataType_INT32      DataType = 22
	DataType_INT64      DataType = 23
	DataType_UINT8      DataType = 30
	DataType_UINT16     DataType = 31
	DataType_UINT32     DataType = 32
	DataType_UINT64     DataType = 33
	DataType_FLOAT32    DataType = 40
	DataType_FLOAT64    DataType = 41
	DataType_CHAR       DataType = 50
	DataType_VARCHAR    DataType = 51
	DataType_TEXT       DataType = 52
	DataType_JSON       DataType = 53
	DataType_UUID       DataType = 54
	DataType_TIME       DataType = 60
	DataType_DATE       DataType = 61
	DataType_DATETIME   DataType = 62
	DataType_TIMESTAMP  DataType = 63
	DataType_DECIMAL64  DataType = 70
	DataType_DECIMAL128 DataType = 71
	DataType_BINARY     DataType = 80
	DataType_VARBINARY  DataType = 81
	DataType_BLOB       DataType = 82
)

func (DataType) Descriptor

func (DataType) Descriptor() protoreflect.EnumDescriptor

func (DataType) Enum

func (x DataType) Enum() *DataType

func (DataType) EnumDescriptor deprecated

func (DataType) EnumDescriptor() ([]byte, []int)

Deprecated: Use DataType.Descriptor instead.

func (DataType) Number

func (x DataType) Number() protoreflect.EnumNumber

func (DataType) String

func (x DataType) String() string

func (DataType) Type

type DataVector

type DataVector struct {
	Data   []*Data  `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	Const  bool     `protobuf:"varint,2,opt,name=const,proto3" json:"const,omitempty"`
	Length int64    `protobuf:"varint,3,opt,name=length,proto3" json:"length,omitempty"`
	Type   DataType `protobuf:"varint,4,opt,name=type,proto3,enum=udf.DataType" json:"type,omitempty"`
	Scale  int32    `protobuf:"varint,5,opt,name=scale,proto3" json:"scale,omitempty"`
	// contains filtered or unexported fields
}

func (*DataVector) Descriptor deprecated

func (*DataVector) Descriptor() ([]byte, []int)

Deprecated: Use DataVector.ProtoReflect.Descriptor instead.

func (*DataVector) GetConst

func (x *DataVector) GetConst() bool

func (*DataVector) GetData

func (x *DataVector) GetData() []*Data

func (*DataVector) GetLength

func (x *DataVector) GetLength() int64

func (*DataVector) GetScale

func (x *DataVector) GetScale() int32

func (*DataVector) GetType

func (x *DataVector) GetType() DataType

func (*DataVector) ProtoMessage

func (*DataVector) ProtoMessage()

func (*DataVector) ProtoReflect

func (x *DataVector) ProtoReflect() protoreflect.Message

func (*DataVector) Reset

func (x *DataVector) Reset()

func (*DataVector) String

func (x *DataVector) String() string

type Data_BoolVal

type Data_BoolVal struct {
	BoolVal bool `protobuf:"varint,1,opt,name=boolVal,proto3,oneof"` // bool
}

type Data_BytesVal

type Data_BytesVal struct {
	BytesVal []byte `protobuf:"bytes,9,opt,name=bytesVal,proto3,oneof"` // binary, varbinary, blob
}

type Data_DoubleVal

type Data_DoubleVal struct {
	DoubleVal float64 `protobuf:"fixed64,7,opt,name=doubleVal,proto3,oneof"` // float64
}

type Data_FloatVal

type Data_FloatVal struct {
	FloatVal float32 `protobuf:"fixed32,6,opt,name=floatVal,proto3,oneof"` // float32
}

type Data_Int64Val

type Data_Int64Val struct {
	Int64Val int64 `protobuf:"zigzag64,3,opt,name=int64Val,proto3,oneof"` // int64
}

type Data_IntVal

type Data_IntVal struct {
	IntVal int32 `protobuf:"zigzag32,2,opt,name=intVal,proto3,oneof"` // int8, int16, int32
}

type Data_StringVal

type Data_StringVal struct {
	StringVal string `protobuf:"bytes,8,opt,name=stringVal,proto3,oneof"` // char, varchar, text, json, uuid | time, date, datetime, timestamp | Decimal64, Decimal128
}

type Data_Uint64Val

type Data_Uint64Val struct {
	Uint64Val uint64 `protobuf:"varint,5,opt,name=uint64Val,proto3,oneof"` // uint64
}

type Data_UintVal

type Data_UintVal struct {
	UintVal uint32 `protobuf:"varint,4,opt,name=uintVal,proto3,oneof"` // uint8, uint16, uint32
}

type Package

type Package struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Last bool   `protobuf:"varint,2,opt,name=last,proto3" json:"last,omitempty"`
	// contains filtered or unexported fields
}

func (*Package) Descriptor deprecated

func (*Package) Descriptor() ([]byte, []int)

Deprecated: Use Package.ProtoReflect.Descriptor instead.

func (*Package) GetData

func (x *Package) GetData() []byte

func (*Package) GetLast

func (x *Package) GetLast() bool

func (*Package) ProtoMessage

func (*Package) ProtoMessage()

func (*Package) ProtoReflect

func (x *Package) ProtoReflect() protoreflect.Message

func (*Package) Reset

func (x *Package) Reset()

func (*Package) String

func (x *Package) String() string

type PkgReader

type PkgReader interface {
	Get(ctx context.Context, path string) (reader io.ReadCloser, err error)
}

PkgReader read udf package from storage

type PkgUploader

type PkgUploader interface {
	Upload(ctx context.Context, localPath string, storageDir string) (storagePath string, err error)
}

PkgUploader upload udf package to storage

type Request

type Request struct {
	Udf     *Udf              `protobuf:"bytes,1,opt,name=udf,proto3" json:"udf,omitempty"`
	Vectors []*DataVector     `protobuf:"bytes,2,rep,name=vectors,proto3" json:"vectors,omitempty"`
	Length  int64             `protobuf:"varint,3,opt,name=length,proto3" json:"length,omitempty"`
	Type    RequestType       `protobuf:"varint,4,opt,name=type,proto3,enum=udf.RequestType" json:"type,omitempty"`
	Context map[string]string `` // currently just transfer, not used
	/* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetContext

func (x *Request) GetContext() map[string]string

func (*Request) GetLength

func (x *Request) GetLength() int64

func (*Request) GetType

func (x *Request) GetType() RequestType

func (*Request) GetUdf

func (x *Request) GetUdf() *Udf

func (*Request) GetVectors

func (x *Request) GetVectors() []*DataVector

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type RequestType

type RequestType int32
const (
	RequestType_UnknownRequest RequestType = 0
	RequestType_DataRequest    RequestType = 1 // request with data for function result
	RequestType_PkgResponse    RequestType = 2 // response with package
)

func (RequestType) Descriptor

func (RequestType) Enum

func (x RequestType) Enum() *RequestType

func (RequestType) EnumDescriptor deprecated

func (RequestType) EnumDescriptor() ([]byte, []int)

Deprecated: Use RequestType.Descriptor instead.

func (RequestType) Number

func (x RequestType) Number() protoreflect.EnumNumber

func (RequestType) String

func (x RequestType) String() string

func (RequestType) Type

type Response

type Response struct {
	Vector *DataVector  `protobuf:"bytes,1,opt,name=vector,proto3" json:"vector,omitempty"`
	Type   ResponseType `protobuf:"varint,2,opt,name=type,proto3,enum=udf.ResponseType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetType

func (x *Response) GetType() ResponseType

func (*Response) GetVector

func (x *Response) GetVector() *DataVector

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type ResponseType

type ResponseType int32
const (
	ResponseType_UnknownResponse ResponseType = 0
	ResponseType_DataResponse    ResponseType = 1 // response with function result
	ResponseType_PkgRequest      ResponseType = 2 // request for package
)

func (ResponseType) Descriptor

func (ResponseType) Enum

func (x ResponseType) Enum() *ResponseType

func (ResponseType) EnumDescriptor deprecated

func (ResponseType) EnumDescriptor() ([]byte, []int)

Deprecated: Use ResponseType.Descriptor instead.

func (ResponseType) Number

func (ResponseType) String

func (x ResponseType) String() string

func (ResponseType) Type

type Service

type Service interface {
	Language() string
	Run(ctx context.Context, request *Request, pkgReader PkgReader) (*Response, error)
}

Service handle non-sql udf in cn

func NewService

func NewService(services ...Service) (Service, error)

type ServiceClient

type ServiceClient interface {
	Run(ctx context.Context, opts ...grpc.CallOption) (Service_RunClient, error)
}

ServiceClient is the client API for Service service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.golang.ir/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	Run(Service_RunServer) error
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Service_RunClient

type Service_RunClient interface {
	Send(*Request) error
	Recv() (*Response, error)
	grpc.ClientStream
}

type Service_RunServer

type Service_RunServer interface {
	Send(*Response) error
	Recv() (*Request, error)
	grpc.ServerStream
}

type Udf

type Udf struct {
	Handler      string   `protobuf:"bytes,1,opt,name=handler,proto3" json:"handler,omitempty"`
	IsImport     bool     `protobuf:"varint,2,opt,name=isImport,proto3" json:"isImport,omitempty"`
	Body         string   `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	ImportPkg    *Package `protobuf:"bytes,4,opt,name=importPkg,proto3" json:"importPkg,omitempty"`
	RetType      DataType `protobuf:"varint,5,opt,name=retType,proto3,enum=udf.DataType" json:"retType,omitempty"`
	Language     string   `protobuf:"bytes,6,opt,name=language,proto3" json:"language,omitempty"`
	ModifiedTime string   `protobuf:"bytes,7,opt,name=modifiedTime,proto3" json:"modifiedTime,omitempty"`
	Db           string   `protobuf:"bytes,8,opt,name=db,proto3" json:"db,omitempty"`
	// contains filtered or unexported fields
}

func (*Udf) Descriptor deprecated

func (*Udf) Descriptor() ([]byte, []int)

Deprecated: Use Udf.ProtoReflect.Descriptor instead.

func (*Udf) GetBody

func (x *Udf) GetBody() string

func (*Udf) GetDb

func (x *Udf) GetDb() string

func (*Udf) GetHandler

func (x *Udf) GetHandler() string

func (*Udf) GetImportPkg

func (x *Udf) GetImportPkg() *Package

func (*Udf) GetIsImport

func (x *Udf) GetIsImport() bool

func (*Udf) GetLanguage

func (x *Udf) GetLanguage() string

func (*Udf) GetModifiedTime

func (x *Udf) GetModifiedTime() string

func (*Udf) GetRetType

func (x *Udf) GetRetType() DataType

func (*Udf) ProtoMessage

func (*Udf) ProtoMessage()

func (*Udf) ProtoReflect

func (x *Udf) ProtoReflect() protoreflect.Message

func (*Udf) Reset

func (x *Udf) Reset()

func (*Udf) String

func (x *Udf) String() string

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) Run

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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