Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IndexBuilder to enable configuration of indexes #8

Closed
Tracked by #1
Max-Meldrum opened this issue Jul 31, 2024 · 0 comments
Closed
Tracked by #1

Add IndexBuilder to enable configuration of indexes #8

Max-Meldrum opened this issue Jul 31, 2024 · 0 comments
Assignees
Labels

Comments

@Max-Meldrum
Copy link
Collaborator

Define the API to build wheel indices.

Current approach:

/// Builder for creating wheel indices
pub struct IndexBuilder {
  /// The column to build the wheel index on
  pub col: Column,
  /// The type of aggregation to use
  pub agg_type: AggregateType,
  /// Optional filter to apply to the column
  pub filter: Option<Expr>,
  /// Wheel configuration
  pub conf: HawConf,
}

// Build an index on fare_amount column using SUM() where id equals to ´1`
let builder = IndexBuilder::with_col_and_aggregate("fare_amount", AggregateType::Sum)
  .with_filter(col("id").eq(lit(1)));

// Add the index to the optimizer
optimizer.build_index(builder).await?;

// which would then enable the following query to execute through our index.
let sum_plan = ctx
   .sql(
    "SELECT SUM(fare_amount) FROM yellow_tripdata
     WHERE tpep_dropoff_datetime >= '2022-01-01T00:00:00Z'
     AND tpep_dropoff_datetime < '2022-02-01T00:00:00Z'
     AND id  = 1",
   ).await?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant