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

chore: Clarify that the datafusion-comet crate does not have a public API #1144

Closed
wants to merge 8 commits 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
6 changes: 6 additions & 0 deletions .github/actions/rust-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ runs:
cd native
cargo install cargo-machete && cargo machete

- name: Check no public items in datafusion-comet crate
shell: bash
run: |
cd native/core
cargo rustc -- -D unreachable_pub

- name: Cache Maven dependencies
uses: actions/cache@v4
with:
Expand Down
26 changes: 26 additions & 0 deletions native/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
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.
-->

# Apache DataFusion Comet: Plugin Native Code

This crate contains the native code that is invoked from the Comet's Spark plugin and is not intended to be
used as a dependency from other projects. Therefore, it does not provide a public API and is not published to crates.io.

However, the `datafusion-comet-proto` and `datafusion-comet-spark-expr` crates do provide public APIs and are
published to crates.io.
8 changes: 4 additions & 4 deletions native/core/benches/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ use rand::{
use std::sync::Arc;

/// Returns fixed seedable RNG
pub fn seedable_rng() -> StdRng {
pub(crate) fn seedable_rng() -> StdRng {
StdRng::seed_from_u64(42)
}

pub fn create_int64_array(size: usize, null_density: f32, min: i64, max: i64) -> Int64Array {
pub(crate) fn create_int64_array(size: usize, null_density: f32, min: i64, max: i64) -> Int64Array {
let mut rng = seedable_rng();
(0..size)
.map(|_| {
Expand All @@ -46,7 +46,7 @@ pub fn create_int64_array(size: usize, null_density: f32, min: i64, max: i64) ->
}

#[allow(dead_code)]
pub fn create_primitive_array<T>(size: usize, null_density: f32) -> PrimitiveArray<T>
pub(crate) fn create_primitive_array<T>(size: usize, null_density: f32) -> PrimitiveArray<T>
where
T: ArrowPrimitiveType,
Standard: Distribution<T::Native>,
Expand All @@ -66,7 +66,7 @@ where
/// Creates a dictionary with random keys and values, with value type `T`.
/// Note here the keys are the dictionary indices.
#[allow(dead_code)]
pub fn create_dictionary_array<T>(
pub(crate) fn create_dictionary_array<T>(
size: usize,
value_size: usize,
null_density: f32,
Expand Down
2 changes: 1 addition & 1 deletion native/core/benches/parquet_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ struct TestColumnReader {
}

impl TestColumnReader {
pub fn new(
pub(crate) fn new(
cd: ColumnDescriptor,
promotion_info: TypePromotionInfo,
batch_size: usize,
Expand Down
4 changes: 2 additions & 2 deletions native/core/benches/perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ use pprof::ProfilerGuard;
/// Mostly followed this blog post: https://www.jibbow.com/posts/criterion-flamegraphs/
/// After `cargo bench --bench <bench-name> -- --profile-time=<time>`
/// You can find flamegraph.svg under `target/criterion/<bench-name>/<bench-method-name>/profile`
pub struct FlamegraphProfiler<'a> {
pub(crate) struct FlamegraphProfiler<'a> {
frequency: c_int,
active_profiler: Option<ProfilerGuard<'a>>,
}

impl<'a> FlamegraphProfiler<'a> {
pub fn new(frequency: c_int) -> Self {
pub(crate) fn new(frequency: c_int) -> Self {
FlamegraphProfiler {
frequency,
active_profiler: None,
Expand Down
4 changes: 2 additions & 2 deletions native/core/benches/row_columnar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ struct Row {
}

impl Row {
pub fn new() -> Self {
pub(crate) fn new() -> Self {
Row {
data: Box::new([0u8; ROW_SIZE]),
}
}

pub fn to_spark_row(&self, spark_row: &mut SparkUnsafeRow) {
pub(crate) fn to_spark_row(&self, spark_row: &mut SparkUnsafeRow) {
spark_row.point_to_slice(self.data.as_ref());
}
}
Expand Down
Loading
Loading