Skip to content

Commit

Permalink
feat(spec): Add primitive data types (apache#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
XuQianJin-Stars authored Jul 25, 2024
1 parent 0ff9a96 commit ce42c78
Show file tree
Hide file tree
Showing 4 changed files with 1,038 additions and 32 deletions.
1 change: 1 addition & 0 deletions crates/paimon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ license.workspace = true
version.workspace = true

[dependencies]
bitflags = "2.6.0"
chrono = {version = "0.4.38", features = ["serde"]}
serde = { version = "1", features = ["derive"] }
serde_with = "3.8.3"
Expand Down
3 changes: 3 additions & 0 deletions crates/paimon/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ pub use schema::*;

mod snapshot;
pub use snapshot::*;

mod types;
pub use types::*;
33 changes: 1 addition & 32 deletions crates/paimon/src/spec/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
// specific language governing permissions and limitations
// under the License.

use crate::error::Error;
use crate::spec::types::DataType;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use std::str::FromStr;

/// The table schema for paimon table.
///
Expand Down Expand Up @@ -53,32 +51,3 @@ pub struct DataField {
typ: DataType,
description: Option<String>,
}

/// Data type for paimon table.
///
/// Impl Reference: <https://github.com/apache/paimon/blob/db8bcd7fdd9c2705435d2ab1d2341c52d1f67ee5/paimon-common/src/main/java/org/apache/paimon/types/DataType.java#L45>
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DataType {
is_nullable: bool,
type_root: DataTypeRoot,
}

impl Display for DataType {
fn fmt(&self, _: &mut Formatter<'_>) -> std::fmt::Result {
todo!()
}
}

impl FromStr for DataType {
type Err = Error;

fn from_str(_: &str) -> Result<Self, Self::Err> {
todo!()
}
}

/// The root of data type.
///
/// Impl Reference: <https://github.com/apache/paimon/blob/db8bcd7fdd9c2705435d2ab1d2341c52d1f67ee5/paimon-common/src/main/java/org/apache/paimon/types/DataTypeRoot.java#L49>
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DataTypeRoot {}
Loading

0 comments on commit ce42c78

Please sign in to comment.