git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ViewTableMacro and empty parameteters


Thanks for explanation :)

I've implemented the thing already for my needs - the only difference from
TableViewMacro is that I create relational tree just on Table/Function
creation to know dynamic parameter types (BasicSqlType), converting them to
Java types and then passing through Function.getParameters to the engine.
Created relational tree I am using to TranslatableTable.toRel but each
RexDynamicParam is rewritten to RexLiteral.

Thanks :)

On Tue, Oct 23, 2018 at 12:05 AM Stamatis Zampetakis <zabetak@xxxxxxxxx>
wrote:

> Below a few interesting pointers to the literature.
>
> Parameterized views are known as templates with binding patterns [1], views
> with access patterns [2]. There are many proposals and algorithms around
> these notions. I don't know if it is relevant to bring any of it into
> Calcite.
>
> Best,
> Stamatis
>
> [1] http://ilpubs.stanford.edu:8090/103/1/1995-35.pdf
> [2]
> http://users.sdsc.edu/~ludaesch/Paper/deutsch-ludaescher-nash-icdt05.pdf
>
> Στις Δευ, 22 Οκτ 2018 στις 8:20 μ.μ., ο/η Julian Hyde <jhyde@xxxxxxxxxx>
> έγραψε:
>
> > It’s a need idea, and it could easily be done by a table macro. I just
> > wouldn’t call it a “view” anymore, because SQL views do not take
> > parameters, and as you can see, the syntax to call is now table function
> > syntax rather than view syntax.
> >
> > I like the idea of parameterized views. For instance a “view” that takes
> > not only literals as parameters but also relational expressions and
> > expressions (e.g. boolean expressions). I just never found a good syntax
> > for it, other than table function syntax.
> >
> > If you’re familiar with Lisp you will know why I called them table
> macros.
> > So maybe we need a SQL equivalent of quasi-quote?! [1]
> >
> > Julian
> >
> > [1]
> >
> https://courses.cs.washington.edu/courses/cse341/04wi/lectures/14-scheme-quote.html
> > <
> >
> https://courses.cs.washington.edu/courses/cse341/04wi/lectures/14-scheme-quote.html
> >
> >
> >
> > > On Oct 22, 2018, at 5:24 AM, ptr.bojko@xxxxxxxxx wrote:
> > >
> > > Hello dear Calcite team :)
> > >
> > > I have one design question on ViewTableMacro:
> > >
> > > Why does it not implement parameters?
> > >
> > > I was thinking about dynamic parameters "?" here. For example,
> following
> > > view with dynamic parameters
> > > some_view: SELECT * FROM some_table WHERE id > ? AND LIMIT ?
> > > could handle two parameters and then this view could be used as
> follows:
> > > SELECT * FROM TABLE(some_view(2,100))
> > >
> > > Regards!
> > >
> > > --
> > > Piotr Bojko
> > > http://about.me/ptr.bojko
> >
> >
>


-- 
Piotr Bojko
http://about.me/ptr.bojko