Skip to content

Commit e838e62

Browse files
authored
add "ARROW_VERSION" const (#6379)
1 parent f050ff7 commit e838e62

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

arrow/examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@
2525
- [`read_csv.rs`](read_csv.rs): Reading CSV files with explicit schema, pretty printing Arrays
2626
- [`read_csv_infer_schema.rs`](read_csv_infer_schema.rs): Reading CSV files, pretty printing Arrays
2727
- [`tensor_builder.rs`](tensor_builder.rs): Using tensor builder
28+
- [`version.rs`](version.rs): Print the arrow version and exit

arrow/examples/version.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//! Print the arrow version and exit
19+
20+
use arrow::ARROW_VERSION;
21+
22+
fn main() {
23+
println!("arrow version: {ARROW_VERSION}");
24+
}

arrow/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@
361361
//! [Apache Parquet]: https://parquet.apache.org/
362362
//! [DataFusion]: https://github.com/apache/arrow-datafusion
363363
//! [issue tracker]: https://github.com/apache/arrow-rs/issues
364-
//!
365364
366365
#![deny(clippy::redundant_clone)]
367366
#![warn(missing_debug_implementations)]
@@ -370,6 +369,9 @@ pub use arrow_array::{downcast_dictionary_array, downcast_primitive_array};
370369

371370
pub use arrow_buffer::{alloc, buffer};
372371

372+
/// Arrow crate version
373+
pub const ARROW_VERSION: &str = env!("CARGO_PKG_VERSION");
374+
373375
pub mod array;
374376
pub mod compute;
375377
#[cfg(feature = "csv")]

0 commit comments

Comments
 (0)