File tree Expand file tree Collapse file tree 3 files changed +40
-6
lines changed
cubesqlplanner/cubesqlplanner/src
logical_plan/optimizers/pre_aggregation Expand file tree Collapse file tree 3 files changed +40
-6
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,11 @@ impl<'a> DimensionMatcher<'a> {
185185 add_to_matched_dimension : bool ,
186186 ) -> Result < MatchState , CubeError > {
187187 let granularity = if self . pre_aggregation . allow_non_strict_date_range_match {
188- time_dimension. granularity ( ) . clone ( )
188+ if let Some ( granularity) = time_dimension. granularity_obj ( ) {
189+ granularity. min_granularity ( ) ?
190+ } else {
191+ time_dimension. granularity ( ) . clone ( )
192+ }
189193 } else {
190194 time_dimension. rollup_granularity ( self . query_tools . clone ( ) ) ?
191195 } ;
Original file line number Diff line number Diff line change @@ -80,16 +80,22 @@ impl GranularityHelper {
8080
8181 pub fn granularity_from_interval ( interval : & Option < String > ) -> Option < String > {
8282 if let Some ( interval) = interval {
83- if interval. contains ( "day" ) {
83+ if interval. contains ( "second" ) {
84+ Some ( "second" . to_string ( ) )
85+ } else if interval. contains ( "minute" ) {
86+ Some ( "minute" . to_string ( ) )
87+ } else if interval. contains ( "hour" ) {
88+ Some ( "hour" . to_string ( ) )
89+ } else if interval. contains ( "day" ) {
90+ Some ( "day" . to_string ( ) )
91+ } else if interval. contains ( "week" ) {
8492 Some ( "day" . to_string ( ) )
8593 } else if interval. contains ( "month" ) {
8694 Some ( "month" . to_string ( ) )
95+ } else if interval. contains ( "quarter" ) {
96+ Some ( "month" . to_string ( ) )
8797 } else if interval. contains ( "year" ) {
8898 Some ( "year" . to_string ( ) )
89- } else if interval. contains ( "week" ) {
90- Some ( "week" . to_string ( ) )
91- } else if interval. contains ( "hour" ) {
92- Some ( "hour" . to_string ( ) )
9399 } else {
94100 None
95101 }
You can’t perform that action at this time.
0 commit comments