Skip to content

Add table function to select table except specified columns#13680

Closed
ebyhr wants to merge 1 commit intotrinodb:masterfrom
ebyhr:ebi/ptf-except-column
Closed

Add table function to select table except specified columns#13680
ebyhr wants to merge 1 commit intotrinodb:masterfrom
ebyhr:ebi/ptf-except-column

Conversation

@ebyhr
Copy link
Copy Markdown
Member

@ebyhr ebyhr commented Aug 15, 2022

Description

Add table function to select table except specified columns

Example usage:

trino> SELECT * FROM tpch.tiny.region;
 regionkey |    name     |                                                       comment
-----------+-------------+---------------------------------------------------------------------------------------------------------------------
         0 | AFRICA      | lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to
         1 | AMERICA     | hs use ironic, even requests. s
         2 | ASIA        | ges. thinly even pinto beans ca
         3 | EUROPE      | ly final courts cajole furiously final excuse
         4 | MIDDLE EAST | uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl

trino> SELECT * FROM
    ->            TABLE(
    ->              system.runtime.except_column(
    ->                input => 'tpch.tiny.region',
    ->                except_column => array['comment']
    ->              )
    ->            );
 regionkey |    name
-----------+-------------
         0 | AFRICA
         1 | AMERICA
         2 | ASIA
         3 | EUROPE
         4 | MIDDLE EAST

Reference

Documentation

( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
( ) Release notes entries required with the following suggested text:

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

@ebyhr ebyhr added enhancement New feature or request syntax-needs-review labels Aug 15, 2022
@cla-bot cla-bot Bot added the cla-signed label Aug 15, 2022
@ebyhr ebyhr force-pushed the ebi/ptf-except-column branch 5 times, most recently from 760556c to d642fd5 Compare August 22, 2022 01:39
@ebyhr ebyhr marked this pull request as ready for review August 22, 2022 01:41
Copy link
Copy Markdown
Member

@martint martint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be implemented using a TABLE parameter to the table function, not a string that represents a table name. That way, it will work for any table-producing subquery.

The syntax for the example above should be:

SELECT *
FROM TABLE (
    system.runtime.except_column(
        input => TABLE (tpch.tiny.region),
        except_column => array['comment']
    )
)

Also, it should work for:

SELECT *
FROM TABLE (
    system.runtime.except_column(
        input => TABLE (SELECT * FROM tpch.tiny.region WHERE regionkey = 1),
        except_column => array['comment']
    )
)

Unfortunately, TABLE inputs are not yet supported — it’s still work in progress.

@ebyhr
Copy link
Copy Markdown
Member Author

ebyhr commented Nov 21, 2022

I will update this PR once TABLE inputs are supported.

@ebyhr
Copy link
Copy Markdown
Member Author

ebyhr commented Mar 16, 2023

Superseded by #16584

@ebyhr ebyhr closed this Mar 16, 2023
@ebyhr ebyhr deleted the ebi/ptf-except-column branch March 16, 2023 13:28
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.

2 participants