From e838e62d197cf0f6f653aa47aa00b5e5fb0b5f11 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Wed, 11 Sep 2024 22:09:20 +0100 Subject: [PATCH] add "ARROW_VERSION" const (#6379) --- arrow/examples/README.md | 1 + arrow/examples/version.rs | 24 ++++++++++++++++++++++++ arrow/src/lib.rs | 4 +++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 arrow/examples/version.rs diff --git a/arrow/examples/README.md b/arrow/examples/README.md index 7ec3b008b768..5c57ec00cd76 100644 --- a/arrow/examples/README.md +++ b/arrow/examples/README.md @@ -25,3 +25,4 @@ - [`read_csv.rs`](read_csv.rs): Reading CSV files with explicit schema, pretty printing Arrays - [`read_csv_infer_schema.rs`](read_csv_infer_schema.rs): Reading CSV files, pretty printing Arrays - [`tensor_builder.rs`](tensor_builder.rs): Using tensor builder +- [`version.rs`](version.rs): Print the arrow version and exit diff --git a/arrow/examples/version.rs b/arrow/examples/version.rs new file mode 100644 index 000000000000..60dc9334393d --- /dev/null +++ b/arrow/examples/version.rs @@ -0,0 +1,24 @@ +// 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. + +//! Print the arrow version and exit + +use arrow::ARROW_VERSION; + +fn main() { + println!("arrow version: {ARROW_VERSION}"); +} diff --git a/arrow/src/lib.rs b/arrow/src/lib.rs index 8796caf43e3d..581f87121432 100644 --- a/arrow/src/lib.rs +++ b/arrow/src/lib.rs @@ -361,7 +361,6 @@ //! [Apache Parquet]: https://parquet.apache.org/ //! [DataFusion]: https://github.com/apache/arrow-datafusion //! [issue tracker]: https://github.com/apache/arrow-rs/issues -//! #![deny(clippy::redundant_clone)] #![warn(missing_debug_implementations)] @@ -370,6 +369,9 @@ pub use arrow_array::{downcast_dictionary_array, downcast_primitive_array}; pub use arrow_buffer::{alloc, buffer}; +/// Arrow crate version +pub const ARROW_VERSION: &str = env!("CARGO_PKG_VERSION"); + pub mod array; pub mod compute; #[cfg(feature = "csv")]