-
I am trying to figure out the correct way to map over an array using PartiQL Suppose I have the following environment
With PartiQL CLI we can see
With the following query, the value of
How might I rewrite this query to get an array of Something of the form
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Generally, mapping over an array -- Kotlin: elements.map { e -> fn(e) }
-- Rust: elements.map(|e| fn(e))
-- Python: fn(e) for e in elements
SELECT VALUE fn(e) FROM elemente AS e If you want to make a bag a list, then try |
Beta Was this translation helpful? Give feedback.
-
You got a nested list because your select value constructor was a list.
|
Beta Was this translation helpful? Give feedback.
-
Cast does not necessarily preserve original ordering from the collection from which a bag was created. That would be an implementation detail; whereas the specification states that FROM always returns a bag. Now, I don't necessarily agree with this part of the spec. In my opinion, I think this |
Beta Was this translation helpful? Give feedback.
-
For you question, this is closed.
Answer
If you want to start a discussion about the specification, please open another topic with the relevant title. I hope we can get some traction on updating the spec to preserve ordering in the FROM clause. For reference
|
Beta Was this translation helpful? Give feedback.
For you question, this is closed.
Answer
If you want to start a discussion about the specification, please open another topic with the relevant title. I hope we can get some traction on updating the spec to preserve ordering in the FROM clause.
For reference