Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelbranco80 committed Jan 6, 2025
1 parent 26fdef8 commit 30d2e9d
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 94 deletions.
45 changes: 3 additions & 42 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,7 @@ lazy val commonSettings = Seq(
)

lazy val buildSettings = Seq(
scalaVersion := "2.12.18",
javacOptions ++= Seq(
"-source",
"21",
"-target",
"21"
),
scalacOptions ++= Seq(
"-feature",
"-unchecked",
// When compiling in encrypted drives in Linux, the max size of a name is reduced to around 140
// https://unix.stackexchange.com/a/32834
"-Xmax-classfile-name",
"140",
"-deprecation",
"-Xlint:-stars-align,_",
"-Ywarn-dead-code",
"-Ywarn-macros:after", // Fix for false warning of unused implicit arguments in traits/interfaces.
"-Ypatmat-exhaust-depth",
"160"
)
scalaVersion := "2.13.15"
)

lazy val compileSettings = Seq(
Expand All @@ -52,32 +32,13 @@ lazy val compileSettings = Seq(
Compile / packageDoc / publishArtifact := false,
Compile / packageBin / packageOptions += Package.ManifestAttributes(
"Automatic-Module-Name" -> name.value.replace('-', '.')
),
// Ensure Java annotations get compiled first, so that they are accessible from Scala.
compileOrder := CompileOrder.JavaThenScala
)
)

lazy val testSettings = Seq(
// Ensuring tests are run in a forked JVM for isolation.
Test / fork := true,
// Disabling parallel execution of tests.
//Test / parallelExecution := false,
// Pass system properties starting with "raw." to the forked JVMs.
Test / javaOptions ++= {
import scala.collection.JavaConverters._
val props = System.getProperties
props
.stringPropertyNames()
.asScala
.filter(_.startsWith("raw."))
.map(key => s"-D$key=${props.getProperty(key)}")
.toSeq
},
// Set up heap dump options for out-of-memory errors.
Test / javaOptions ++= Seq(
"-XX:+HeapDumpOnOutOfMemoryError",
s"-XX:HeapDumpPath=${Paths.get(sys.env.getOrElse("SBT_FORK_OUTPUT_DIR", "target/test-results")).resolve("heap-dumps")}"
),
// Required for publishing test artifacts.
Test / publishArtifact := true
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.common";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.common";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.functions";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.functions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.query";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.query;
Expand Down
26 changes: 22 additions & 4 deletions src/main/protobuf/com/rawlabs/protocol/das/v1/query/quals.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.query";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.query;
Expand All @@ -22,6 +22,24 @@ import "com/rawlabs/protocol/das/v1/query/operators.proto";

message Qual {
string name = 1;
Operator operator = 2;
com.rawlabs.protocol.das.v1.types.Value value = 3;
}
oneof qual {
SimpleQual simple_qual = 2;
IsAnyQual is_any_qual = 3;
IsAllQual is_all_qual = 4;
}
}

message SimpleQual {
Operator operator = 1;
com.rawlabs.protocol.das.v1.types.Value value = 2;
}

message IsAnyQual {
repeated com.rawlabs.protocol.das.v1.types.Value values = 2;
Operator operator = 3;
}

message IsAllQual {
repeated com.rawlabs.protocol.das.v1.types.Value values = 2;
Operator operator = 3;
}
24 changes: 12 additions & 12 deletions src/main/protobuf/com/rawlabs/protocol/das/v1/query/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.query";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.query;
Expand All @@ -22,18 +22,18 @@ import "com/rawlabs/protocol/das/v1/query/quals.proto";
message Query {
repeated Qual quals = 1;
repeated string columns = 2;
optional SortKeys sort_keys = 3;
optional uint64 offset = 4;
optional uint64 limit = 5;
optional bool distinct = 6;
}

message SortKeys {
repeated SortKey sort_keys = 1;
repeated SortKey sort_keys = 3;
}

message SortKey {
string name = 1;
bool is_reversed = 2;
bool nulls_first = 3;
}
uint32 pos = 2;
bool is_reversed = 3;
bool nulls_first = 4;
string collate = 5;
}

message PathKey {
repeated string key_columns = 1;
uint64 expected_rows = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import "com/rawlabs/protocol/das/v1/functions/functions.proto";
import "com/rawlabs/protocol/das/v1/types/values.proto";

service FunctionsService {

rpc GetFunctionDefinitions (GetFunctionDefinitionsRequest) returns (GetFunctionDefinitionsResponse);

rpc ExecuteFunction (ExecuteFunctionRequest) returns (ExecuteFunctionResponse);

}

message GetFunctionDefinitionsRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ option java_multiple_files = true;
package com.rawlabs.protocol.das.v1.services;

service HealthCheckService {
// Check the health of the service.
rpc Check (HealthCheckRequest) returns (HealthCheckResponse);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ option java_multiple_files = true;
package com.rawlabs.protocol.das.v1.services;

import "com/rawlabs/protocol/das/v1/common/das.proto";
import "com/rawlabs/protocol/das/v1/types/types.proto";
import "com/rawlabs/protocol/das/v1/query/operators.proto";

service RegistrationService {
rpc Register (RegisterRequest) returns (com.rawlabs.protocol.das.v1.common.DASId);

rpc OperationsSupported (com.rawlabs.protocol.das.v1.common.DASId) returns (OperationsSupportedResponse);
rpc Register (RegisterRequest) returns (RegisterResponse);

rpc Unregister (com.rawlabs.protocol.das.v1.common.DASId) returns (UnregisterResponse);
}
Expand All @@ -34,20 +30,11 @@ message RegisterRequest {
optional com.rawlabs.protocol.das.v1.common.DASId id = 2;
}

message OperationsSupportedResponse {
repeated FunctionSupported functionsSupported = 4;
repeated OperatorSupported operatorsSupported = 5;
}

message FunctionSupported {
string name = 1;
repeated com.rawlabs.protocol.das.v1.types.Type parameters = 2;
}

message OperatorSupported {
com.rawlabs.protocol.das.v1.query.Operator operator = 1;
com.rawlabs.protocol.das.v1.types.Type lhs = 2;
com.rawlabs.protocol.das.v1.types.Type rhs = 3;
message RegisterResponse {
oneof response {
com.rawlabs.protocol.das.v1.common.DASId id = 1;
string error = 2;
}
}

message UnregisterResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ import "com/rawlabs/protocol/das/v1/common/das.proto";
import "com/rawlabs/protocol/das/v1/common/environment.proto";
import "com/rawlabs/protocol/das/v1/tables/tables.proto";
import "com/rawlabs/protocol/das/v1/types/values.proto";
import "com/rawlabs/protocol/das/v1/query/quals.proto";
import "com/rawlabs/protocol/das/v1/query/query.proto";

service TablesService {

rpc GetTableDefinitions (GetTableDefinitionsRequest) returns (GetTableDefinitionsResponse);

rpc GetTableSortOrders (GetTableSortOrdersRequest) returns (GetTableSortOrdersResponse);

rpc GetTablePathKeys (GetTablePathKeysRequest) returns (GetTablePathKeysResponse);

rpc GetTableEstimate (GetTableEstimateRequest) returns (GetTableEstimateResponse);

rpc ExplainTable (ExplainTableRequest) returns (ExplainTableResponse);
Expand All @@ -44,7 +48,6 @@ service TablesService {
rpc UpdateTable (UpdateTableRequest) returns (UpdateTableResponse);

rpc DeleteTable (DeleteTableRequest) returns (DeleteTableResponse);

}

message GetTableDefinitionsRequest {
Expand All @@ -56,11 +59,32 @@ message GetTableDefinitionsResponse {
repeated com.rawlabs.protocol.das.v1.tables.TableDefinition definitions = 1;
}

message GetTableSortOrdersRequest {
com.rawlabs.protocol.das.v1.common.DASId das_id = 1;
com.rawlabs.protocol.das.v1.tables.TableId table_id = 2;
repeated com.rawlabs.protocol.das.v1.query.SortKey sort_keys = 3;
optional com.rawlabs.protocol.das.v1.common.Environment env = 99;
}

message GetTableSortOrdersResponse {
repeated com.rawlabs.protocol.das.v1.query.SortKey sort_keys = 1;
}

message GetTablePathKeysRequest {
com.rawlabs.protocol.das.v1.common.DASId das_id = 1;
com.rawlabs.protocol.das.v1.tables.TableId table_id = 2;
optional com.rawlabs.protocol.das.v1.common.Environment env = 99;
}

message GetTablePathKeysResponse {
repeated com.rawlabs.protocol.das.v1.query.PathKey path_keys = 1;
}

message GetTableEstimateRequest {
com.rawlabs.protocol.das.v1.common.DASId das_id = 1;
com.rawlabs.protocol.das.v1.tables.TableId table_id = 2;
com.rawlabs.protocol.das.v1.query.Query query = 3;
optional string plan_id = 4;
repeated com.rawlabs.protocol.das.v1.query.Qual quals = 3;
repeated string columns = 4;
optional com.rawlabs.protocol.das.v1.common.Environment env = 99;
}

Expand Down Expand Up @@ -102,7 +126,7 @@ message GetTableUniqueColumnResponse {
message InsertTableRequest {
com.rawlabs.protocol.das.v1.common.DASId das_id = 1;
com.rawlabs.protocol.das.v1.tables.TableId table_id = 2;
com.rawlabs.protocol.das.v1.tables.Row values = 3;
com.rawlabs.protocol.das.v1.tables.Row row = 3;
optional com.rawlabs.protocol.das.v1.common.Environment env = 99;
}

Expand All @@ -123,7 +147,7 @@ message GetBulkInsertTableSizeResponse {
message BulkInsertTableRequest {
com.rawlabs.protocol.das.v1.common.DASId das_id = 1;
com.rawlabs.protocol.das.v1.tables.TableId table_id = 2;
repeated com.rawlabs.protocol.das.v1.tables.Row values = 3;
repeated com.rawlabs.protocol.das.v1.tables.Row rows = 3;
optional com.rawlabs.protocol.das.v1.common.Environment env = 99;
}

Expand All @@ -135,7 +159,7 @@ message UpdateTableRequest {
com.rawlabs.protocol.das.v1.common.DASId das_id = 1;
com.rawlabs.protocol.das.v1.tables.TableId table_id = 2;
com.rawlabs.protocol.das.v1.types.Value row_id = 3;
com.rawlabs.protocol.das.v1.tables.Row new_values = 4;
com.rawlabs.protocol.das.v1.tables.Row new_row = 4;
optional com.rawlabs.protocol.das.v1.common.Environment env = 99;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.tables";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.tables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.types";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.types;
Expand Down Expand Up @@ -103,7 +103,7 @@ message RecordType {
}

message AttrType {
string idn = 1;
string name = 1;
Type tipe = 2;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

syntax = "proto3";

option java_package = "com.rawlabs.protocol.das.v1";
option java_package = "com.rawlabs.protocol.das.v1.types";
option java_multiple_files = true;

package com.rawlabs.protocol.das.v1.types;
Expand Down

0 comments on commit 30d2e9d

Please sign in to comment.