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

Document polymorphic table functions not preserving row ordering #14505

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

jhlodin
Copy link
Contributor

@jhlodin jhlodin commented Oct 6, 2022

Description

See #14401 (review) for context

Non-technical explanation

Polymorphic table functions don't preserve row ordering, so this PR documents that limitation

Release notes

(z) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@martint
Copy link
Member

martint commented Oct 7, 2022

This is not a limitation. It's just how the SQL language works. The ORDER BY clause is a clause for the polymorphic table function, not for the query. It's for sorting inputs to the table function, but has no bearing or relationship to how the outputs of the table function come out. In a way, it's similar to ORDER BY appearing in window functions or subqueries.

@findepi
Copy link
Member

findepi commented Oct 7, 2022

This is not a limitation. It's just how the SQL language works.

i know and you know i know.

Still, some users were seen doing

SELECT * FORM TABLE ( catalog.system.query(' ... ORDER BY ...'))

and it's good to explain them that it's kind of pointless.
especially that, for some connectors, under some circumstances, this may actually return results sorted, so a user may concluded based on observations, that this works as they want

@martint
Copy link
Member

martint commented Oct 7, 2022

Oh, that's different. I thought it was referring to the ORDER BY clause in the polymorphic table function invocation:

SELECT * FROM TABLE(table_function(
    input => TABLE(...) ORDER BY ...
))

In that case, yes, I agree with @findepi. This should go in the documentation for the specific table functions.

@jhlodin jhlodin force-pushed the jl/ptf-sort-warning branch from d0bbfc0 to e5ff019 Compare October 12, 2022 19:00
@jhlodin
Copy link
Contributor Author

jhlodin commented Oct 12, 2022

Reworked to include this note as a fragment in the query table function sections of applicable connectors, PTAL.

@jhlodin jhlodin requested a review from findepi October 12, 2022 19:01
@jhlodin jhlodin force-pushed the jl/ptf-sort-warning branch from e5ff019 to e01220e Compare October 13, 2022 15:23
@jhlodin
Copy link
Contributor Author

jhlodin commented Oct 13, 2022

This PR has been rebased to master and builds fine locally, so I'm not sure why checks are failing.

@jhlodin
Copy link
Contributor Author

jhlodin commented Oct 20, 2022

@findepi Have I addressed all feedback/can we merge this?

@jhlodin jhlodin force-pushed the jl/ptf-sort-warning branch from e01220e to 925ab4c Compare October 24, 2022 18:14
@electrum electrum merged commit c2bc2c0 into trinodb:master Oct 24, 2022
@jhlodin jhlodin deleted the jl/ptf-sort-warning branch October 24, 2022 18:16
@github-actions github-actions bot added this to the 401 milestone Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants