You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Homer <lo...@gmail.com> on 2016/11/21 19:31:37 UTC

SELECT * expansion with system columns like ROWID

Hi all,

Have a question which is hopefully a simple answer.

We have a system column called ROWID.

We would like that when a SELECT * is executed that by delault the ROWID 
is not expanded.

We would like ROWID to only appear in a projection when ROWID is 
explicitly identified.

Is there a default way to do this with calcite SQLtypes?

thanks


Re: SELECT * expansion with system columns like ROWID

Posted by Julian Hyde <jh...@apache.org>.
There is an answer, but it’s not exactly simple. Calcite has the concept of “system fields” for exactly this. Note the method SqlToRelConverter.getSystemFields(), which by default returns an empty list, but which you could override to return a field called ROWID.

And then there is Join.getSystemFieldList(), which you can override if left and right inputs to the join have system fields and you want to control whether the join’s output also has a system field, or system fields.

But it’s not exactly simple. It won’t work out of the box. Assume you’ll need to write some tests, and perhaps fix some bugs, to get the behavior you’re after.

Julian


> On Nov 21, 2016, at 11:31 AM, Homer <lo...@gmail.com> wrote:
> 
> Hi all,
> 
> Have a question which is hopefully a simple answer.
> 
> We have a system column called ROWID.
> 
> We would like that when a SELECT * is executed that by delault the ROWID is not expanded.
> 
> We would like ROWID to only appear in a projection when ROWID is explicitly identified.
> 
> Is there a default way to do this with calcite SQLtypes?
> 
> thanks
>