@@ -748,51 +748,46 @@ export class BaseQuery {
748748
749749 // FIXME Temporary solution
750750 findPreAggregationForQueryRust ( ) {
751- if ( ! this . preAggregations . preAggregationForQuery ) {
752- let optionsOrder = this . options . order ;
753- if ( optionsOrder && ! Array . isArray ( optionsOrder ) ) {
754- optionsOrder = [ optionsOrder ] ;
755- }
756- const order = optionsOrder ? R . pipe (
757- R . map ( ( hash ) => ( ( ! hash || ! hash . id ) ? null : hash ) ) ,
758- R . reject ( R . isNil ) ,
759- ) ( optionsOrder ) : undefined ;
760-
761- const queryParams = {
762- measures : this . options . measures ,
763- dimensions : this . options . dimensions ,
764- segments : this . options . segments ,
765- timeDimensions : this . options . timeDimensions ,
766- timezone : this . options . timezone ,
767- joinGraph : this . joinGraph ,
768- cubeEvaluator : this . cubeEvaluator ,
769- order,
770- filters : this . options . filters ,
771- limit : this . options . limit ? this . options . limit . toString ( ) : null ,
772- rowLimit : this . options . rowLimit ? this . options . rowLimit . toString ( ) : null ,
773- offset : this . options . offset ? this . options . offset . toString ( ) : null ,
774- baseTools : this ,
775- ungrouped : this . options . ungrouped ,
776- exportAnnotatedSql : false ,
777- preAggregationQuery : this . options . preAggregationQuery
778- } ;
751+ let optionsOrder = this . options . order ;
752+ if ( optionsOrder && ! Array . isArray ( optionsOrder ) ) {
753+ optionsOrder = [ optionsOrder ] ;
754+ }
755+ const order = optionsOrder ? R . pipe (
756+ R . map ( ( hash ) => ( ( ! hash || ! hash . id ) ? null : hash ) ) ,
757+ R . reject ( R . isNil ) ,
758+ ) ( optionsOrder ) : undefined ;
779759
780- const buildResult = nativeBuildSqlAndParams ( queryParams ) ;
760+ const queryParams = {
761+ measures : this . options . measures ,
762+ dimensions : this . options . dimensions ,
763+ segments : this . options . segments ,
764+ timeDimensions : this . options . timeDimensions ,
765+ timezone : this . options . timezone ,
766+ joinGraph : this . joinGraph ,
767+ cubeEvaluator : this . cubeEvaluator ,
768+ order,
769+ filters : this . options . filters ,
770+ limit : this . options . limit ? this . options . limit . toString ( ) : null ,
771+ rowLimit : this . options . rowLimit ? this . options . rowLimit . toString ( ) : null ,
772+ offset : this . options . offset ? this . options . offset . toString ( ) : null ,
773+ baseTools : this ,
774+ ungrouped : this . options . ungrouped ,
775+ exportAnnotatedSql : false ,
776+ preAggregationQuery : this . options . preAggregationQuery
777+ } ;
781778
782- if ( buildResult . error ) {
783- if ( buildResult . error . cause === 'User' ) {
784- throw new UserError ( buildResult . error . message ) ;
785- } else {
786- throw new Error ( buildResult . error . message ) ;
787- }
788- }
779+ const buildResult = nativeBuildSqlAndParams ( queryParams ) ;
789780
790- const [ , , preAggregation ] = buildResult . result ;
791- if ( preAggregation ) {
792- this . preAggregations . preAggregationForQuery = preAggregation ;
781+ if ( buildResult . error ) {
782+ if ( buildResult . error . cause === 'User' ) {
783+ throw new UserError ( buildResult . error . message ) ;
784+ } else {
785+ throw new Error ( buildResult . error . message ) ;
793786 }
794787 }
795- return this . preAggregations . preAggregationForQuery ;
788+
789+ const [ , , preAggregation ] = buildResult . result ;
790+ return preAggregation ;
796791 }
797792
798793 allCubeMembers ( path ) {
0 commit comments