Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: test case file format for aggregate functions #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scgkiran
Copy link
Owner

@scgkiran scgkiran commented Nov 6, 2024

max([20, -3, 1, -10, 0, 5]::i8) = 20::i8

corr([20, -3, 1, 10, 5]::fp32, [20, -3, 1, 10, 5]::fp32) = 1::fp64

some_agg_func([30, 3, 1, 10]::i32, ['app', 'bat', 'cat', 'dog']::string) = 30::i8

@jacques-n
Copy link

It doesn't work well with multi argument aggregates. Maybe we need to declare a table of data and then refer to in test cases? Other thoughts on multi args

@scgkiran
Copy link
Owner Author

scgkiran commented Nov 6, 2024

It doesn't work well with multi argument aggregates. Maybe we need to declare a table of data and then refer to in test cases? Other thoughts on multi args

Option1:
corr([20, -3, 1, 10, 5]::fp32, [20, -3, 1, 10, 5]::fp32) = 1::fp64

In the parsing we could check both columns have same number of elements.

Option2:
corr([(20, 20), (-3, -3), (1, 1), (10,10), (5,5)]::Table(fp32, fp32)) = 1::fp64

@scgkiran
Copy link
Owner Author

scgkiran commented Nov 7, 2024

Option3:

DEFINE TABLE test_table WITH SCHEMA (x fp32, y fp32) AS 
     VALUES [(20, 20), (-3, -3), (1, 1), (10, 10), (5, 5)];

# basic tests of corr
corr(test_table.x, test_table.y) = 1::fp64

# basic tests of mean
mean(test_table.x) = 6.6::fp64
mean(test_table.y) = 6.6::fp64

@jacques-n
Copy link

How about we start with supporting these and reexamine how we're enjoying them in 3-6 months?

multi-reference
DEFINE t1(fp32, fp32) = ((20, 20), (-3, -3), (1, 1), (10,10), (5,5))
corr(t1.col0, t1.col1) = 1::fp64

compact
((20, 20), (-3, -3), (1, 1), (10,10), (5,5)) corr(col0::fp32, col1::fp32) = 1::fp64

supercompact (single argument only)
avg((1,2,3)::fp32) = 1::fp64

@jacques-n
Copy link

How we might support a function that takes a aggregate reference and a constant value.

((20), (-3), (1), (10)) LIST_AGG(col0::fp32, ','::string) = 1::fp64

Single-valued arguments are passed in a direct literals. Multi-valued are passed as references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants