Skip to content

Commit 71382ba

Browse files
committed
Rename stage #6
1 parent d70cce1 commit 71382ba

25 files changed

+762
-372
lines changed

bin/bucketd/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license-file = { workspace = true }
77
[dependencies]
88
clap = { version = "4.5.27", features = ["env", "derive"] }
99
dotenv = { version = "0.15.0" }
10-
icebucket_runtime = { path = "../../crates/runtime" }
10+
embucket_runtime = { path = "../../crates/runtime" }
1111
object_store = { workspace = true }
1212
snmalloc-rs = { workspace = true }
1313
tokio = { workspace = true }

bin/bucketd/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub(crate) mod cli;
1919

2020
use clap::Parser;
2121
use dotenv::dotenv;
22-
use icebucket_runtime::{
22+
use embucket_runtime::{
2323
config::{DbConfig, RuntimeConfig},
2424
http::config::WebConfig,
2525
run_binary,
@@ -36,9 +36,8 @@ async fn main() {
3636

3737
tracing_subscriber::registry()
3838
.with(
39-
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
40-
"bucketd=debug,icebucket_runtime=debug,tower_http=debug".into()
41-
}),
39+
tracing_subscriber::EnvFilter::try_from_default_env()
40+
.unwrap_or_else(|_| "bucketd=debug,embucket_runtime=debug,tower_http=debug".into()),
4241
)
4342
.with(tracing_subscriber::fmt::layer())
4443
.init();

crates/metastore/src/models/table.rs

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -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)]
124103
pub 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)]
171115
pub 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)]
256132
enum 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)]
326175
pub struct Config {

crates/runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "icebucket_runtime"
2+
name = "embucket_runtime"
33
version = "0.1.0"
44
edition = "2021"
55
license-file = { workspace = true }

crates/runtime/src/execution/catalogs/catalog.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,30 @@ use datafusion::catalog::{CatalogProvider, SchemaProvider};
2323
use embucket_metastore::Metastore;
2424
use iceberg_rust::catalog::Catalog as IcebergCatalog;
2525

26-
pub struct IceBucketDFCatalog {
26+
pub struct DFCatalog {
2727
pub ident: String,
2828
pub metastore: Arc<dyn Metastore>,
2929
pub mirror: Arc<CatalogProviderCache>,
3030
pub iceberg_catalog: Arc<dyn IcebergCatalog>,
3131
}
3232

33-
impl IceBucketDFCatalog {
33+
impl DFCatalog {
3434
#[must_use]
3535
pub fn catalog(&self) -> Arc<dyn IcebergCatalog> {
3636
self.iceberg_catalog.clone()
3737
}
3838
}
3939

4040
#[allow(clippy::missing_fields_in_debug)]
41-
impl std::fmt::Debug for IceBucketDFCatalog {
41+
impl std::fmt::Debug for DFCatalog {
4242
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43-
f.debug_struct("IceBucketDFCatalog")
43+
f.debug_struct("DFCatalog")
4444
.field("ident", &self.ident)
4545
.finish()
4646
}
4747
}
4848

49-
impl CatalogProvider for IceBucketDFCatalog {
49+
impl CatalogProvider for DFCatalog {
5050
fn as_any(&self) -> &dyn Any {
5151
self
5252
}

crates/runtime/src/execution/catalogs/iceberg_catalog.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ use object_store::ObjectStore;
5050
use snafu::ResultExt;
5151

5252
#[derive(Debug)]
53-
pub struct IceBucketIcebergBridge {
53+
pub struct IcebergBridge {
5454
pub metastore: Arc<dyn Metastore>,
5555
pub database: String,
5656
pub object_store: Arc<dyn ObjectStore>,
5757
}
5858

59-
impl IceBucketIcebergBridge {
59+
impl IcebergBridge {
6060
pub fn new(metastore: Arc<dyn Metastore>, database: String) -> MetastoreResult<Self> {
6161
let db = block_on(metastore.get_database(&database))?.ok_or(
6262
MetastoreError::DatabaseNotFound {
@@ -86,7 +86,7 @@ impl IceBucketIcebergBridge {
8686
}
8787

8888
#[async_trait]
89-
impl IcebergCatalog for IceBucketIcebergBridge {
89+
impl IcebergCatalog for IcebergBridge {
9090
/// Name of the catalog
9191
fn name(&self) -> &str {
9292
&self.database

crates/runtime/src/execution/catalogs/metastore.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use std::{
2121
sync::Arc,
2222
};
2323

24-
use crate::execution::catalogs::catalog::IceBucketDFCatalog;
25-
use crate::execution::catalogs::iceberg_catalog::IceBucketIcebergBridge;
24+
use crate::execution::catalogs::catalog::DFCatalog;
25+
use crate::execution::catalogs::iceberg_catalog::IcebergBridge;
2626
use crate::execution::error::{self as ex_error, ExecutionResult};
2727
use dashmap::DashMap;
2828
use datafusion::{
@@ -50,14 +50,14 @@ pub type SchemaProviderCache = DashMap<String, TableProviderCache>;
5050
pub type CatalogProviderCache = DashMap<String, SchemaProviderCache>;
5151

5252
#[derive(Clone)]
53-
pub struct IceBucketDFMetastore {
53+
pub struct DFMetastore {
5454
pub metastore: Arc<dyn Metastore>,
5555
pub mirror: Arc<CatalogProviderCache>,
5656
pub table_object_store: Arc<DashMap<String, Arc<dyn ObjectStore>>>,
5757
pub catalogs: DashMap<String, Arc<dyn CatalogProvider>>,
5858
}
5959

60-
impl IceBucketDFMetastore {
60+
impl DFMetastore {
6161
pub fn new(metastore: Arc<dyn Metastore>) -> Self {
6262
let table_object_store: DashMap<String, Arc<dyn ObjectStore>> = DashMap::new();
6363
table_object_store.insert("file://".to_string(), Arc::new(LocalFileSystem::new()));
@@ -146,7 +146,7 @@ impl IceBucketDFMetastore {
146146
) as Arc<dyn TableProvider>
147147
}
148148
embucket_metastore::TableFormat::Iceberg => {
149-
let bridge = Arc::new(IceBucketIcebergBridge {
149+
let bridge = Arc::new(IcebergBridge {
150150
metastore: self.metastore.clone(),
151151
database: table.ident.clone().database,
152152
object_store: table_object_store.clone(),
@@ -198,9 +198,9 @@ impl IceBucketDFMetastore {
198198
}
199199
}
200200

201-
impl std::fmt::Debug for IceBucketDFMetastore {
201+
impl std::fmt::Debug for DFMetastore {
202202
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
203-
f.debug_struct("IceBucketDFMetastore").finish()
203+
f.debug_struct("DFMetastore").finish()
204204
}
205205
}
206206

@@ -215,7 +215,7 @@ fn get_url_key(url: &Url) -> String {
215215
)
216216
}
217217

218-
impl ObjectStoreRegistry for IceBucketDFMetastore {
218+
impl ObjectStoreRegistry for DFMetastore {
219219
fn register_store(
220220
&self,
221221
url: &Url,
@@ -238,7 +238,7 @@ impl ObjectStoreRegistry for IceBucketDFMetastore {
238238
}
239239

240240
// Explore using AsyncCatalogProviderList alongside CatalogProviderList
241-
impl CatalogProviderList for IceBucketDFMetastore {
241+
impl CatalogProviderList for DFMetastore {
242242
fn as_any(&self) -> &dyn Any {
243243
self
244244
}
@@ -268,10 +268,10 @@ impl CatalogProviderList for IceBucketDFMetastore {
268268
if !self.mirror.contains_key(name) {
269269
return None;
270270
}
271-
let iceberg_catalog = IceBucketIcebergBridge::new(self.metastore.clone(), name.to_string())
271+
let iceberg_catalog = IcebergBridge::new(self.metastore.clone(), name.to_string())
272272
.ok()
273273
.map(Arc::new)?;
274-
let catalog: Arc<dyn CatalogProvider> = Arc::new(IceBucketDFCatalog {
274+
let catalog: Arc<dyn CatalogProvider> = Arc::new(DFCatalog {
275275
ident: name.to_string(),
276276
metastore: self.metastore.clone(),
277277
mirror: self.mirror.clone(),

crates/runtime/src/execution/datafusion/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use snafu::prelude::*;
2121

2222
#[derive(Snafu, Debug)]
2323
#[snafu(visibility(pub(crate)))]
24-
pub enum IceBucketSQLError {
24+
pub enum SQLError {
2525
#[snafu(display("Arrow error: {source}"))]
2626
Arrow { source: arrow::error::ArrowError },
2727

@@ -64,4 +64,4 @@ pub enum IceBucketSQLError {
6464
NotImplemented { message: String },
6565
}
6666

67-
pub type IceBucketSQLResult<T> = std::result::Result<T, IceBucketSQLError>;
67+
pub type SQLResult<T> = std::result::Result<T, SQLError>;

crates/runtime/src/execution/datafusion/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
//pub mod analyzer;
1919
//pub mod error;
2020
pub mod context_provider;
21+
pub mod error;
2122
pub mod functions;
2223
pub mod type_planner;

crates/runtime/src/execution/datafusion/type_planner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ use datafusion::sql::utils::make_decimal_type;
2424
use datafusion_common::{not_impl_err, DataFusionError};
2525

2626
#[derive(Debug)]
27-
pub struct IceBucketTypePlanner {}
27+
pub struct CustomTypePlanner {}
2828

29-
impl TypePlanner for IceBucketTypePlanner {
29+
impl TypePlanner for CustomTypePlanner {
3030
fn plan_type(&self, sql_type: &ast::DataType) -> Result<Option<DataType>> {
3131
match sql_type {
3232
SQLDataType::Int32 => Ok(Some(DataType::Int32)),

0 commit comments

Comments
 (0)