@@ -30,7 +30,7 @@ use futures_core::Stream;
30
30
use futures_util:: StreamExt ;
31
31
use tokio:: fs;
32
32
use tonbo:: {
33
- executor:: tokio:: TokioExecutor , inmem:: immutable:: ArrowArrays , record:: Schema , DbOption , DB ,
33
+ executor:: tokio:: TokioExecutor , inmem:: immutable:: ArrowArrays , record:: Record , DbOption , DB ,
34
34
} ;
35
35
use tonbo_macros:: Record ;
36
36
@@ -51,10 +51,7 @@ struct MusicExec {
51
51
db : Arc < DB < Music , TokioExecutor > > ,
52
52
projection : Option < Vec < usize > > ,
53
53
limit : Option < usize > ,
54
- range : (
55
- Bound < <MusicSchema as Schema >:: Key > ,
56
- Bound < <MusicSchema as Schema >:: Key > ,
57
- ) ,
54
+ range : ( Bound < <Music as Record >:: Key > , Bound < <Music as Record >:: Key > ) ,
58
55
}
59
56
60
57
struct MusicStream {
@@ -76,7 +73,7 @@ impl TableProvider for MusicProvider {
76
73
}
77
74
78
75
fn schema ( & self ) -> SchemaRef {
79
- MusicSchema { } . arrow_schema ( ) . clone ( )
76
+ Music :: arrow_schema ( ) . clone ( )
80
77
}
81
78
82
79
fn table_type ( & self ) -> TableType {
@@ -109,7 +106,7 @@ impl TableProvider for MusicProvider {
109
106
110
107
impl MusicExec {
111
108
fn new ( db : Arc < DB < Music , TokioExecutor > > , projection : Option < & Vec < usize > > ) -> Self {
112
- let schema = MusicSchema { } . arrow_schema ( ) ;
109
+ let schema = Music :: arrow_schema ( ) ;
113
110
let schema = if let Some ( projection) = & projection {
114
111
Arc :: new ( schema. project ( projection) . unwrap ( ) )
115
112
} else {
@@ -141,7 +138,7 @@ impl Stream for MusicStream {
141
138
142
139
impl RecordBatchStream for MusicStream {
143
140
fn schema ( & self ) -> SchemaRef {
144
- MusicSchema { } . arrow_schema ( ) . clone ( )
141
+ Music :: arrow_schema ( ) . clone ( )
145
142
}
146
143
}
147
144
@@ -229,12 +226,9 @@ async fn main() -> Result<()> {
229
226
// make sure the path exists
230
227
let _ = fs:: create_dir_all ( "./db_path/music" ) . await ;
231
228
232
- let options = DbOption :: new (
233
- Path :: from_filesystem_path ( "./db_path/music" ) . unwrap ( ) ,
234
- & MusicSchema ,
235
- ) ;
229
+ let options = DbOption :: new ( Path :: from_filesystem_path ( "./db_path/music" ) . unwrap ( ) ) ;
236
230
237
- let db = DB :: new ( options, TokioExecutor :: current ( ) , MusicSchema )
231
+ let db = DB :: new ( options, TokioExecutor :: current ( ) , Music :: schema ( ) )
238
232
. await
239
233
. unwrap ( ) ;
240
234
for ( id, name, like) in [
0 commit comments