// Copyright 2023 CeresDB Project Authors. Licensed under Apache-2.0. syntax = "proto3"; package remote_engine; import "engine/schema.proto"; import "engine/time_range.proto"; import "cluster.proto"; import "common.proto"; import "storage.proto"; service RemoteEngineService { rpc Read(ReadRequest) returns (stream ReadResponse) {} rpc Write(WriteRequest) returns (WriteResponse) {} rpc GetTableInfo(GetTableInfoRequest) returns (GetTableInfoResponse) {} rpc WriteBatch(WriteBatchRequest) returns (WriteResponse) {} rpc ExecutePhysicalPlan(ExecutePlanRequest) returns (stream ReadResponse) {} rpc AlterTableSchema(AlterTableSchemaRequest) returns (AlterTableSchemaResponse) {} rpc AlterTableOptions(AlterTableOptionsRequest) returns (AlterTableOptionsResponse) {} } message TableIdentifier { string catalog = 1; string schema = 2; string table = 3; } message ReadOptions { uint64 batch_size = 1; uint64 read_parallelism = 2; // -1 means no timeout int64 timeout_ms = 3; } message Predicate { repeated bytes exprs = 1; time_range.TimeRange time_range = 2; } enum ReadOrder { None = 0; Asc = 1; Desc = 2; } message TableReadRequest { uint64 request_id = 1; ReadOptions opts = 2; schema.ProjectedSchema projected_schema = 3; Predicate predicate = 4; ReadOrder order = 5; } message ReadRequest { TableIdentifier table = 1; TableReadRequest read_request = 2; } message ReadResponse { common.ResponseHeader header = 1; oneof output { storage.ArrowPayload arrow = 2; } } message ColumnDesc { uint32 id = 1; schema.DataType typ = 2; } message ContiguousRows { uint32 schema_version = 1; repeated bytes encoded_rows = 2; repeated ColumnDesc column_descs = 3; } message RowGroup { int64 min_timestamp = 1; int64 max_timestamp = 2; oneof rows { storage.ArrowPayload arrow = 3; ContiguousRows contiguous = 4; } } message WriteRequest { TableIdentifier table = 1; RowGroup row_group = 2; } message WriteResponse { common.ResponseHeader header = 1; uint64 affected_rows = 2; } message GetTableInfoRequest { TableIdentifier table = 1; } message TableInfo { string catalog_name = 1; string schema_name = 2; uint32 schema_id = 3; string table_name = 4; uint64 table_id = 5; schema.TableSchema table_schema = 6; string engine = 7; map options = 8; cluster.PartitionInfo partition_info = 9; } message GetTableInfoResponse { common.ResponseHeader header = 1; TableInfo table_info = 2; } message WriteBatchRequest { repeated WriteRequest batch = 1; } message ExtensionNode { oneof typed_extension { DistSqlQueryExtensionNode dist_sql_query = 1; } } message DistSqlQueryExtensionNode { UnresolvedSubScan unresolved_sub_scan = 1; } message UnresolvedSubScan { TableIdentifier table = 1; TableScanContext table_scan_ctx = 2; } enum QueryPriority { High = 0; Low = 1; } message ExecContext { uint64 request_id = 1; string default_catalog = 2; string default_schema = 3; // -1 means no timeout int64 timeout_ms = 4; QueryPriority priority = 5; string displayable_query = 6; } message ExecutePlanRequest { ExecContext context = 1; oneof physical_plan { bytes datafusion = 2; } TableIdentifier table = 3; } message AlterTableSchemaRequest { TableIdentifier table = 1; schema.TableSchema table_schema = 2; uint32 pre_schema_version = 3; } message AlterTableSchemaResponse { common.ResponseHeader header = 1; } message AlterTableOptionsRequest { TableIdentifier table = 1; map options = 2; } message AlterTableOptionsResponse { common.ResponseHeader header = 1; } message TableScanContext { uint64 batch_size = 1; uint64 read_parallelism = 2; schema.ProjectedSchema projected_schema = 3; Predicate predicate = 4; }