Skip to content

Commit

Permalink
Merge commit '0f76bd6fbfaf13e2992929e71f4068f117d35628' into chunchun…
Browse files Browse the repository at this point in the history
…/update-df-apr-week-4-3
  • Loading branch information
appletreeisyellow committed Apr 30, 2024
2 parents e0ffd76 + 0f76bd6 commit 0f588e9
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 59 deletions.
128 changes: 70 additions & 58 deletions datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#[cfg(feature = "backtrace")]
use std::backtrace::{Backtrace, BacktraceStatus};

use std::borrow::Cow;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::io;
Expand Down Expand Up @@ -281,64 +282,9 @@ impl From<GenericError> for DataFusionError {

impl Display for DataFusionError {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
match *self {
DataFusionError::ArrowError(ref desc, ref backtrace) => {
let backtrace = backtrace.clone().unwrap_or("".to_owned());
write!(f, "Arrow error: {desc}{backtrace}")
}
#[cfg(feature = "parquet")]
DataFusionError::ParquetError(ref desc) => {
write!(f, "Parquet error: {desc}")
}
#[cfg(feature = "avro")]
DataFusionError::AvroError(ref desc) => {
write!(f, "Avro error: {desc}")
}
DataFusionError::IoError(ref desc) => {
write!(f, "IO error: {desc}")
}
DataFusionError::SQL(ref desc, ref backtrace) => {
let backtrace: String = backtrace.clone().unwrap_or("".to_owned());
write!(f, "SQL error: {desc:?}{backtrace}")
}
DataFusionError::Configuration(ref desc) => {
write!(f, "Invalid or Unsupported Configuration: {desc}")
}
DataFusionError::NotImplemented(ref desc) => {
write!(f, "This feature is not implemented: {desc}")
}
DataFusionError::Internal(ref desc) => {
write!(f, "Internal error: {desc}.\nThis was likely caused by a bug in DataFusion's \
code and we would welcome that you file an bug report in our issue tracker")
}
DataFusionError::Plan(ref desc) => {
write!(f, "Error during planning: {desc}")
}
DataFusionError::SchemaError(ref desc, ref backtrace) => {
let backtrace: &str =
&backtrace.as_ref().clone().unwrap_or("".to_owned());
write!(f, "Schema error: {desc}{backtrace}")
}
DataFusionError::Execution(ref desc) => {
write!(f, "Execution error: {desc}")
}
DataFusionError::ResourcesExhausted(ref desc) => {
write!(f, "Resources exhausted: {desc}")
}
DataFusionError::External(ref desc) => {
write!(f, "External error: {desc}")
}
#[cfg(feature = "object_store")]
DataFusionError::ObjectStore(ref desc) => {
write!(f, "Object Store error: {desc}")
}
DataFusionError::Context(ref desc, ref err) => {
write!(f, "{}\ncaused by\n{}", desc, *err)
}
DataFusionError::Substrait(ref desc) => {
write!(f, "Substrait error: {desc}")
}
}
let error_prefix = self.error_prefix();
let message = self.message();
write!(f, "{error_prefix}{message}")
}
}

Expand Down Expand Up @@ -419,6 +365,9 @@ impl DataFusionError {
Self::Context(description.into(), Box::new(self))
}

/// Strips backtrace out of the error message
/// If backtrace enabled then error has a format "message" [`Self::BACK_TRACE_SEP`] "backtrace"
/// The method strips the backtrace and outputs "message"
pub fn strip_backtrace(&self) -> String {
self.to_string()
.split(Self::BACK_TRACE_SEP)
Expand Down Expand Up @@ -450,6 +399,69 @@ impl DataFusionError {
#[cfg(not(feature = "backtrace"))]
"".to_owned()
}

fn error_prefix(&self) -> &'static str {
match self {
DataFusionError::ArrowError(_, _) => "Arrow error: ",
#[cfg(feature = "parquet")]
DataFusionError::ParquetError(_) => "Parquet error: ",
#[cfg(feature = "avro")]
DataFusionError::AvroError(_) => "Avro error: ",
#[cfg(feature = "object_store")]
DataFusionError::ObjectStore(_) => "Object Store error: ",
DataFusionError::IoError(_) => "IO error: ",
DataFusionError::SQL(_, _) => "SQL error: ",
DataFusionError::NotImplemented(_) => "This feature is not implemented: ",
DataFusionError::Internal(_) => "Internal error: ",
DataFusionError::Plan(_) => "Error during planning: ",
DataFusionError::Configuration(_) => "Invalid or Unsupported Configuration: ",
DataFusionError::SchemaError(_, _) => "Schema error: ",
DataFusionError::Execution(_) => "Execution error: ",
DataFusionError::ResourcesExhausted(_) => "Resources exhausted: ",
DataFusionError::External(_) => "External error: ",
DataFusionError::Context(_, _) => "",
DataFusionError::Substrait(_) => "Substrait error: ",
}
}

pub fn message(&self) -> Cow<str> {
match *self {
DataFusionError::ArrowError(ref desc, ref backtrace) => {
let backtrace = backtrace.clone().unwrap_or("".to_owned());
Cow::Owned(format!("{desc}{backtrace}"))
}
#[cfg(feature = "parquet")]
DataFusionError::ParquetError(ref desc) => Cow::Owned(desc.to_string()),
#[cfg(feature = "avro")]
DataFusionError::AvroError(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::IoError(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::SQL(ref desc, ref backtrace) => {
let backtrace: String = backtrace.clone().unwrap_or("".to_owned());
Cow::Owned(format!("{desc:?}{backtrace}"))
}
DataFusionError::Configuration(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::NotImplemented(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::Internal(ref desc) => Cow::Owned(format!(
"{desc}.\nThis was likely caused by a bug in DataFusion's \
code and we would welcome that you file an bug report in our issue tracker"
)),
DataFusionError::Plan(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::SchemaError(ref desc, ref backtrace) => {
let backtrace: &str =
&backtrace.as_ref().clone().unwrap_or("".to_owned());
Cow::Owned(format!("{desc}{backtrace}"))
}
DataFusionError::Execution(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::ResourcesExhausted(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::External(ref desc) => Cow::Owned(desc.to_string()),
#[cfg(feature = "object_store")]
DataFusionError::ObjectStore(ref desc) => Cow::Owned(desc.to_string()),
DataFusionError::Context(ref desc, ref err) => {
Cow::Owned(format!("{desc}\ncaused by\n{}", *err))
}
DataFusionError::Substrait(ref desc) => Cow::Owned(desc.to_string()),
}
}
}

/// Unwrap an `Option` if possible. Otherwise return an `DataFusionError::Internal`.
Expand Down
1 change: 0 additions & 1 deletion datafusion/proto/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#[allow(clippy::all)]
#[rustfmt::skip]
#[cfg(not(docsrs))]
pub mod datafusion {
include!("prost.rs");

Expand Down
93 changes: 93 additions & 0 deletions docs/source/contributor-guide/governance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!---
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.
-->

# Governance

The current PMC and committers are listed in the [Apache Phonebook].

[apache phonebook]: https://projects.apache.org/committee.html?datafusion

## Overview

DataFusion is part of the [Apache Software Foundation] and is governed following
the [Apache Way] and [project management guidelines], [independently of
commercial interests].

[apache software foundation]: https://www.apache.org/
[apache way]: https://www.apache.org/theapacheway/
[project management guidelines]: https://www.apache.org/foundation/how-it-works.html#management
[independently of commercial interests]: https://community.apache.org/projectIndependence.html

As much as practicable, we strive to make decisions by consensus, and anyone in
the community is encouraged to propose ideas, start discussions, and contribute
to the project.

## Roles

- **Contributors**: Anyone who contributes to the project, whether it be code,
documentation, testing, issue reports, code, or some other forms.

- **Committers**: Contributors who have been granted write access to the
project's source code repository. Committers are responsible for reviewing and
merging pull requests. Committers are chosen by the PMC.

- **Project Management Committee (PMC)**: The PMC is responsible for the
oversight of the project. The PMC is responsible for making decisions about the
project, including the addition of new committers and PMC members. The PMC is
also responsible for [voting] on releases and ensuring that the project follows
the [Apache Way].

[voting]: https://www.apache.org/foundation/voting.html

## Becoming a Committer

Contributors with sustained, high-quality activity may be invited to become
committers by the PMC as a recognition of their contribution to the project and
their shared commitment. Committers have the significant responsibility of using
their status and access to improve the project for the entire community.

When considering inviting someone to be a committer, the PMC looks for
contributors who are already doing the work and exercising the judgment expected
of a committer. After all, any contributor can do all of the things a committer
does except for merge a PR. While there is no set list of requirements, nor a
checklist that entitles one to commit privileges, typical behaviors include:

- Contributions beyond pull requests, such as reviewing other pull requests,
fixing bugs and documentation, triaging issues, answering community questions,
improving usability, helping with CI, verifying releases, etc.

- Contributions that are consistent in quality and sustained
over time, typically on the order of 6 months or more.

- Assistance growing the size and health of the community via constructive,
respectful, and consensus driven interactions, as described in our [Code of
Conduct] and the [Apache Way].

If you feel you should be offered committer privileges, but have not been, you
can reach out to one of the PMC members or the [email protected] mailing
list.

[code of conduct]: https://www.apache.org/foundation/policies/conduct.html

## Becoming a PMC Member

Committers with long term sustained contributions to the project may be invited
to join the PMC. This is a recognition of a significant contribution to growing
the community, improving the project, and helping to guide the project's
direction, typically over the course of a year or more.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ Please see the `developer’s guide`_ for contributing and `communication`_ for
contributor-guide/architecture
contributor-guide/roadmap
contributor-guide/quarterly_roadmap
contributor-guide/governance
contributor-guide/specification/index

0 comments on commit 0f588e9

Please sign in to comment.