MCPcopy Create free account
hub / github.com/apache/paimon-rust / test_schema_builder_build

Function test_schema_builder_build

crates/paimon/src/spec/schema.rs:785–803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

783
784 #[test]
785 fn test_schema_builder_build() {
786 let schema = Schema::builder()
787 .column("id", DataType::Int(IntType::with_nullable(true)))
788 .column("name", DataType::Int(IntType::new()))
789 .primary_key(["id"])
790 .option("k", "v")
791 .comment(Some("table comment".into()))
792 .build()
793 .unwrap();
794 assert_eq!(schema.fields().len(), 2);
795 assert_eq!(schema.primary_keys(), &["id"]);
796 assert_eq!(schema.options().get("k"), Some(&"v".to_string()));
797 assert_eq!(schema.comment(), Some("table comment"));
798 let id_field = schema.fields().iter().find(|f| f.name() == "id").unwrap();
799 assert!(
800 !id_field.data_type().is_nullable(),
801 "primary key column should be normalized to NOT NULL"
802 );
803 }
804
805 #[test]
806 fn test_schema_validation() {

Callers

nothing calls this directly

Calls 8

commentMethod · 0.80
optionMethod · 0.80
primary_keyMethod · 0.80
columnMethod · 0.80
buildMethod · 0.45
iterMethod · 0.45
fieldsMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected