-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from azat-archive/SimpleAggregateFunction
Simple aggregate function
- Loading branch information
Showing
6 changed files
with
58 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
env: | ||
- VERSION=19.8.3.8 # SimpleAggregateFunction | ||
- VERSION=19.3.3 | ||
- VERSION=18.12.17 | ||
- VERSION=18.12.13 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
|
||
def create_simple_aggregate_function_column(spec, column_by_spec_getter): | ||
# SimpleAggregateFunction(Func, Type) -> Type | ||
inner = spec[24:-1].split(',')[1].strip() | ||
nested = column_by_spec_getter(inner) | ||
return nested |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from tests.testcase import BaseTestCase | ||
from tests.util import require_server_version | ||
|
||
|
||
class SimpleAggregateFunctionTestCase(BaseTestCase): | ||
@require_server_version(19, 8, 3) | ||
def test_simple(self): | ||
columns = 'a SimpleAggregateFunction(any, Int32)' | ||
|
||
data = [(3, ), (2, )] | ||
with self.create_table(columns): | ||
self.client.execute( | ||
'INSERT INTO test (a) VALUES', data | ||
) | ||
|
||
query = 'SELECT * FROM test' | ||
inserted = self.emit_cli(query) | ||
self.assertEqual( | ||
inserted, '3\n2\n' | ||
) | ||
|
||
inserted = self.client.execute(query) | ||
self.assertEqual(inserted, data) | ||
|
||
@require_server_version(19, 8, 3) | ||
def test_nullable(self): | ||
columns = 'a SimpleAggregateFunction(any, Nullable(Int32))' | ||
|
||
data = [(3, ), (None, ), (2, )] | ||
with self.create_table(columns): | ||
self.client.execute( | ||
'INSERT INTO test (a) VALUES', data | ||
) | ||
|
||
query = 'SELECT * FROM test' | ||
inserted = self.emit_cli(query) | ||
self.assertEqual( | ||
inserted, '3\n\\N\n2\n' | ||
) | ||
|
||
inserted = self.client.execute(query) | ||
self.assertEqual(inserted, data) |