@@ -99,27 +99,6 @@ impl From<String> for TableFormat {
9999 }
100100}
101101
102- /*#[derive(Validate, Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
103- pub struct IceBucketSimpleSchema {
104- pub fields: Vec<NestedFieldRef>,
105- pub schema_id: Option<i32>,
106- }
107-
108- impl TryFrom<IceBucketSimpleSchema> for Schema {
109- type Error = MetastoreError;
110- fn try_from(schema: IceBucketSimpleSchema) -> MetastoreResult<Self> {
111- let mut builder = Self::builder();
112- builder = builder.with_fields(schema.fields);
113- if let Some(schema_id) = schema.schema_id {
114- builder = builder.with_schema_id(schema_id);
115- }
116- builder.build()
117- .context(metastore_error::IcebergSnafu)
118- }
119- }
120-
121- type SimpleOrIcebergSchema = Either<IceBucketSimpleSchema, Schema>;*/
122-
123102#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq ) ]
124103pub struct Table {
125104 pub ident : TableIdent ,
@@ -132,41 +111,6 @@ pub struct Table {
132111 pub format : TableFormat ,
133112}
134113
135- /*impl PartialSchema for IceBucketTable {
136- fn schema() -> openapi::RefOr<openapi::schema::Schema> {
137-
138- let table_metadata_schema = openapi::ObjectBuilder::new()
139- .property("format_version", openapi::ObjectBuilder::new()
140- .schema_type(openapi::Type::Integer)
141- .format(Some(openapi::SchemaFormat::KnownFormat(openapi::KnownFormat::Int32)))
142- .build()
143- )
144- .property(
145- "table_uuid",
146- openapi::Object::with_type(openapi::Type::String))
147- .property("name", openapi::schema::String::default())
148- .property("schema_id", openapi::schema::Integer::default())
149- .property("current_schema_id", openapi::schema::Integer::default())
150- .property("default_partition_spec_id", openapi::schema::Integer::default())
151- .property("default_sort_order_id", openapi::schema::Integer::default())
152- .property("last_partition_id", openapi::schema::Integer::default())
153- .property("last_column_id", openapi::schema::Integer::default())
154- .property("refs", openapi::schema::Object::default())
155- .property("properties", utoipa_schema::Map::default())
156- .property("schema", openapi::schema::Object::default())
157- .property("partition_spec", openapi::schema::Object::default())
158- .property("sort_order", openapi::schema::Object::default())
159- .build();
160- openapi::ObjectBuilder::default()
161- .property("ident", IceBucketTableIdent::schema())
162- .property("metadata", table_metadata_schema)
163- .property("metadata_location", openapi::schema::String::default())
164- .property("properties", utoipa_schema::Map::default())
165- .build()
166- }
167- }
168- impl ToSchema for IceBucketTable {}*/
169-
170114#[ derive( Validate , Debug , Serialize , Deserialize , Clone , PartialEq , Eq ) ]
171115pub struct TableCreateRequest {
172116 #[ validate( nested) ]
@@ -184,74 +128,6 @@ pub struct TableCreateRequest {
184128 pub is_temporary : Option < bool > ,
185129}
186130
187- /*fn type_schema() -> (String, openapi::RefOr<openapi::schema::Schema>) {
188- let primitive_type = openapi::OneOfBuilder::new()
189- .item(openapi::ObjectBuilder::new()
190- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::String))
191- .enum_values(Some(vec!["boolean", "int", "long", "float", "double", "date", "time", "timestamp", "timestamptz", "string", "uuid", "binary"]))
192- )
193- .item(openapi::ObjectBuilder::new()
194- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Object))
195- .property("precision", openapi::ObjectBuilder::new()
196- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Integer))
197- .build())
198- .property("scale", openapi::schema::Type::Integer)
199- )
200- .item(openapi::ObjectBuilder::new()
201- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Integer)))
202- .build();
203- let struct_type = openapi::RefOr::Ref(openapi::Ref::builder().ref_location_from_schema_name("StructType".to_string()).build());
204- let list_type = openapi::ObjectBuilder::new()
205- .property("element_id", openapi::ObjectBuilder::new()
206- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Integer))
207- .build()
208- )
209- .property("element_required", openapi::ObjectBuilder::new()
210- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Boolean))
211- .build()
212- )
213- .property("element", openapi::RefOr::Ref(openapi::Ref::builder().ref_location_from_schema_name("Type".to_string()).build()))
214- .build();
215- let map_type = openapi::ObjectBuilder::new()
216- .property("key_id", openapi::ObjectBuilder::new()
217- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Integer))
218- .build()
219- )
220- .property("key", openapi::RefOr::Ref(openapi::Ref::builder().ref_location_from_schema_name("Type".to_string()).build()))
221- .property("value_id", openapi::ObjectBuilder::new()
222- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Integer))
223- .build()
224- )
225- .property("value", openapi::RefOr::Ref(openapi::Ref::builder().ref_location_from_schema_name("Type".to_string()).build()))
226- .property("value_required", openapi::ObjectBuilder::new()
227- .schema_type(openapi::schema::SchemaType::new(openapi::schema::Type::Boolean))
228- .build()
229- )
230- .build();
231- let one_of = openapi::OneOf::builder()
232- .item(primitive_type.into())
233- .item(struct_type)
234- .item(list_type)
235- .item(map_type);
236- ("Type".to_string(), one_of.into())
237- }
238-
239- impl ToSchema for IceBucketTableCreateRequest {}
240- impl PartialSchema for IceBucketTableCreateRequest {
241- fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
242-
243- let
244- let mut type_schema = openapi::OneOfBuilder::new()
245- .item(primitive_type)
246-
247-
248- let mut struct_field_type = openapi::OneOfBuilder::new()
249- .item(primitive_type)
250- let struct_field = openapi::ObjectBuilder::new()
251- .property("id", )
252- }
253- }*/
254-
255131#[ derive( ToSchema , Deserialize , Serialize ) ]
256132enum MyPrimitive {
257133 Int ,
@@ -294,33 +170,6 @@ struct MySchema {
294170 #[ serde( flatten) ]
295171 fields : MyStruct ,
296172}
297- /*impl TryFrom<IceBucketTableCreateRequest> for iceberg::TableCreation {
298- type Error = MetastoreError;
299-
300- fn try_from(schema: IceBucketTableCreateRequest) -> MetastoreResult<Self> {
301- let mut properties = schema.properties.unwrap_or_default();
302- let utc_now = Utc::now();
303- let utc_now_str = utc_now.to_rfc3339();
304- properties.insert("created_at".to_string(), utc_now_str.clone());
305- properties.insert("updated_at".to_string(), utc_now_str);
306-
307- let table_schema = match schema.schema {
308- Either::Left(simple_schema) => {
309- Schema::try_from(simple_schema)?
310- }
311- Either::Right(schema) => schema,
312- };
313-
314- Ok(Self {
315- name: schema.ident.table,
316- location: schema.location,
317- schema: table_schema,
318- partition_spec: schema.partition_spec.map(std::convert::Into::into),
319- sort_order: schema.write_order,
320- properties,
321- })
322- }
323- }*/
324173
325174#[ derive( Clone , Debug , PartialEq , Eq , Default , Serialize , Deserialize ) ]
326175pub struct Config {
0 commit comments