generated from finos/software-project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements to Elasticsearch aggregations (#1970)
- Loading branch information
Showing
11 changed files
with
280 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...ources/core_elasticsearch_execution_test/elasticsearch_plan_test_aggregation_average.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2023 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import meta::pure::test::*; | ||
import meta::pure::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::test::*; | ||
import meta::external::store::elasticsearch::executionTest::utils::*; | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test avg aggregation on Integer field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::avg::testAverageAggregationIntegerField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('avg', r | $r.getInteger('Budget'), agg | $agg->average()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test avg aggregation on Float field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::avg::testAverageAggregationFloatField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('avg', r | $r.getFloat('Revenue'), agg | $agg->average()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test avg aggregation on Number field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::avg::testAverageAggregationNumberField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('avg', r | $r.getNumber('Revenue'), agg | $agg->average()))); | ||
} |
36 changes: 36 additions & 0 deletions
36
...esources/core_elasticsearch_execution_test/elasticsearch_plan_test_aggregation_count.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2023 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import meta::pure::test::*; | ||
import meta::pure::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::test::*; | ||
import meta::external::store::elasticsearch::executionTest::utils::*; | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test count aggregation on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::count::testCountAggregation(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('count', r | $r.getString('MainActor.Name'), agg | $agg->count()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test count no result aggregation on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::count::testEmptyCountAggregation(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->filter(r | $r.getString('_id') == 'N/A')->groupBy([], agg('count', r | $r.getString('MainActor.Name'), agg | $agg->count()))); | ||
} |
52 changes: 52 additions & 0 deletions
52
.../resources/core_elasticsearch_execution_test/elasticsearch_plan_test_aggregation_max.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2023 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import meta::pure::test::*; | ||
import meta::pure::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::test::*; | ||
import meta::external::store::elasticsearch::executionTest::utils::*; | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test max aggregation on Integer field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::max::testMaxAggregationIntegerField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('max', r | $r.getInteger('Budget'), agg | $agg->max()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test max aggregation on Float field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::max::testMaxAggregationFloatField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('max', r | $r.getFloat('Revenue'), agg | $agg->max()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test max aggregation on Number field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::max::testMaxAggregationNumberField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('max', r | $r.getNumber('Revenue'), agg | $agg->max()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test max aggregation no result on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::max::testEmptyMaxAggregation(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->filter(r | $r.getString('_id') == 'N/A')->groupBy([], agg('max', r | $r.getNumber('Revenue'), agg | $agg->max()))); | ||
} |
53 changes: 53 additions & 0 deletions
53
.../resources/core_elasticsearch_execution_test/elasticsearch_plan_test_aggregation_min.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2023 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import meta::pure::test::*; | ||
import meta::pure::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::test::*; | ||
import meta::external::store::elasticsearch::executionTest::utils::*; | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test min aggregation on Integer field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::min::testMinAggregationIntegerField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('min', r | $r.getInteger('Budget'), agg | $agg->min()))); | ||
} | ||
|
||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test min aggregation on Float field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::min::testMinAggregationFloatField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('min', r | $r.getFloat('Revenue'), agg | $agg->min()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test min aggregation on Number field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::min::testMinAggregationNumberField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('min', r | $r.getNumber('Revenue'), agg | $agg->min()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test min aggregation no result on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::min::testEmptyMinAggregation(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->filter(r | $r.getString('_id') == 'N/A')->groupBy([], agg('min', r | $r.getNumber('Revenue'), agg | $agg->min()))); | ||
} |
52 changes: 52 additions & 0 deletions
52
.../resources/core_elasticsearch_execution_test/elasticsearch_plan_test_aggregation_sum.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2023 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import meta::pure::test::*; | ||
import meta::pure::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::*; | ||
import meta::external::store::elasticsearch::executionTest::testCase::tds::*; | ||
import meta::external::store::elasticsearch::executionTest::test::*; | ||
import meta::external::store::elasticsearch::executionTest::utils::*; | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test sum aggregation on Integer field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::sum::testSumAggregationIntegerField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('sum', r | $r.getInteger('Budget'), agg | $agg->sum()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test sum aggregation on Float field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::sum::testSumAggregationFloatField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('sum', r | $r.getFloat('Revenue'), agg | $agg->sum()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test sum aggregation on Number field on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::sum::testSumAggregationNumberField(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->groupBy([], agg('sum', r | $r.getNumber('Revenue'), agg | $agg->sum()))); | ||
} | ||
|
||
function | ||
<<paramTest.Test>> | ||
{doc.doc = 'Test sum aggregation no result on Elasticsearch'} | ||
meta::external::store::elasticsearch::executionTest::testCase::tds::groupBy::sum::testEmptySumAggregation(config:TestConfig[1]):Boolean[1] | ||
{ | ||
$config->testTdsExpression(x|$x->filter(r | $r.getString('_id') == 'N/A')->groupBy([], agg('sum', r | $r.getNumber('Revenue'), agg | $agg->sum()))); | ||
} |