Skip to content

Commit

Permalink
Move to buf and address buf lints; add ci checks with buf (substrait-…
Browse files Browse the repository at this point in the history
…io#103)

* Move to buf and address buf lints; add ci checks with buf
* Fix buf-setup action version
* Add csharp gen
* Add protoc setup in CI
* Add buf.lock and ignore its value in PR diffs
* Move directory under proto and add buf workspace config
* Fix site protobuf path
* Fix clang-format protobuf path
* Move buf.yaml because now we have workspaces
* Move buf module lock to the right place
* Update gitattributes to reflect buf.lock move
  • Loading branch information
cpcloud authored Dec 5, 2021
1 parent a48b3dc commit bfd6de5
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
proto/buf.lock linguist-generated=true
17 changes: 5 additions & 12 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,17 @@ jobs:
- uses: jidicula/[email protected]
with:
clang-format-version: '13'
check-path: binary
check-path: proto/subsrait
proto:
name: Check Protobuf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Protoc
uses: arduino/setup-protoc@v1
- uses: arduino/setup-protoc@v1
- uses: bufbuild/[email protected]
- uses: bufbuild/buf-lint-action@v1
- name: Compile protobuf
run: |
set -e
for i in $(ls);
do
protoc --proto_path=. --java_out . $i
done
set +e
working-directory: ./binary
run: buf generate
yamllint:
name: Lint YAML extensions
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
**/.gradle
**/.idea
**/build

gen
10 changes: 10 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1
plugins:
- name: cpp
out: gen/proto/cpp
- name: csharp
out: gen/proto/csharp
- name: java
out: gen/proto/java
- name: python
out: gen/proto/python
3 changes: 3 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- proto
2 changes: 2 additions & 0 deletions proto/buf.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
name: buf.build/substrait-io/substrait
lint:
use:
- DEFAULT
ignore_only:
PACKAGE_VERSION_SUFFIX:
- substrait
breaking:
use:
- FILE
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
syntax = "proto3";

package io.substrait;
package substrait;

option java_multiple_files = true;
option java_package = "io.substrait.protobuf";
option java_package = "io.substrait.proto";
option csharp_namespace = "Substrait.Protobuf";

// Defines a set of Capabilities that a system (producer or consumer) supports.
Expand Down
26 changes: 13 additions & 13 deletions binary/expression.proto → proto/substrait/expression.proto
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
syntax = "proto3";

package io.substrait;
package substrait;

import "type.proto";
import "substrait/type.proto";

option java_multiple_files = true;
option java_package = "io.substrait.proto";
Expand Down Expand Up @@ -355,21 +355,21 @@ message SortField {
uint32 comparison_function_reference = 3;
}
enum SortDirection {
UNKNOWN = 0;
ASC_NULLS_FIRST = 1;
ASC_NULLS_LAST = 2;
DESC_NULLS_FIRST = 3;
DESC_NULLS_LAST = 4;
CLUSTERED = 5;
SORT_DIRECTION_UNSPECIFIED = 0;
SORT_DIRECTION_ASC_NULLS_FIRST = 1;
SORT_DIRECTION_ASC_NULLS_LAST = 2;
SORT_DIRECTION_DESC_NULLS_FIRST = 3;
SORT_DIRECTION_DESC_NULLS_LAST = 4;
SORT_DIRECTION_CLUSTERED = 5;
}
}

enum AggregationPhase {
UNKNOWN = 0;
INITIAL_TO_INTERMEDIATE = 1;
INTERMEDIATE_TO_INTERMEDIATE = 2;
INITIAL_TO_RESULT = 3;
INTERMEDIATE_TO_RESULT = 4;
AGGREGATION_PHASE_UNSPECIFIED = 0;
AGGREGATION_PHASE_INITIAL_TO_INTERMEDIATE = 1;
AGGREGATION_PHASE_INTERMEDIATE_TO_INTERMEDIATE = 2;
AGGREGATION_PHASE_INITIAL_TO_RESULT = 3;
AGGREGATION_PHASE_INTERMEDIATE_TO_RESULT = 4;
}

message AggregateFunction {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package io.substrait.extensions;
package substrait.extensions;

option java_multiple_files = true;
option java_package = "io.substrait.proto";
Expand Down
26 changes: 13 additions & 13 deletions binary/function.proto → proto/substrait/function.proto
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
syntax = "proto3";

package io.substrait;
package substrait;

import "type.proto";
import "parameterized_types.proto";
import "type_expressions.proto";
import "substrait/type.proto";
import "substrait/parameterized_types.proto";
import "substrait/type_expressions.proto";

option java_multiple_files = true;
option java_package = "io.substrait.proto";
Expand All @@ -26,14 +26,14 @@ message FunctionSignature {
ParameterConsistency consistency = 3;

enum ParameterConsistency {
UNKNOWN = 0;
PARAMETER_CONSISTENCY_UNSPECIFIED = 0;

// All argument must be the same concrete type.
CONSISTENT = 1;
PARAMETER_CONSISTENCY_CONSISTENT = 1;

// Each argument can be any possible concrete type afforded by the bounds
// of any parameter defined in the arguments specification.
INCONSISTENT = 2;
PARAMETER_CONSISTENCY_INCONSISTENT = 2;
}
}

Expand Down Expand Up @@ -99,9 +99,9 @@ message FunctionSignature {
repeated Implementation implementations = 15;

enum WindowType {
UNKNOWN = 0;
STREAMING = 1;
PARTITION = 2;
WINDOW_TYPE_UNSPECIFIED = 0;
WINDOW_TYPE_STREAMING = 1;
WINDOW_TYPE_PARTITION = 2;
}
}

Expand All @@ -116,9 +116,9 @@ message FunctionSignature {
string uri = 2;

enum Type {
UNKNOWN = 0;
WEB_ASSEMBLY = 1;
TRINO_JAR = 2;
TYPE_UNSPECIFIED = 0;
TYPE_WEB_ASSEMBLY = 1;
TYPE_TRINO_JAR = 2;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package io.substrait;
package substrait;

import "type.proto";
import "substrait/type.proto";

option java_multiple_files = true;
option java_package = "io.substrait.proto";
Expand Down
14 changes: 7 additions & 7 deletions binary/plan.proto → proto/substrait/plan.proto
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
syntax = "proto3";

package io.substrait;
package substrait;

import "relations.proto";
import "extensions.proto";
import "substrait/relations.proto";
import "substrait/extensions/extensions.proto";

option java_multiple_files = true;
option java_package = "io.substrait.proto";
option csharp_namespace = "Substrait.Protobuf";

// Either a relation or root relation
message PlanRel {
oneof RelType {
oneof rel_type {
// Any relation
Rel rel = 1;
// The root of a relation tree
Expand All @@ -24,16 +24,16 @@ message PlanRel {
message Plan {

// a list of yaml specifications this plan may depend on
repeated io.substrait.extensions.SimpleExtensionURI extension_uris = 1;
repeated substrait.extensions.SimpleExtensionURI extension_uris = 1;

// a list of extensions this plan may depend on
repeated io.substrait.extensions.SimpleExtensionDeclaration extensions = 2;
repeated substrait.extensions.SimpleExtensionDeclaration extensions = 2;

// one or more relation trees that are associated with this plan.
repeated PlanRel relations = 3;

// additional extensions associated with this plan.
io.substrait.extensions.AdvancedExtension advanced_extensions = 4;
substrait.extensions.AdvancedExtension advanced_extensions = 4;

// A list of com.google.Any entities that this plan may use. Can be used to
// warn if some embedded message types are unknown. Note that this list may
Expand Down
Loading

0 comments on commit bfd6de5

Please sign in to comment.