-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(tesseract): Basic pre-aggregations support #9434
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9434 +/- ##
==========================================
- Coverage 83.96% 80.27% -3.70%
==========================================
Files 230 395 +165
Lines 84004 97550 +13546
Branches 0 2278 +2278
==========================================
+ Hits 70536 78309 +7773
- Misses 13468 18933 +5465
- Partials 0 308 +308
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
be6e357
to
ccf4c02
Compare
2d7ac7e
to
37e2479
Compare
ccf4c02
to
09309d0
Compare
995c326
to
335c2ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 This is great!
const hasMultiStageMeasures = this.fullKeyQueryAggregateMeasures({ hasMultipliedForPreAggregation: true }).multiStageMembers.length > 0; | ||
this.canUseNativeSqlPlannerPreAggregation = hasMultiStageMeasures; | ||
} else { | ||
this.useNativePreAggregations = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this property set in other cases? It's a class property and should be initialized in the constructor or at least defined. I know, this is JS which never complains, but let's follow a more right approach.
@@ -289,6 +289,12 @@ export class BaseQuery { | |||
}).filter(R.identity).map(this.newTimeDimension.bind(this)); | |||
this.allFilters = this.timeDimensions.concat(this.segments).concat(this.filters); | |||
this.useNativeSqlPlanner = this.options.useNativeSqlPlanner ?? getEnv('nativeSqlPlanner'); | |||
if (this.useNativeSqlPlanner) { | |||
const hasMultiStageMeasures = this.fullKeyQueryAggregateMeasures({ hasMultipliedForPreAggregation: true }).multiStageMembers.length > 0; | |||
this.canUseNativeSqlPlannerPreAggregation = hasMultiStageMeasures; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this property set in other cases? It's a class property and should be initialized in the constructor or at least defined. I know, this is JS which never complains, but let's follow a more right approach.
@@ -471,6 +477,19 @@ export class BaseQuery { | |||
} | |||
|
|||
newDimension(dimensionPath) { | |||
if (dimensionPath instanceof String || typeof dimensionPath === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (dimensionPath instanceof String || typeof dimensionPath === 'string') { | |
if (typeof dimensionPath === 'string') { |
There is no need in instanceof
check. Because instanceof String
catches only objects created as new String('abc')
, and such objects are almost never used in practice.
@@ -471,6 +477,19 @@ export class BaseQuery { | |||
} | |||
|
|||
newDimension(dimensionPath) { | |||
if (dimensionPath instanceof String || typeof dimensionPath === 'string') { | |||
const memberArr = Array.isArray(dimensionPath) ? dimensionPath : dimensionPath.split('.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dimensionPath
will never be an Array here, because you just checked it for a string! %)
this.cubeEvaluator.isDimension(memberArr.slice(0, -2))) { | ||
return this.newTimeDimension( | ||
{ | ||
dimension: this.cubeEvaluator.pathFromArray(memberArr.slice(0, -2)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need to call cubeEvaluator.pathFromArray
here as you already have a dimensionPath as an array. it's a useless turnaround.
rewrited_multistage: &mut HashMap<String, bool>, | ||
pre_aggregation: &Rc<CompiledPreAggregation>, | ||
) -> Result<(), CubeError> { | ||
if let Some(rewrited) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if let Some(rewrited) = | |
if let Some(rewritten) = |
} | ||
} | ||
|
||
fn is_schema_and_filters_match( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn is_schema_and_filters_match( | |
fn do_schema_and_filters_match( |
@@ -76,3 +76,13 @@ pub fn collect_cube_names(node: &Rc<MemberSymbol>) -> Result<Vec<String>, CubeEr | |||
visitor.apply(node, &())?; | |||
Ok(visitor.extract_result()) | |||
} | |||
|
|||
pub fn collect_cube_names_from_vec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn collect_cube_names_from_vec( | |
pub fn collect_cube_names_from_members( |
definition: Rc<dyn DimensionDefinition>, | ||
is_reference: bool, // Is symbol is direct reference to another symbol without any calculations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_reference: bool, // Is symbol is direct reference to another symbol without any calculations | |
is_reference: bool, // Symbol is a direct reference to another symbol without any calculations |
@@ -241,6 +247,13 @@ impl SymbolFactory for DimensionSymbolFactory { | |||
} else { | |||
None | |||
}; | |||
|
|||
let is_sql_is_direct_ref = if let Some(sql) = &sql { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let is_sql_is_direct_ref = if let Some(sql) = &sql { | |
let is_sql_direct_ref = if let Some(sql) = &sql { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 This is great! However there are some places need fixing
Check List