Skip to content

Commit 463f868

Browse files
authored
build: add pqarrow_read_only build tags to avoid building write related code (apache#569)
### Rationale for this change The current binary when built is 20mb. We have a use case in which we only need to read data from a parquet file and do not need to write any parquet data out. By Adding build tags to code that is only needed to write we can save ~12mb off the size of our binary compiled with arrow-go. ### What changes are included in this PR? This PR adds the build tag `!pqarrow_read_only` to write related files in the `pqarrow` package. ### Are these changes tested? Tested the build locally and against my read only use case. Added test in `ci/scripts/build.sh` ### Are there any user-facing changes? No, this change is only for consumers who build `arrow-go` but do not need write functionality.
1 parent 528af29 commit 463f868

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

arrow/avro/avro2parquet/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17+
//go:build !pqarrow_read_only
18+
1719
package main
1820

1921
import (

ci/scripts/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,9 @@ if [[ "${ARROW_INTEGRATION_GO}" = "ON" ]]; then
7373

7474
popd
7575
fi
76+
77+
pushd "${source_dir}/parquet"
78+
79+
go install -tags pqarrow_read_only ./...
80+
81+
popd

parquet/pqarrow/encode_arrow.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17+
//go:build !pqarrow_read_only
18+
1719
package pqarrow
1820

1921
import (

parquet/pqarrow/encode_dict_compute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
//go:build go1.18
17+
//go:build go1.18 && !pqarrow_read_only
1818

1919
package pqarrow
2020

parquet/pqarrow/encode_dict_nocompute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
//go:build !go1.18
17+
//go:build !go1.18 && !pqarrow_read_only
1818

1919
package pqarrow
2020

parquet/pqarrow/file_writer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17+
//go:build !pqarrow_read_only
18+
1719
package pqarrow
1820

1921
import (

0 commit comments

Comments
 (0)