Skip to content

Commit

Permalink
in work
Browse files Browse the repository at this point in the history
  • Loading branch information
waralexrom committed Nov 27, 2024
1 parent 58734ba commit 8503379
Show file tree
Hide file tree
Showing 17 changed files with 325 additions and 90 deletions.
4 changes: 2 additions & 2 deletions packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ export class BaseQuery {
offset = offset || 'end';
return this.timeDimensions.map(
d => [d, (dateFrom, dateTo, dateField, dimensionDateFrom, dimensionDateTo, isFromStartToEnd) => {
console.log("!!!!!! IsFromStartToEnd: ", isFromStartToEnd, " --");
// dateFrom based window
const conditions = [];
if (trailingInterval !== 'unbounded') {
Expand Down Expand Up @@ -1408,7 +1409,6 @@ export class BaseQuery {
) || undefined
);
const baseQueryAlias = this.cubeAlias('base');
console.log("!!! date join contdition: ", dateJoinCondition);
const dateJoinConditionSql =
dateJoinCondition.map(
([d, f]) => f(
Expand Down Expand Up @@ -3263,7 +3263,7 @@ export class BaseQuery {
group_by_exprs: '{{ group_by | map(attribute=\'index\') | join(\', \') }}',
join: '{{ join_type }} JOIN {{ source }} ON {{ condition }}',
cte: '{{ alias }} AS ({{ query | indent(2, true) }})',
time_seria_select: 'SELECT date_from::timestamp AS "date_from",\n' +
time_series_select: 'SELECT date_from::timestamp AS "date_from",\n' +
'date_to::timestamp AS "date_to" \n' +
'FROM(\n' +
' VALUES ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub struct TimeShiftReference {

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct RollingWindow {
trailing: Option<String>,
leading: Option<String>,
offset: Option<String>,
pub trailing: Option<String>,
pub leading: Option<String>,
pub offset: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
143 changes: 114 additions & 29 deletions rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs
Original file line number Diff line number Diff line change
@@ -1,76 +1,139 @@
use super::{time_seria, Schema, SingleAliasedSource};
use super::{time_series, Schema, SingleAliasedSource};

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build native Linux 20 x86_64-unknown-linux-gnu Python fallback

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.9

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python fallback

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.12

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python fallback

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python fallback

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.9

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.10

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.11

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.9

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.12

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.11

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.10

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.12

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 aarch64-apple-darwin 20.x with Python fallback

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 x86_64-apple-darwin 20.x with Python fallback

unused import: `time_series`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

View workflow job for this annotation

GitHub Actions / Build windows-2019 20.x with Python fallback

unused import: `time_series`
use crate::planner::sql_templates::PlanSqlTemplates;
use crate::planner::{BaseJoinCondition, BaseMember, VisitorContext};
use cubenativeutils::CubeError;

use std::rc::Rc;

pub struct RollingWindowJoinCondition {
tailing_interval: Option<String>,
data_source: String,
time_series_source: String,
trailing_interval: Option<String>,
leading_interval: Option<String>,
offset: String,
is_from_start_to_end: bool,
time_dimension: Vec<Rc<BaseMember>>,
time_dimension: Rc<dyn BaseMember>,
}

impl RollingWindowJoinCondition {
pub fn new(
data_source: String,
time_series_source: String,
trailing_interval: Option<String>,
leading_interval: Option<String>,
offset: String,
is_from_start_to_end: bool,
dimensions: Vec<Rc<BaseMember>>,
time_dimension: Rc<dyn BaseMember>,
) -> Self {
Self {
tailing_interval,
data_source,
time_series_source,
trailing_interval,
leading_interval,
offset,
is_from_start_to_end,
time_dimension,
}
}

/*
*
offset = offset || 'end';
return this.timeDimensions.map(
d => [d, (dateFrom, dateTo, dateField, dimensionDateFrom, dimensionDateTo, isFromStartToEnd) => {
// dateFrom based window
const conditions = [];
if (trailingInterval !== 'unbounded') {
const startDate = isFromStartToEnd || offset === 'start' ? dateFrom : dateTo;
const trailingStart = trailingInterval ? this.subtractInterval(startDate, trailingInterval) : startDate;
const sign = offset === 'start' ? '>=' : '>';
conditions.push(`${dateField} ${sign} ${trailingStart}`);
}
if (leadingInterval !== 'unbounded') {
const endDate = isFromStartToEnd || offset === 'end' ? dateTo : dateFrom;
const leadingEnd = leadingInterval ? this.addInterval(endDate, leadingInterval) : endDate;
const sign = offset === 'end' ? '<=' : '<';
conditions.push(`${dateField} ${sign} ${leadingEnd}`);
}
return conditions.length ? conditions.join(' AND ') : '1 = 1';
}]
);
*/
pub fn to_sql(
&self,
templates: &PlanSqlTemplates,
context: Rc<VisitorContext>,
schema: Rc<Schema>,
) -> Result<String, CubeError> {
let result = if self.dimensions.is_empty() {
format!("1 = 1")
let mut conditions = vec![];
/* let date_column_alias = if let Some(column) = schema.find_column_for_member(&self.time_dimension.full_name(), &None) {
templates.column_reference(&source, &column.alias.clone())
} else {
let conditions = vec![];
self.dimensions
.iter()
.map(|dim| -> Result<String, CubeError> {
if let Some(trailing_interval) = self.trailing_interval {
if tailing_interval == "unbounded" {
let seria_column = "date_from",
}
}
dimension.to_sql(context.clone(), schema.clone())
} */
let date_column_alias =
self.resolve_time_column_alias(templates, context.clone(), schema.clone())?;
if let Some(trailing_interval) = &self.trailing_interval {
if trailing_interval != "unbounded" {
let start_date = if self.offset == "start" {
templates
.column_reference(&Some(self.time_series_source.clone()), "date_from")?
} else {
templates.column_reference(&Some(self.time_series_source.clone()), "date_to")?
};

let trailing_start = if let Some(trailing_interval) = &self.trailing_interval {
format!("{start_date} - interval '{trailing_interval}'")
} else {
start_date
};

})
.collect::<Result<Vec<_>, _>>()?
.join(" AND ")
let sign = if self.offset == "start" { ">=" } else { ">" };

conditions.push(format!("{date_column_alias} {sign} {trailing_start}"));
}
}

if let Some(leading_interval) = &self.trailing_interval {
if leading_interval != "unbounded" {
let end_date = if self.offset == "end" {
templates.column_reference(&Some(self.time_series_source.clone()), "date_to")?
} else {
templates
.column_reference(&Some(self.time_series_source.clone()), "date_from")?
};

let leading_end = if let Some(leading_interval) = &self.leading_interval {
format!("{end_date} + interval '{leading_interval}'")
} else {
end_date
};

let sign = if self.offset == "end" { "<=" } else { "<" };

conditions.push(format!("{date_column_alias} {sign} {leading_end}"));
}
}

let result = if conditions.is_empty() {
templates.always_true()?
} else {
conditions.join(" AND ")
};
Ok(result)
}

fn resolve_member_alias(
fn resolve_time_column_alias(
&self,
templates: &PlanSqlTemplates,
context: Rc<VisitorContext>,
source: &String,
dimension: &Rc<dyn BaseMember>,
schema: Rc<Schema>,
) -> Result<String, CubeError> {
let schema = schema.extract_source_schema(source);
let source = Some(source.clone());
if let Some(column) = schema.find_column_for_member(&dimension.full_name(), &source) {
let schema = schema.extract_source_schema(&self.data_source);
let source = Some(self.data_source.clone());
if let Some(column) =
schema.find_column_for_member(&self.time_dimension.full_name(), &source)
{
templates.column_reference(&source, &column.alias.clone())
} else {
dimension.to_sql(context.clone(), schema.clone())
self.time_dimension.to_sql(context.clone(), schema.clone())
}
}
}
Expand Down Expand Up @@ -162,6 +225,7 @@ impl DimensionJoinCondition {
pub enum JoinCondition {
DimensionJoinCondition(DimensionJoinCondition),
BaseJoinCondition(Rc<dyn BaseJoinCondition>),
RollingWindowJoinCondition(RollingWindowJoinCondition),
}

impl JoinCondition {
Expand All @@ -179,6 +243,24 @@ impl JoinCondition {
))
}

pub fn new_rolling_join(
data_source: String,
time_series_source: String,
trailing_interval: Option<String>,
leading_interval: Option<String>,
offset: String,
time_dimension: Rc<dyn BaseMember>,
) -> Self {
Self::RollingWindowJoinCondition(RollingWindowJoinCondition::new(
data_source,
time_series_source,
trailing_interval,
leading_interval,
offset,
time_dimension,
))
}

pub fn new_base_join(base: Rc<dyn BaseJoinCondition>) -> Self {
Self::BaseJoinCondition(base)
}
Expand All @@ -192,6 +274,9 @@ impl JoinCondition {
match &self {
JoinCondition::DimensionJoinCondition(cond) => cond.to_sql(templates, context, schema),
JoinCondition::BaseJoinCondition(cond) => cond.to_sql(context, schema),
JoinCondition::RollingWindowJoinCondition(cond) => {
cond.to_sql(templates, context, schema)
}
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions rust/cubesqlplanner/cubesqlplanner/src/plan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ pub mod order;
pub mod query_plan;
pub mod schema;
pub mod select;
pub mod time_seria;
pub mod time_series;
pub mod union;

pub use builder::{JoinBuilder, SelectBuilder};
pub use cte::Cte;
pub use expression::{Expr, MemberExpression};
pub use filter::{Filter, FilterGroup, FilterItem};
pub use from::{From, FromSource, SingleAliasedSource, SingleSource};
pub use join::{Join, JoinCondition, JoinItem};
pub use join::{Join, JoinCondition, JoinItem, RollingWindowJoinCondition};
pub use order::OrderBy;
pub use query_plan::QueryPlan;
pub use schema::{Schema, SchemaColumn, SchemaCube};
pub use select::{AliasedExpr, Select};
pub use time_seria::TimeSeria;
pub use time_series::TimeSeries;
pub use union::Union;

8 changes: 4 additions & 4 deletions rust/cubesqlplanner/cubesqlplanner/src/plan/query_plan.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
use super::{Schema, Select, TimeSeria, Union};
use super::{Schema, Select, TimeSeries, Union};
use crate::planner::sql_templates::PlanSqlTemplates;
use cubenativeutils::CubeError;
use std::rc::Rc;

pub enum QueryPlan {
Select(Rc<Select>),
Union(Rc<Union>),
TimeSeria(Rc<TimeSeria>),
TimeSeries(Rc<TimeSeries>),
}

impl QueryPlan {
pub fn make_schema(&self, self_alias: Option<String>) -> Schema {
match self {
QueryPlan::Select(select) => select.make_schema(self_alias),
QueryPlan::Union(union) => union.make_schema(self_alias),
QueryPlan::TimeSeria(seria) => seria.make_schema(self_alias),
QueryPlan::TimeSeries(series) => series.make_schema(self_alias),
}
}
pub fn to_sql(&self, templates: &PlanSqlTemplates) -> Result<String, CubeError> {
match self {
QueryPlan::Select(s) => s.to_sql(templates),
QueryPlan::Union(u) => u.to_sql(templates),
QueryPlan::TimeSeria(seria) => seria.to_sql(templates),
QueryPlan::TimeSeries(series) => series.to_sql(templates),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ use crate::planner::sql_templates::PlanSqlTemplates;
use cubenativeutils::CubeError;
use std::rc::Rc;

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build native Linux 20 x86_64-unknown-linux-gnu Python fallback

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.9

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python fallback

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.12

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python fallback

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python fallback

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.9

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.10

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.11

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.9

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.12

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.11

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.10

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.12

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 aarch64-apple-darwin 20.x with Python fallback

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 x86_64-apple-darwin 20.x with Python fallback

unused import: `std::rc::Rc`

Check warning on line 4 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build windows-2019 20.x with Python fallback

unused import: `std::rc::Rc`

pub struct TimeSeria {
pub struct TimeSeries {
pub time_dimension_name: String,
pub from_date: Option<String>,
pub to_date: Option<String>,
pub seria: Vec<Vec<String>>,
}

impl TimeSeria {
impl TimeSeries {
pub fn make_schema(&self, self_alias: Option<String>) -> Schema {

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build native Linux 20 x86_64-unknown-linux-gnu Python fallback

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.9

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python fallback

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.12

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python fallback

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python fallback

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.9

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.10

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.11

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.9

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.12

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.11

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.10

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.12

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 aarch64-apple-darwin 20.x with Python fallback

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 x86_64-apple-darwin 20.x with Python fallback

unused variable: `self_alias`

Check warning on line 14 in rust/cubesqlplanner/cubesqlplanner/src/plan/time_series.rs

View workflow job for this annotation

GitHub Actions / Build windows-2019 20.x with Python fallback

unused variable: `self_alias`
let column = SchemaColumn::new(
/* let column = SchemaColumn::new(
self_alias,
format!("from_date"),
self.time_dimension_name.clone(),
);
Schema::new(vec![column], vec![])
Schema::new(vec![column], vec![]) */
Schema::empty()
}

pub fn to_sql(&self, templates: &PlanSqlTemplates) -> Result<String, CubeError> {
templates.time_seria_select(
templates.time_series_select(
self.from_date.clone(),
self.to_date.clone(),
self.seria.clone(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::cube_bridge::measure_definition::{MeasureDefinition, TimeShiftReference};

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build native Linux 20 x86_64-unknown-linux-gnu Python fallback

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Check fmt/clippy

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.9

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python fallback

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x aarch64-unknown-linux-gnu with Python 3.12

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python fallback

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python fallback

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.9

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.10

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.11

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.9

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.12

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.11

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 20.x x86_64-unknown-linux-gnu with Python 3.10

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build Linux GNU 22.x x86_64-unknown-linux-gnu with Python 3.12

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 aarch64-apple-darwin 20.x with Python fallback

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build macos-13 x86_64-apple-darwin 20.x with Python fallback

unused import: `MeasureDefinition`

Check warning on line 1 in rust/cubesqlplanner/cubesqlplanner/src/planner/planners/multi_stage/member.rs

View workflow job for this annotation

GitHub Actions / Build windows-2019 20.x with Python fallback

unused import: `MeasureDefinition`
use crate::planner::sql_evaluator::EvaluationNode;
use crate::planner::BaseMember;
use crate::planner::BaseTimeDimension;
use cubenativeutils::CubeError;
use lazy_static::lazy_static;
Expand Down Expand Up @@ -61,15 +62,23 @@ impl MultiStageTimeShift {
#[derive(Clone)]
pub enum MultiStageLeafMemberType {
Measure,
TimeSeria(Rc<BaseTimeDimension>),
TimeSeries(Rc<BaseTimeDimension>),
}

#[derive(Clone)]
pub struct RollingWindowDescription {
pub time_dimension: Rc<dyn BaseMember>,
pub trailing: Option<String>,
pub leading: Option<String>,
pub offset: String,
}

#[derive(Clone)]
pub enum MultiStageInodeMemberType {
Rank,
Aggregate,
Calculate,
RollingWindow,
RollingWindow(RollingWindowDescription),
}

#[derive(Clone)]
Expand Down
Loading

0 comments on commit 8503379

Please sign in to comment.