Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-89: Add support for generating Flight related files #114

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arrow/flight/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

package flight

//go:generate protoc --experimental_allow_proto3_optional -I../../../format --go_out=./gen/flight --go-grpc_out=./gen/flight --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative Flight.proto
//go:generate protoc --experimental_allow_proto3_optional -I../../../format --go_out=./gen/flight --go-grpc_out=./gen/flight --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative FlightSql.proto
//go:generate protoc --experimental_allow_proto3_optional -I${APACHE_ARROW_FORMAT_DIR} --go_out=./gen/flight --go-grpc_out=./gen/flight --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative Flight.proto
//go:generate protoc --experimental_allow_proto3_optional -I${APACHE_ARROW_FORMAT_DIR} --go_out=./gen/flight --go-grpc_out=./gen/flight --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative FlightSql.proto
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these protoc ... command lines to dev/sync_flight.sh and remove this file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the standard way of handling things like this would be to utilize go generate to run the commands rather than a separate sync script (ideally). So I'd personally prefer keeping this file and the go:generate lines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said, it might be better to utilize buf instead see the links below on the substrait-go repo for how I did it there to reference and generate the protobuf from the .proto files in the substrait-io/substrait repo

https://github.com/substrait-io/substrait-go/blob/main/doc.go#L9
https://github.com/substrait-io/substrait-go/blob/main/buf.gen.yaml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I withdraw this approach.

38 changes: 38 additions & 0 deletions dev/sync_flight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

set -eux

source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

arrow_source="${source_dir}/arrow-source"
if [ -d "${arrow_source}" ]; then
have_arrow_source=true
else
have_arrow_source=false
git clone --depth 1 https://github.com/apache/arrow.git "${arrow_source}"
fi

pushd "${source_dir}/arrow/flight"
APACHE_ARROW_FORMAT_DIR="${arrow_source}/format" go generate gen.go
popd

if [ "${have_arrow_source}" = "false" ]; then
rm -rf "${arrow_source}"
fi
Loading