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

In Graph API, how to transform the outcome from a windowing function to non-grouped value #1628

Open
revozhang opened this issue Feb 8, 2023 · 8 comments
Assignees

Comments

@revozhang
Copy link

I have the following graph

{
	node1: {
		type: 'operator',
		nodeType: 'window',
		props: {
			type: 'tumblingwindow',
			unit: 'ss',
			size: 10,
		},
	},
}, {
	node2: {
		type: 'operator',
		nodeType: 'aggfunc',
		props: {
			expr: 'avg(value)',
		},
	},
}, {
	node3: {
		type: 'operator',
		nodeType: 'function',
		props: {
			expr: 'abs(avg)',
		},
	},
},

but got error message saying:

collection type mismatch, expect non-grouped collection, got grouped collection

Can I use a pick operator to select the first element of the collection? Thanks.

@revozhang
Copy link
Author

Update
I replaced node3 with a script node trying to process the avg value:

node3: {
                type: 'operator',
                nodeType: 'script',
                props: {
                  script:
                    'function exec(msg, meta) { return msg.avg}',
                  isAgg: true,
                },
              }

Now the error message says:

input type mismatch, expect row, got collection

@ngjaying ngjaying self-assigned this Feb 9, 2023
@revozhang
Copy link
Author

Hi, @ngjaying thank you for looking into this. Do you have a solution for this now or is it coming? I was trying to implement my own function plugin to covert the collection into a row, but it seems to be a circle. In order to consume the data from the window function, my function needs to declare IsAggregate() true. Thus my function becomes one that outputs collection again. Is there a way to get around this dilemma? Thanks!

@ngjaying
Copy link
Collaborator

Sorry, I don't have time to look into this deeply. I don't think we have the mechanism to convert collection back into one row now.

@revozhang
Copy link
Author

OK. Do you have any tips how I should go ahead and implement it? As mentioned above, if I declare IsAggregate true for my function, does it mean my function only accept collection and only output collection too? Thanks!

@ngjaying
Copy link
Collaborator

OK. Do you have any tips how I should go ahead and implement it? As mentioned above, if I declare IsAggregate true for my function, does it mean my function only accept collection and only output collection too? Thanks!

Yes, this is the current design

@ghezzis
Copy link

ghezzis commented Jun 28, 2023

Hello,
thank you for this amazing project.
I was wondering if there is any update about this topic.

Thanks

@ngjaying
Copy link
Collaborator

There is no update on this issue. Welcome to share your ideas here.

@ngjaying
Copy link
Collaborator

This should be supported after implementing #2504

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

No branches or pull requests

3 participants