@@ -10,10 +10,9 @@ use tracing::instrument;
10
10
11
11
use re_log_encoding:: codec:: wire:: decoder:: Decode as _;
12
12
use re_log_types:: EntryId ;
13
- use re_protos:: cloud:: v1alpha1:: GetPartitionTableSchemaRequest ;
14
- use re_protos:: headers:: RerunHeadersInjectorExt as _;
15
13
use re_protos:: {
16
- cloud:: v1alpha1:: ScanPartitionTableRequest , cloud:: v1alpha1:: ScanPartitionTableResponse ,
14
+ cloud:: v1alpha1:: { ScanPartitionTableRequest , ScanPartitionTableResponse } ,
15
+ headers:: RerunHeadersInjectorExt as _,
17
16
} ;
18
17
use re_redap_client:: ConnectionClient ;
19
18
@@ -22,7 +21,6 @@ use crate::wasm_compat::make_future_send;
22
21
23
22
#[ derive( Clone ) ]
24
23
pub struct PartitionTableProvider {
25
- //TODO(#10191): this should use a `ConnectionRegistryHandle` instead
26
24
client : ConnectionClient ,
27
25
dataset_id : EntryId ,
28
26
}
@@ -52,27 +50,27 @@ impl GrpcStreamToTable for PartitionTableProvider {
52
50
53
51
#[ instrument( skip( self ) , err) ]
54
52
async fn fetch_schema ( & mut self ) -> DataFusionResult < SchemaRef > {
55
- let req = tonic:: Request :: new ( GetPartitionTableSchemaRequest { } )
56
- . with_entry_id ( self . dataset_id )
57
- . map_err ( |err| DataFusionError :: External ( Box :: new ( err) ) ) ?;
58
-
59
53
let mut client = self . client . clone ( ) ;
60
54
55
+ let dataset_id = self . dataset_id ;
56
+
61
57
Ok ( Arc :: new (
62
- make_future_send (
63
- async move { Ok ( client. inner ( ) . get_partition_table_schema ( req ) . await ) } ,
64
- )
65
- . await ?
66
- . map_err ( |err| DataFusionError :: External ( Box :: new ( err ) ) ) ?
67
- . into_inner ( )
68
- . schema
69
- . ok_or ( DataFusionError :: External (
70
- "Schema missing from GetPartitionTableSchema response" . into ( ) ,
71
- ) ) ?
72
- . try_into ( ) ?,
58
+ make_future_send ( async move {
59
+ client
60
+ . get_partition_table_schema ( dataset_id )
61
+ . await
62
+ . map_err ( |err| {
63
+ DataFusionError :: External (
64
+ format ! ( "Couldn't get partition table schema: {err}" ) . into ( ) ,
65
+ )
66
+ } )
67
+ } )
68
+ . await ?,
73
69
) )
74
70
}
75
71
72
+ // TODO(ab): what `GrpcStreamToTable` attempts to simplify should probably be handled by
73
+ // `ConnectionClient`
76
74
#[ instrument( skip( self ) , err) ]
77
75
async fn send_streaming_request (
78
76
& mut self ,
0 commit comments