datafusion-catalog 54.0.0

datafusion-catalog
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

use std::any::Any;
use std::borrow::Cow;
use std::fmt::Debug;
use std::sync::Arc;

use crate::session::Session;
use arrow::datatypes::SchemaRef;
use async_trait::async_trait;
use datafusion_common::{Constraints, Statistics, not_impl_err};
use datafusion_common::{Result, internal_err};
use datafusion_expr::Expr;

use datafusion_expr::dml::InsertOp;
use datafusion_expr::{
    CreateExternalTable, LogicalPlan, TableProviderFilterPushDown, TableType,
};
use datafusion_physical_plan::ExecutionPlan;

/// A table which can be queried and modified.
///
/// Please see [`CatalogProvider`] for details of implementing a custom catalog.
///
/// [`TableProvider`] represents a source of data which can provide data as
/// Apache Arrow [`RecordBatch`]es. Implementations of this trait provide
/// important information for planning such as:
///
/// 1. [`Self::schema`]: The schema (columns and their types) of the table
/// 2. [`Self::supports_filters_pushdown`]: Should filters be pushed into this scan
/// 2. [`Self::scan`]: An [`ExecutionPlan`] that can read data
///
/// [`RecordBatch`]: https://docs.rs/arrow/latest/arrow/record_batch/struct.RecordBatch.html
/// [`CatalogProvider`]: super::CatalogProvider
#[async_trait]
pub trait TableProvider: Any + Debug + Sync + Send {
    /// Get a reference to the schema for this table
    fn schema(&self) -> SchemaRef;

    /// Get a reference to the constraints of the table.
    /// Returns:
    /// - `None` for tables that do not support constraints.
    /// - `Some(&Constraints)` for tables supporting constraints.
    /// Therefore, a `Some(&Constraints::empty())` return value indicates that
    /// this table supports constraints, but there are no constraints.
    fn constraints(&self) -> Option<&Constraints> {
        None
    }

    /// Get the type of this table for metadata/catalog purposes.
    fn table_type(&self) -> TableType;

    /// Get the create statement used to create this table, if available.
    fn get_table_definition(&self) -> Option<&str> {
        None
    }

    /// Get the [`LogicalPlan`] of this table, if available.
    fn get_logical_plan(&'_ self) -> Option<Cow<'_, LogicalPlan>> {
        None
    }

    /// Get the default value for a column, if available.
    fn get_column_default(&self, _column: &str) -> Option<&Expr> {
        None
    }

    /// Create an [`ExecutionPlan`] for scanning the table with optional
    /// `projection`, `filter`, and `limit`, described below.
    ///
    /// The returned `ExecutionPlan` is responsible for scanning the datasource's
    /// partitions in a streaming, parallelized fashion.
    ///
    /// # Projection
    ///
    /// If specified, only a subset of columns should be returned, in the order
    /// specified. The projection is a set of indexes of the fields in
    /// [`Self::schema`].
    ///
    /// DataFusion provides the projection so the scan reads only the columns
    /// actually used in the query, an optimization called "Projection
    /// Pushdown". Some datasources, such as Parquet, can use this information
    /// to go significantly faster when only a subset of columns is required.
    ///
    /// # Filters
    ///
    /// A list of boolean filter [`Expr`]s to evaluate *during* the scan, in the
    /// manner specified by [`Self::supports_filters_pushdown`]. Only rows for
    /// which *all* of the `Expr`s evaluate to `true` must be returned (that is,
    /// the expressions are `AND`ed together).
    ///
    /// To enable filter pushdown, override
    /// [`Self::supports_filters_pushdown`]. The default implementation does not
    /// push down filters, and `filters` will be empty.
    ///
    /// DataFusion pushes filters into scans whenever possible ("Filter
    /// Pushdown"). Depending on the data format and implementation, evaluating
    /// predicates during the scan can significantly improve performance.
    ///
    /// ## Note: Some columns may appear *only* in Filters
    ///
    /// In some cases, a query may use a column only in a filter and the
    /// projection will not contain all columns referenced by the filter
    /// expressions.
    ///
    /// For example, given the query `SELECT t.a FROM t WHERE t.b > 5`,
    ///
    /// ```text
    /// ┌────────────────────┐
    /// │  Projection(t.a)   │
    /// └────────────────────┘
    ///    ///    ///    /// ┌────────────────────┐     Filter     ┌────────────────────┐   Projection    ┌────────────────────┐
    /// │  Filter(t.b > 5)   │────Pushdown──▶ │  Projection(t.a)   │ ───Pushdown───▶ │  Projection(t.a)   │
    /// └────────────────────┘                └────────────────────┘                 └────────────────────┘
    ///            ▲                                     ▲                                      ▲
    ///            │                                     │                                      │
    ///            │                                     │                           ┌────────────────────┐
    /// ┌────────────────────┐                ┌────────────────────┐                 │        Scan        │
    /// │        Scan        │                │        Scan        │                 │  filter=(t.b > 5)  │
    /// └────────────────────┘                │  filter=(t.b > 5)  │                 │  projection=(t.a)  │
    ///                                       └────────────────────┘                 └────────────────────┘
    ///
    /// Initial Plan                  If `TableProviderFilterPushDown`           Projection pushdown notes that
    ///                               returns true, filter pushdown              the scan only needs t.a
    ///                               pushes the filter into the scan
    ///                                                                          BUT internally evaluating the
    ///                                                                          predicate still requires t.b
    /// ```
    ///
    /// # Limit
    ///
    /// If `limit` is specified, the scan must produce *at least* this many
    /// rows, though it may return more. Like Projection Pushdown and Filter
    /// Pushdown, DataFusion pushes `LIMIT`s as far down in the plan as
    /// possible. This is called "Limit Pushdown", and some sources can use the
    /// information to improve performance.
    ///
    /// Note: If any pushed-down filters are `Inexact`, the `LIMIT` cannot be
    /// pushed down. Inexact filters do not guarantee that every filtered row is
    /// removed, so applying the limit could leave too few rows to return in the
    /// final result.
    ///
    /// # Evaluation Order
    ///
    /// The logical evaluation order is `filters`, then `limit`, then
    /// `projection`.
    ///
    /// Note that `limit` applies to the filtered result, not to the unfiltered
    /// input, and `projection` affects only which columns are returned, not
    /// which rows qualify.
    ///
    /// For example, if a scan receives:
    ///
    /// - `projection = [a]`
    /// - `filters = [b > 5]`
    /// - `limit = Some(3)`
    ///
    /// It must logically produce results equivalent to:
    ///
    /// ```text
    /// PROJECTION a (LIMIT 3 (SCAN WHERE b > 5))
    /// ```
    ///
    /// As noted above, columns referenced only by pushed-down filters may be
    /// absent from `projection`.
    async fn scan(
        &self,
        state: &dyn Session,
        projection: Option<&Vec<usize>>,
        filters: &[Expr],
        limit: Option<usize>,
    ) -> Result<Arc<dyn ExecutionPlan>>;

    /// Create an [`ExecutionPlan`] for scanning the table using structured arguments.
    ///
    /// This method uses [`ScanArgs`] to pass scan parameters in a structured way
    /// and returns a [`ScanResult`] containing the execution plan.
    ///
    /// Table providers can override this method to take advantage of additional
    /// parameters like the upcoming `preferred_ordering` that may not be available through
    /// other scan methods.
    ///
    /// # Arguments
    /// * `state` - The session state containing configuration and context
    /// * `args` - Structured scan arguments including projection, filters, limit, and ordering preferences
    ///
    /// # Returns
    /// A [`ScanResult`] containing the [`ExecutionPlan`] for scanning the table
    ///
    /// See [`Self::scan`] for detailed documentation about projection, filters, and limits.
    async fn scan_with_args<'a>(
        &self,
        state: &dyn Session,
        args: ScanArgs<'a>,
    ) -> Result<ScanResult> {
        let filters = args.filters().unwrap_or(&[]);
        let projection = args.projection().map(|p| p.to_vec());
        let limit = args.limit();
        let plan = self
            .scan(state, projection.as_ref(), filters, limit)
            .await?;
        Ok(plan.into())
    }

    /// Specify if DataFusion should provide filter expressions to the
    /// TableProvider to apply *during* the scan.
    ///
    /// Some TableProviders can evaluate filters more efficiently than the
    /// `Filter` operator in DataFusion, for example by using an index.
    ///
    /// # Parameters and Return Value
    ///
    /// The return `Vec` must have one element for each element of the `filters`
    /// argument. The value of each element indicates if the TableProvider can
    /// apply the corresponding filter during the scan. The position in the return
    /// value corresponds to the expression in the `filters` parameter.
    ///
    /// If the length of the resulting `Vec` does not match the `filters` input
    /// an error will be thrown.
    ///
    /// Each element in the resulting `Vec` is one of the following:
    /// * [`Exact`] or [`Inexact`]: The TableProvider can apply the filter
    /// during scan
    /// * [`Unsupported`]: The TableProvider cannot apply the filter during scan
    ///
    /// By default, this function returns [`Unsupported`] for all filters,
    /// meaning no filters will be provided to [`Self::scan`].
    ///
    /// [`Unsupported`]: TableProviderFilterPushDown::Unsupported
    /// [`Exact`]: TableProviderFilterPushDown::Exact
    /// [`Inexact`]: TableProviderFilterPushDown::Inexact
    /// # Example
    ///
    /// ```rust
    /// # use std::any::Any;
    /// # use std::sync::Arc;
    /// # use arrow::datatypes::SchemaRef;
    /// # use async_trait::async_trait;
    /// # use datafusion_catalog::{TableProvider, Session};
    /// # use datafusion_common::Result;
    /// # use datafusion_expr::{Expr, TableProviderFilterPushDown, TableType};
    /// # use datafusion_physical_plan::ExecutionPlan;
    /// // Define a struct that implements the TableProvider trait
    /// #[derive(Debug)]
    /// struct TestDataSource {}
    ///
    /// #[async_trait]
    /// impl TableProvider for TestDataSource {
    /// # fn schema(&self) -> SchemaRef { todo!() }
    /// # fn table_type(&self) -> TableType { todo!() }
    /// # async fn scan(&self, s: &dyn Session, p: Option<&Vec<usize>>, f: &[Expr], l: Option<usize>) -> Result<Arc<dyn ExecutionPlan>> {
    ///         todo!()
    /// # }
    ///     // Override the supports_filters_pushdown to evaluate which expressions
    ///     // to accept as pushdown predicates.
    ///     fn supports_filters_pushdown(&self, filters: &[&Expr]) -> Result<Vec<TableProviderFilterPushDown>> {
    ///         // Process each filter
    ///         let support: Vec<_> = filters.iter().map(|expr| {
    ///           match expr {
    ///             // This example only supports a between expr with a single column named "c1".
    ///             Expr::Between(between_expr) => {
    ///                 between_expr.expr
    ///                 .try_as_col()
    ///                 .map(|column| {
    ///                     if column.name == "c1" {
    ///                         TableProviderFilterPushDown::Exact
    ///                     } else {
    ///                         TableProviderFilterPushDown::Unsupported
    ///                     }
    ///                 })
    ///                 // If there is no column in the expr set the filter to unsupported.
    ///                 .unwrap_or(TableProviderFilterPushDown::Unsupported)
    ///             }
    ///             _ => {
    ///                 // For all other cases return Unsupported.
    ///                 TableProviderFilterPushDown::Unsupported
    ///             }
    ///         }
    ///     }).collect();
    ///     Ok(support)
    ///     }
    /// }
    /// ```
    fn supports_filters_pushdown(
        &self,
        filters: &[&Expr],
    ) -> Result<Vec<TableProviderFilterPushDown>> {
        Ok(vec![
            TableProviderFilterPushDown::Unsupported;
            filters.len()
        ])
    }

    /// Get statistics for this table, if available
    /// Although not presently used in mainline DataFusion, this allows implementation specific
    /// behavior for downstream repositories, in conjunction with specialized optimizer rules to
    /// perform operations such as re-ordering of joins.
    fn statistics(&self) -> Option<Statistics> {
        None
    }

    /// Return an [`ExecutionPlan`] to insert data into this table, if
    /// supported.
    ///
    /// The returned plan should return a single row in a UInt64
    /// column called "count" such as the following
    ///
    /// ```text
    /// +-------+,
    /// | count |,
    /// +-------+,
    /// | 6     |,
    /// +-------+,
    /// ```
    ///
    /// # See Also
    ///
    /// See [`DataSinkExec`] for the common pattern of inserting a
    /// streams of `RecordBatch`es as files to an ObjectStore.
    ///
    /// [`DataSinkExec`]: datafusion_datasource::sink::DataSinkExec
    async fn insert_into(
        &self,
        _state: &dyn Session,
        _input: Arc<dyn ExecutionPlan>,
        _insert_op: InsertOp,
    ) -> Result<Arc<dyn ExecutionPlan>> {
        not_impl_err!("Insert into not implemented for this table")
    }

    /// Delete rows matching the filter predicates.
    ///
    /// Returns an [`ExecutionPlan`] producing a single row with `count` (UInt64).
    /// Empty `filters` deletes all rows.
    async fn delete_from(
        &self,
        _state: &dyn Session,
        _filters: Vec<Expr>,
    ) -> Result<Arc<dyn ExecutionPlan>> {
        not_impl_err!("DELETE not supported for {} table", self.table_type())
    }

    /// Update rows matching the filter predicates.
    ///
    /// Returns an [`ExecutionPlan`] producing a single row with `count` (UInt64).
    /// Empty `filters` updates all rows.
    async fn update(
        &self,
        _state: &dyn Session,
        _assignments: Vec<(String, Expr)>,
        _filters: Vec<Expr>,
    ) -> Result<Arc<dyn ExecutionPlan>> {
        not_impl_err!("UPDATE not supported for {} table", self.table_type())
    }

    /// Remove all rows from the table.
    ///
    /// Should return an [ExecutionPlan] producing a single row with count (UInt64),
    /// representing the number of rows removed.
    async fn truncate(&self, _state: &dyn Session) -> Result<Arc<dyn ExecutionPlan>> {
        not_impl_err!("TRUNCATE not supported for {} table", self.table_type())
    }
}

impl dyn TableProvider {
    /// Returns `true` if the table provider is of type `T`.
    ///
    /// Prefer this over `downcast_ref::<T>().is_some()`. Works correctly when
    /// called on `Arc<dyn TableProvider>` via auto-deref.
    pub fn is<T: TableProvider>(&self) -> bool {
        (self as &dyn Any).is::<T>()
    }

    /// Attempts to downcast this table provider to a concrete type `T`,
    /// returning `None` if the provider is not of that type.
    ///
    /// Works correctly when called on `Arc<dyn TableProvider>` via auto-deref,
    /// unlike `(&arc as &dyn Any).downcast_ref::<T>()` which would attempt to
    /// downcast the `Arc` itself.
    pub fn downcast_ref<T: TableProvider>(&self) -> Option<&T> {
        (self as &dyn Any).downcast_ref()
    }
}

/// Arguments for scanning a table with [`TableProvider::scan_with_args`].
#[derive(Debug, Clone, Default)]
pub struct ScanArgs<'a> {
    filters: Option<&'a [Expr]>,
    projection: Option<&'a [usize]>,
    limit: Option<usize>,
}

impl<'a> ScanArgs<'a> {
    /// Set the column projection for the scan.
    ///
    /// The projection is a list of column indices from [`TableProvider::schema`]
    /// that should be included in the scan results. If `None`, all columns are included.
    ///
    /// # Arguments
    /// * `projection` - Optional slice of column indices to project
    pub fn with_projection(mut self, projection: Option<&'a [usize]>) -> Self {
        self.projection = projection;
        self
    }

    /// Get the column projection for the scan.
    ///
    /// Returns a reference to the projection column indices, or `None` if
    /// no projection was specified (meaning all columns should be included).
    pub fn projection(&self) -> Option<&'a [usize]> {
        self.projection
    }

    /// Set the filter expressions for the scan.
    ///
    /// Filters are boolean expressions that should be evaluated during the scan
    /// to reduce the number of rows returned. All expressions are combined with AND logic.
    /// Whether filters are actually pushed down depends on [`TableProvider::supports_filters_pushdown`].
    ///
    /// # Arguments
    /// * `filters` - Optional slice of filter expressions
    pub fn with_filters(mut self, filters: Option<&'a [Expr]>) -> Self {
        self.filters = filters;
        self
    }

    /// Get the filter expressions for the scan.
    ///
    /// Returns a reference to the filter expressions, or `None` if no filters were specified.
    pub fn filters(&self) -> Option<&'a [Expr]> {
        self.filters
    }

    /// Set the maximum number of rows to return from the scan.
    ///
    /// If specified, the scan should return at most this many rows. This is typically
    /// used to optimize queries with `LIMIT` clauses.
    ///
    /// # Arguments
    /// * `limit` - Optional maximum number of rows to return
    pub fn with_limit(mut self, limit: Option<usize>) -> Self {
        self.limit = limit;
        self
    }

    /// Get the maximum number of rows to return from the scan.
    ///
    /// Returns the row limit, or `None` if no limit was specified.
    pub fn limit(&self) -> Option<usize> {
        self.limit
    }
}

/// Result of a table scan operation from [`TableProvider::scan_with_args`].
#[derive(Debug, Clone)]
pub struct ScanResult {
    /// The ExecutionPlan to run.
    plan: Arc<dyn ExecutionPlan>,
}

impl ScanResult {
    /// Create a new `ScanResult` with the given execution plan.
    ///
    /// # Arguments
    /// * `plan` - The execution plan that will perform the table scan
    pub fn new(plan: Arc<dyn ExecutionPlan>) -> Self {
        Self { plan }
    }

    /// Get a reference to the execution plan for this scan result.
    ///
    /// Returns a reference to the [`ExecutionPlan`] that will perform
    /// the actual table scanning and data retrieval.
    pub fn plan(&self) -> &Arc<dyn ExecutionPlan> {
        &self.plan
    }

    /// Consume this ScanResult and return the execution plan.
    ///
    /// Returns the owned [`ExecutionPlan`] that will perform
    /// the actual table scanning and data retrieval.
    pub fn into_inner(self) -> Arc<dyn ExecutionPlan> {
        self.plan
    }
}

impl From<Arc<dyn ExecutionPlan>> for ScanResult {
    fn from(plan: Arc<dyn ExecutionPlan>) -> Self {
        Self::new(plan)
    }
}

/// A factory which creates [`TableProvider`]s at runtime given a URL.
///
/// For example, this can be used to create a table "on the fly"
/// from a directory of files only when that name is referenced.
#[async_trait]
pub trait TableProviderFactory: Debug + Sync + Send {
    /// Create a TableProvider with the given url
    async fn create(
        &self,
        state: &dyn Session,
        cmd: &CreateExternalTable,
    ) -> Result<Arc<dyn TableProvider>>;
}

/// Describes arguments provided to the table function call.
pub struct TableFunctionArgs<'e, 's> {
    /// Call arguments.
    exprs: &'e [Expr],
    /// Session within which the function is called.
    session: &'s dyn Session,
}

impl<'e, 's> TableFunctionArgs<'e, 's> {
    /// Make a new [`TableFunctionArgs`].
    pub fn new(exprs: &'e [Expr], session: &'s dyn Session) -> Self {
        Self { exprs, session }
    }

    /// Get expressions passed as the called function arguments.
    pub fn exprs(&self) -> &'e [Expr] {
        self.exprs
    }

    /// Get a session where the table function is called.
    pub fn session(&self) -> &'s dyn Session {
        self.session
    }
}

/// A trait for table function implementations
pub trait TableFunctionImpl: Debug + Sync + Send + Any {
    /// Create a table provider
    #[deprecated(
        since = "53.0.0",
        note = "Implement `TableFunctionImpl::call_with_args` instead"
    )]
    fn call(&self, _exprs: &[Expr]) -> Result<Arc<dyn TableProvider>> {
        internal_err!(
            "TableFunctionImpl::call is not implemented. Implement TableFunctionImpl::call_with_args instead."
        )
    }

    /// Create a table provider
    fn call_with_args(&self, args: TableFunctionArgs) -> Result<Arc<dyn TableProvider>> {
        #[expect(deprecated)]
        self.call(args.exprs)
    }
}

/// A table that uses a function to generate data
#[derive(Clone, Debug)]
pub struct TableFunction {
    /// Name of the table function
    name: String,
    /// Function implementation
    fun: Arc<dyn TableFunctionImpl>,
}

impl TableFunction {
    /// Create a new table function
    pub fn new(name: String, fun: Arc<dyn TableFunctionImpl>) -> Self {
        Self { name, fun }
    }

    /// Get the name of the table function
    pub fn name(&self) -> &str {
        &self.name
    }

    /// Get the implementation of the table function
    pub fn function(&self) -> &Arc<dyn TableFunctionImpl> {
        &self.fun
    }

    /// Get the function implementation and generate a table
    #[deprecated(
        since = "53.0.0",
        note = "Use `TableFunction::create_table_provider_with_args` instead"
    )]
    pub fn create_table_provider(&self, args: &[Expr]) -> Result<Arc<dyn TableProvider>> {
        #[expect(deprecated)]
        self.fun.call(args)
    }

    /// Get the function implementation and generate a table
    pub fn create_table_provider_with_args(
        &self,
        args: TableFunctionArgs,
    ) -> Result<Arc<dyn TableProvider>> {
        self.fun.call_with_args(args)
    }
}