Skip to content

Commit 1c7a93d

Browse files
feat: Implement serialize/deserialize for datatypes (#6)
* serialize/deserialize datatypes * fix timestamptz * allow whitespace in decimal * format json * test for map with int key * Add apache headers * Fix clippy warnings * improve Dispay of decimal and fixed type * Update datatype documentation Co-authored-by: Renjie Liu <[email protected]> * rename index in structtype getter * add serialization to tests * make structtype fields private * implement Display for StructType,StructField * fix display structtype * remove dependencies --------- Co-authored-by: Renjie Liu <[email protected]>
1 parent 5eb1070 commit 1c7a93d

File tree

5 files changed

+562
-0
lines changed

5 files changed

+562
-0
lines changed

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ license = "Apache-2.0"
2727
keywords = ["iceberg"]
2828

2929
[dependencies]
30+
apache-avro = "0.15.0"
31+
serde = "^1.0"
32+
serde_bytes = "0.11.8"
33+
serde_json = "^1.0"
34+
serde_derive = "^1.0"
35+
thiserror = "1.0.44"

src/error.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
use thiserror::Error;
19+
20+
#[derive(Error, Debug)]
21+
pub enum IcebergError {
22+
#[error("The type `{0}` cannot be stored as bytes.")]
23+
ValueByteConversion(String),
24+
#[error("Failed to convert slice to array")]
25+
TryFromSlice(#[from] std::array::TryFromSliceError),
26+
#[error("Failed to convert u8 to string")]
27+
Utf8(#[from] std::str::Utf8Error),
28+
}

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
// under the License.
1717

1818
//! Native Rust implementation of Apache Iceberg
19+
pub mod error;
20+
pub mod spec;

0 commit comments

Comments
 (0)