Skip to content

Commit

Permalink
Split out arrow-schema (apache#2594)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Sep 12, 2022
1 parent be33fb3 commit a2f6a72
Show file tree
Hide file tree
Showing 18 changed files with 1,727 additions and 1,597 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -18,6 +18,7 @@
[workspace]
members = [
"arrow",
"arrow-schema",
"parquet",
"parquet_derive",
"parquet_derive_test",
Expand Down
52 changes: 52 additions & 0 deletions arrow-schema/Cargo.toml
@@ -0,0 +1,52 @@
# 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.

[package]
name = "arrow-schema"
version = "22.0.0"
description = "Defines the logical types for arrow arrays"
homepage = "https://github.com/apache/arrow-rs"
repository = "https://github.com/apache/arrow-rs"
authors = ["Apache Arrow <dev@arrow.apache.org>"]
license = "Apache-2.0"
keywords = ["arrow"]
include = [
"benches/*.rs",
"src/**/*.rs",
"Cargo.toml",
]
edition = "2021"
rust-version = "1.62"

[lib]
name = "arrow_schema"
path = "src/lib.rs"
bench = false

[dependencies]
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
serde_json = { version = "1.0", default-features = false, features = ["std"], optional = true }

[package.metadata.docs.rs]
features = ["json"]

[features]
default = []
json = ["serde", "serde_json"]

[dev-dependencies]

683 changes: 683 additions & 0 deletions arrow-schema/src/datatype.rs

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions arrow-schema/src/error.rs
@@ -0,0 +1,45 @@
// 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.

//! Defines `ArrowSchemaError` for representing failures in arrow schema

use std::error::Error;

#[derive(Debug)]
pub enum ArrowSchemaError {
Parse(String),
Merge(String),
Field(String),
}

impl std::fmt::Display for ArrowSchemaError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ArrowSchemaError::Parse(message) => {
write!(f, "Error parsing schema: {}", message)
}
ArrowSchemaError::Merge(message) => {
write!(f, "Error merging schema: {}", message)
}
ArrowSchemaError::Field(message) => {
write!(f, "Error indexing field: {}", message)
}
}
}
}

impl Error for ArrowSchemaError {}

0 comments on commit a2f6a72

Please sign in to comment.