github.com/matrixorigin/matrixone@v1.2.0/pkg/udf/udf.proto (about) 1 // Copyright 2023 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package udf; 18 19 option go_package = "github.com/matrixorigin/matrixone/pkg/udf"; 20 21 // protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ./udf.proto 22 23 service Service { 24 rpc run(stream Request) returns (stream Response) {} 25 } 26 27 enum RequestType { 28 UnknownRequest = 0; 29 DataRequest = 1; // request with data for function result 30 PkgResponse = 2; // response with package 31 } 32 33 message Request { 34 Udf udf = 1; 35 repeated DataVector vectors = 2; 36 int64 length = 3; 37 RequestType type = 4; 38 map<string, string> context = 5; // currently just transfer, not used 39 } 40 41 enum ResponseType { 42 UnknownResponse = 0; 43 DataResponse = 1; // response with function result 44 PkgRequest = 2; // request for package 45 } 46 47 message Response { 48 DataVector vector = 1; 49 ResponseType type = 2; 50 } 51 52 message Udf { 53 string handler = 1; 54 bool isImport = 2; 55 string body = 3; 56 Package importPkg = 4; 57 DataType retType = 5; 58 string language = 6; 59 string modifiedTime = 7; 60 string db = 8; 61 } 62 63 message Package { 64 bytes data = 1; 65 bool last = 2; 66 } 67 68 message DataVector { 69 repeated Data data = 1; 70 bool const = 2; 71 int64 length = 3; 72 DataType type = 4; 73 int32 scale = 5; 74 } 75 76 enum DataType { 77 UNKNOWN = 0; 78 79 BOOL = 10; 80 81 INT8 = 20; 82 INT16 = 21; 83 INT32 = 22; 84 INT64 = 23; 85 86 UINT8 = 30; 87 UINT16 = 31; 88 UINT32 = 32; 89 UINT64 = 33; 90 91 FLOAT32 = 40; 92 FLOAT64 = 41; 93 94 CHAR = 50; 95 VARCHAR = 51; 96 TEXT = 52; 97 JSON = 53; 98 UUID = 54; 99 100 TIME = 60; 101 DATE = 61; 102 DATETIME = 62; 103 TIMESTAMP = 63; 104 105 DECIMAL64 = 70; 106 DECIMAL128 = 71; 107 108 109 BINARY = 80; 110 VARBINARY = 81; 111 BLOB = 82; 112 } 113 114 message Data { 115 oneof val { 116 bool boolVal = 1; // bool 117 sint32 intVal = 2; // int8, int16, int32 118 sint64 int64Val = 3; // int64 119 uint32 uintVal = 4; // uint8, uint16, uint32 120 uint64 uint64Val = 5; // uint64 121 float floatVal = 6; // float32 122 double doubleVal = 7; // float64 123 string stringVal = 8; // char, varchar, text, json, uuid | time, date, datetime, timestamp | Decimal64, Decimal128 124 bytes bytesVal = 9; // binary, varbinary, blob 125 } 126 }