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

wasm: ordering issue in concat #3252

Closed
srenatus opened this issue Mar 11, 2021 · 3 comments
Closed

wasm: ordering issue in concat #3252

srenatus opened this issue Mar 11, 2021 · 3 comments
Labels

Comments

@srenatus
Copy link
Contributor

This is one we cannot fix by comparing using #3244...

$ opa eval -t rego  'concat(",", { "3", "2", "1" })' --format=pretty
"1,2,3"

$ opa eval -t wasm  'concat(",", { "3", "2", "1" })' --format=pretty
"3,2,1"
@tsandall
Copy link
Member

I think the issue here is that the set implementation does not retain the insertion order...so the iteration order is determined by the hash table. I don't think we want to guarantee that insertion order is used for iteration because it's harder to optimize #2569. Given this, I don't think we should treat this as a bug.

@srenatus
Copy link
Contributor Author

Agreed. I suppose these are wasm/rego differences we'll have to live with.

@srenatus
Copy link
Contributor Author

Anyone running into this should consider using an array instead. concat will accept both, and array iteration order is not implementation-dependent. (https://www.openpolicyagent.org/docs/latest/policy-reference/#strings)

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

No branches or pull requests

2 participants