Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
grundprinzip committed Jul 2, 2024
1 parent 84cd95f commit 8bf6cb9
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 21 deletions.
17 changes: 8 additions & 9 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
# Define the dependencies:
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@gazelle//:def.bzl", "gazelle")
load("@rules_proto_grpc_go//:defs.bzl", "go_proto_compile", "go_grpc_compile", "go_proto_library", "go_grpc_library")
load("@rules_proto_grpc_go//:defs.bzl", "go_grpc_compile", "go_grpc_library", "go_proto_compile", "go_proto_library")


# gazelle:prefix github.com/apache/spark-connect-go/v34
# gazelle:prefix github.com/apache/spark-connect-go/v1
# gazelle:exclude spark
gazelle(name = "gazelle")



# This is the proto library definition that comes directly out of Spark.
proto_library(
name = "spark_connect_protos",
srcs = glob(["spark/connector/connect/common/src/main/protobuf/**/*.proto"]),
strip_import_prefix="spark/connector/connect/common/src/main/protobuf/",
strip_import_prefix = "spark/connector/connect/common/src/main/protobuf/spark/connect",
import_prefix = "spark/connect",
visibility = ["//visibility:public"],
deps = ["@protobuf//:any_proto"],
)
Expand All @@ -24,16 +22,17 @@ go_proto_library(
name = "spark_connect_proto",
importpath = "github.com/apache/spark-connect-go/v1/internal/generated/spark/connect",
protos = [
":spark_connect_protos",
":spark_connect_protos",
],
visibility = ["//visibility:public"],
)

go_grpc_library(
name = "spark_connect_proto_grpc",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "github.com/apache/spark-connect-go/v1/internal/generated/spark/connect",
protos = [
":spark_connect_protos",
":spark_connect_protos",
],
visibility = ["//visibility:public"],
)
)
8 changes: 8 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ bazel_dep(name = "rules_proto_grpc_go", version = "5.0.0-alpha2")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")

# Weirdness...
go_deps.gazelle_override(
path="google.golang.org/protobuf",
directives=[
"gazelle:proto disable"
]
)

# All *direct* Go dependencies of the module have to be listed explicitly.
use_repo(
go_deps,
Expand Down
21 changes: 19 additions & 2 deletions MODULE.bazel.lock

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

9 changes: 7 additions & 2 deletions client/channel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "channel",
srcs = ["channel.go"],
importpath = "github.com/apache/spark-connect-go/v34/client/channel",
srcs = [
"channel.go",
"compat.go",
],
importpath = "github.com/apache/spark-connect-go/v1/client/channel",
visibility = ["//visibility:public"],
deps = [
"//client/sparkerrors",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//credentials",
"@org_golang_google_grpc//credentials/oauth",
Expand All @@ -18,6 +22,7 @@ go_test(
srcs = ["channel_test.go"],
deps = [
":channel",
"//client/sparkerrors",
"@com_github_stretchr_testify//assert",
],
)
14 changes: 12 additions & 2 deletions client/sql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ go_library(
"dataframereader.go",
"dataframewriter.go",
"datatype.go",
"executeplanclient.go",
"plan.go",
"row.go",
"sparksession.go",
"structtype.go",
],
importpath = "github.com/apache/spark-connect-go/v34/client/sql",
importpath = "github.com/apache/spark-connect-go/v1/client/sql",
visibility = ["//visibility:public"],
deps = [
"//client/channel",
"//client/sparkerrors",
"//:spark_connect_proto",
"//:spark_connect_proto_grpc",
"@com_github_apache_arrow_go_v12//arrow",
"@com_github_apache_arrow_go_v12//arrow/array",
Expand All @@ -29,11 +32,16 @@ go_test(
name = "sql_test",
srcs = [
"dataframe_test.go",
"dataframereader_test.go",
"dataframewriter_test.go",
"mocks_test.go",
"plan_test.go",
"row_test.go",
"sparksession_test.go",
],
embed = [":sql"],
deps = [
"//:spark_connect_proto_grpc",
"//client/sparkerrors",
"@com_github_apache_arrow_go_v12//arrow",
"@com_github_apache_arrow_go_v12//arrow/array",
"@com_github_apache_arrow_go_v12//arrow/decimal128",
Expand All @@ -43,5 +51,7 @@ go_test(
"@com_github_apache_arrow_go_v12//arrow/memory",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//metadata",
],
)
2 changes: 1 addition & 1 deletion client/sql/executeplanclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"

"github.com/apache/spark-connect-go/v1/client/sparkerrors"
proto "github.com/apache/spark-connect-go/v1/internal/generated"
proto "github.com/apache/spark-connect-go/v1/internal/generated/spark/connect"
)

type executePlanClient struct {
Expand Down
2 changes: 1 addition & 1 deletion client/sql/mocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

proto "github.com/apache/spark-connect-go/v1/internal/generated"
proto "github.com/apache/spark-connect-go/v1/internal/generated/spark/connect"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
Expand Down
2 changes: 1 addition & 1 deletion client/sql/sparksession_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/apache/spark-connect-go/v1/client/sparkerrors"
proto "github.com/apache/spark-connect-go/v1/internal/generated"
proto "github.com/apache/spark-connect-go/v1/internal/generated/spark/connect"
"github.com/stretchr/testify/assert"
)

Expand Down
3 changes: 1 addition & 2 deletions cmd/spark-connect-example-raw-grpc-client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ load("@rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "spark-connect-example-raw-grpc-client_lib",
srcs = ["main.go"],
importpath = "github.com/apache/spark-connect-go/v34/cmd/spark-connect-example-raw-grpc-client",
importpath = "github.com/apache/spark-connect-go/v1/cmd/spark-connect-example-raw-grpc-client",
visibility = ["//visibility:private"],
deps = [
"//:spark_connect_proto",
"@com_github_google_uuid//:uuid",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//credentials/insecure",
Expand Down
2 changes: 1 addition & 1 deletion cmd/spark-connect-example-spark-session/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "spark-connect-example-spark-session_lib",
srcs = ["main.go"],
importpath = "github.com/apache/spark-connect-go/v34/cmd/spark-connect-example-spark-session",
importpath = "github.com/apache/spark-connect-go/v1/cmd/spark-connect-example-spark-session",
visibility = ["//visibility:private"],
deps = ["//client/sql"],
)
Expand Down

0 comments on commit 8bf6cb9

Please sign in to comment.