Skip to content

Commit

Permalink
chore: merge and resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
appletreeisyellow committed Jul 22, 2024
2 parents 59b4684 + 7a23ea9 commit ff36b29
Show file tree
Hide file tree
Showing 64 changed files with 3,992 additions and 542 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bigdecimal = "=0.4.1"
bytes = "1.4"
chrono = { version = "0.4.34", default-features = false }
ctor = "0.2.0"
dashmap = "5.5.0"
dashmap = "6.0.1"
datafusion = { path = "datafusion/core", version = "40.0.0", default-features = false }
datafusion-common = { path = "datafusion/common", version = "40.0.0", default-features = false }
datafusion-common-runtime = { path = "datafusion/common-runtime", version = "40.0.0" }
Expand Down
43 changes: 25 additions & 18 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion datafusion-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mimalloc = { version = "0.1", default-features = false }
num_cpus = { workspace = true }
object_store = { workspace = true, features = ["aws", "http"] }
prost = { version = "0.12", default-features = false }
prost-derive = { version = "0.12", default-features = false }
prost-derive = { version = "0.13", default-features = false }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = { workspace = true }
tempfile = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions datafusion-examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cargo run --example dataframe
- [`composed_extension_codec`](examples/composed_extension_codec.rs): Example of using multiple extension codecs for serialization / deserialization
- [`csv_sql_streaming.rs`](examples/csv_sql_streaming.rs): Build and run a streaming query plan from a SQL statement against a local CSV file
- [`custom_datasource.rs`](examples/custom_datasource.rs): Run queries against a custom datasource (TableProvider)
- [`custom_file_format.rs`](examples/custom_file_format.rs): Write data to a custom file format
- [`dataframe-to-s3.rs`](examples/external_dependency/dataframe-to-s3.rs): Run a query using a DataFrame against a parquet file from s3 and writing back to s3
- [`dataframe.rs`](examples/dataframe.rs): Run a query using a DataFrame against a local parquet file
- [`dataframe_in_memory.rs`](examples/dataframe_in_memory.rs): Run a query using a DataFrame against data in memory
Expand Down
2 changes: 2 additions & 0 deletions datafusion/common-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// Make cheap clones clear: https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]

pub mod common;

Expand Down
12 changes: 6 additions & 6 deletions datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl DFSchema {
schema: &SchemaRef,
) -> Result<Self> {
let dfschema = Self {
inner: schema.clone(),
inner: Arc::clone(schema),
field_qualifiers: qualifiers,
functional_dependencies: FunctionalDependencies::empty(),
};
Expand Down Expand Up @@ -311,7 +311,7 @@ impl DFSchema {
};
if !duplicated_field {
// self.inner.fields.push(field.clone());
schema_builder.push(field.clone());
schema_builder.push(Arc::clone(field));
qualifiers.push(qualifier.cloned());
}
}
Expand Down Expand Up @@ -1276,23 +1276,23 @@ mod tests {
let arrow_schema_ref = Arc::new(arrow_schema.clone());

let df_schema = DFSchema {
inner: arrow_schema_ref.clone(),
inner: Arc::clone(&arrow_schema_ref),
field_qualifiers: vec![None; arrow_schema_ref.fields.len()],
functional_dependencies: FunctionalDependencies::empty(),
};
let df_schema_ref = Arc::new(df_schema.clone());

{
let arrow_schema = arrow_schema.clone();
let arrow_schema_ref = arrow_schema_ref.clone();
let arrow_schema_ref = Arc::clone(&arrow_schema_ref);

assert_eq!(df_schema, arrow_schema.to_dfschema().unwrap());
assert_eq!(df_schema, arrow_schema_ref.to_dfschema().unwrap());
}

{
let arrow_schema = arrow_schema.clone();
let arrow_schema_ref = arrow_schema_ref.clone();
let arrow_schema_ref = Arc::clone(&arrow_schema_ref);

assert_eq!(df_schema_ref, arrow_schema.to_dfschema_ref().unwrap());
assert_eq!(df_schema_ref, arrow_schema_ref.to_dfschema_ref().unwrap());
Expand Down Expand Up @@ -1322,7 +1322,7 @@ mod tests {
let schema = Arc::new(Schema::new(vec![a_field, b_field]));

let df_schema = DFSchema {
inner: schema.clone(),
inner: Arc::clone(&schema),
field_qualifiers: vec![None; schema.fields.len()],
functional_dependencies: FunctionalDependencies::empty(),
};
Expand Down
3 changes: 3 additions & 0 deletions datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@ make_error!(config_err, config_datafusion_err, Configuration);
// Exposes a macro to create `DataFusionError::Substrait` with optional backtrace
make_error!(substrait_err, substrait_datafusion_err, Substrait);

// Exposes a macro to create `DataFusionError::ResourcesExhausted` with optional backtrace
make_error!(resources_err, resources_datafusion_err, ResourcesExhausted);

// Exposes a macro to create `DataFusionError::SQL` with optional backtrace
#[macro_export]
macro_rules! sql_datafusion_err {
Expand Down
19 changes: 12 additions & 7 deletions datafusion/common/src/hash_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ fn hash_list_array<OffsetSize>(
where
OffsetSize: OffsetSizeTrait,
{
let values = array.values().clone();
let values = Arc::clone(array.values());
let offsets = array.value_offsets();
let nulls = array.nulls();
let mut values_hashes = vec![0u64; values.len()];
Expand Down Expand Up @@ -274,7 +274,7 @@ fn hash_fixed_list_array(
random_state: &RandomState,
hashes_buffer: &mut [u64],
) -> Result<()> {
let values = array.values().clone();
let values = Arc::clone(array.values());
let value_len = array.value_length();
let offset_size = value_len as usize / array.len();
let nulls = array.nulls();
Expand Down Expand Up @@ -622,19 +622,19 @@ mod tests {
vec![
(
Arc::new(Field::new("bool", DataType::Boolean, false)),
boolarr.clone() as ArrayRef,
Arc::clone(&boolarr) as ArrayRef,
),
(
Arc::new(Field::new("i32", DataType::Int32, false)),
i32arr.clone() as ArrayRef,
Arc::clone(&i32arr) as ArrayRef,
),
(
Arc::new(Field::new("i32", DataType::Int32, false)),
i32arr.clone() as ArrayRef,
Arc::clone(&i32arr) as ArrayRef,
),
(
Arc::new(Field::new("bool", DataType::Boolean, false)),
boolarr.clone() as ArrayRef,
Arc::clone(&boolarr) as ArrayRef,
),
],
Buffer::from(&[0b001011]),
Expand Down Expand Up @@ -710,7 +710,12 @@ mod tests {
let random_state = RandomState::with_seeds(0, 0, 0, 0);

let mut one_col_hashes = vec![0; strings1.len()];
create_hashes(&[dict_array.clone()], &random_state, &mut one_col_hashes).unwrap();
create_hashes(
&[Arc::clone(&dict_array) as ArrayRef],
&random_state,
&mut one_col_hashes,
)
.unwrap();

let mut two_col_hashes = vec![0; strings1.len()];
create_hashes(
Expand Down
2 changes: 2 additions & 0 deletions datafusion/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// Make cheap clones clear: https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]

mod column;
mod dfschema;
Expand Down
Loading

0 comments on commit ff36b29

Please sign in to comment.