diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-11-24 06:18:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-24 06:18:29 +0300 |
commit | bd0de0c5979de6091d7399f6ec70de0875c45048 (patch) | |
tree | f2fbe88c63de8cd0fe46bbc989e2656dd37ad643 /core/DataAccess | |
parent | b136e24f399be080ed6ac7f7c060323fccba5081 (diff) |
In LogAggregator, allow the use of a complex dimension w/ an already defined select as. (#13729)
* In LogAggregator, allow the use of a complex dimension w/ an already defined select as.
* Add integration test for change.
Diffstat (limited to 'core/DataAccess')
-rw-r--r-- | core/DataAccess/LogAggregator.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index ac87149c69..1801fa207e 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -423,6 +423,7 @@ class LogAggregator * @param $dimensions * @param $tableName * @param bool $appendSelectAs + * @param bool $parseSelectAs * @return mixed */ protected function getSelectDimensions($dimensions, $tableName, $appendSelectAs = true) @@ -432,11 +433,15 @@ class LogAggregator if (!is_numeric($selectAs)) { $selectAsString = $selectAs; - } else { - // if function, do not alias or prefix - if ($this->isFieldFunctionOrComplexExpression($field)) { - $selectAsString = $appendSelectAs = false; + } else if ($this->isFieldFunctionOrComplexExpression($field)) { + // if complex expression has a select as, use it + if (!$appendSelectAs && preg_match('/\s+AS\s+(.*?)\s*$/', $field, $matches)) { + $field = $matches[1]; + continue; } + + // if function w/o select as, do not alias or prefix + $selectAsString = $appendSelectAs = false; } $isKnownField = !in_array($field, array('referrer_data')); |