RexProgram expansion and non-deterministic functions

2023-02-09 Thread Viliam Durina
Hello all, we're using `RexProgram.expandLocalRef()` and `RexProgram.expandList()` to have a simple RexNode which we later evaluate. However, if the program contains a non-deterministic function call in the common subexpressions, such call is inlined and can be called a different number of times

[jira] [Created] (CALCITE-5228) RexSimplify.simplifyCast throws NumberFormatException

2022-08-04 Thread Viliam Durina (Jira)
Viliam Durina created CALCITE-5228: -- Summary: RexSimplify.simplifyCast throws NumberFormatException Key: CALCITE-5228 URL: https://issues.apache.org/jira/browse/CALCITE-5228 Project: Calcite

Re: [DISCUSS] Towards Calcite 1.31.0

2022-06-16 Thread Viliam Durina
> > > The plan is to have an RC in 1-2 weeks. > > > > > > > > > > Regards, > > > > > Andrei. > > > > > > > > > > > > > > > On Sat, Jun 4, 2022 at 6:13 AM Vova Vysotskyi < > volody...@apac

Re: [DISCUSS] Towards Calcite 1.31.0

2022-05-30 Thread Viliam Durina
Our PR is reasonably simple and as far as I'm aware, it doesn't need more changes, we'd be glad to find a reviewer and having it merged: https://github.com/apache/calcite/pull/2808 Viliam On Fri, 27 May 2022 at 21:49, Julian Hyde wrote: > +1 mid-june release, and thank you to Ruben for sending

[jira] [Created] (CALCITE-5157) ClassCastException in checkRollUp with DOT operator

2022-05-17 Thread Viliam Durina (Jira)
Viliam Durina created CALCITE-5157: -- Summary: ClassCastException in checkRollUp with DOT operator Key: CALCITE-5157 URL: https://issues.apache.org/jira/browse/CALCITE-5157 Project: Calcite

Re: Incorrect Sql2Rel conversion for SELECT DISTINCT .. ORDER BY

2022-05-05 Thread Viliam Durina
]) > LogicalTableScan(table=[[CATALOG, SALES, EMP]]) > > This plan is like the first plan, except that the LogicalProject > occurs after LogicalAggregate rather than before. > > Julian > > On Tue, May 3, 2022 at 7:32 AM Viliam Durina > wrote: > > > > Hi

Incorrect Sql2Rel conversion for SELECT DISTINCT .. ORDER BY

2022-05-03 Thread Viliam Durina
Hi all, I have this query: SELECT DISTINCT deptno FROM emp ORDER BY rand() Sql2rel conversion generates the following expression: LogicalProject(DEPTNO=[$0]) LogicalSort(sort0=[$1], dir0=[ASC]) LogicalAggregate(group=[{0, 1}]) LogicalProject(DEPTNO=[$7], EXPR$1=[RAND()])

Re: Changes to the rule pattern interface

2022-04-14 Thread Viliam Durina
I can say for myself that though the migration was a nuisance, after we figured out what to do, it was straightforward and the current approach with Immutables is more readable and easier to write than the previous with `operand` and `operandJ`. Viliam On Wed, 13 Apr 2022 at 19:23, Julian Hyde

Re: Pushing filters with unsafe operations (CAST/DIVISION) below inner joins

2022-02-18 Thread Viliam Durina
I have observed this issue years ago in well-known databases. My case was much simpler: data recordType:int value:text - -- 0 1 1 a SELECT * FROM data WHERE recordType='1' AND CAST(value AS INT)<10 SQL is declarative, and unlike procedural

Re: Projection for SELECT COUNT(*)

2022-01-19 Thread Viliam Durina
cited in SqlToRelConverter seems an attempt to handle empty > > records/tuples that we are not handling very well in general [1]. > > Doesn't seem related to performance as the use-case you mentioned. > > > > Best, > > Stamatis > > > > [1] ht

Projection for SELECT COUNT(*)

2022-01-14 Thread Viliam Durina
I noticed this two pieces of code: 1. in SqlToRelConverter: if (preExprs.size() == 0) { // Special case for COUNT(*), where we can end up with no inputs // at all. The rest of the system doesn't like 0-tuples, so we // select a dummy constant here. final RexNode zero =

Re: [DISCUSS] Syntax upgrade about Session Window Table Function

2021-10-02 Thread Viliam Durina
Btw, the table argument, according to the sql standard, must be in parentheses, like this: SELECT * FROM TABLE(SESSION(TABLE(input_table), ... When doing a breaking change, we should also consider this. Viliam On Thu, 30 Sept 2021 at 18:11, Julian Hyde wrote: > Thanks for the examples. The

[jira] [Created] (CALCITE-4785) The parser allows multiple ON ERROR or ON EMPTY clauses for JSON_QUERY and JSON_VALUE

2021-09-17 Thread Viliam Durina (Jira)
Viliam Durina created CALCITE-4785: -- Summary: The parser allows multiple ON ERROR or ON EMPTY clauses for JSON_QUERY and JSON_VALUE Key: CALCITE-4785 URL: https://issues.apache.org/jira/browse/CALCITE-4785

Re: [ANNOUNCE] New committer: Vladimir Ozerov

2021-06-23 Thread Viliam Durina
r is among the few people who know very well the > internal > > > > >>>> workings > > > > >>>>>> of the > > > > >>>>>> Calcite optimizer. He started and participated in many > > discussions > > > > >>>

Re: Proposal to extend Calcite into a incremental query optimizer

2021-04-28 Thread Viliam Durina
patible, or whether one concept can subsume others. > >>>> >>>>>>>>>> > >>>> >>>>>>>>>> Your work differs from streaming queries in that your > >>>> relations > >>>> >>> are > >>>> >>>>>>> used > &g

Re: How to parse sql of DDL

2020-11-04 Thread Viliam Durina
主题: Re: > How to parse sql of DDL > > > Hi Xiao, It's hard to diagnose the problem > without seeing your code. My > suggestion is that you can debug some test > cases in our code base (related > to SqlParser), and check how it works. > Best, Liya Fan On Wed, Nov 4, 2020 >

List of columns that are inserted to

2020-10-26 Thread Viliam Durina
We have a query similar to this: INSERT INTO t(c1, c2) VALUES(1, 2); However, the row type of table `t` has 3 columns: c1, c2 and c3. When we convert the SqlNode to RelNode using `SqlToRelConverter.convertQuery()`, the output is similar to this: LogicalTableModify(table=[t],

Re: [ DISCUSS] The window table functions join syntax

2020-09-24 Thread Viliam Durina
happens now is that you get duplicate > > > > columns. > > > > > > > > Is it reasonable to apply TUMBLE to TUMBLE? If so, would people > > > > generally want two sets of window_start, window_end columns? > > > > > > > > Julian &g

Re: [DISCUSSION] Rename master branch to main

2020-08-07 Thread Viliam Durina
> However, I don't see evidence to support your claims that this will bring no new contributors nor make anyone feel more welcome. I'm not claiming that I can point to any specific individual who will be positively impacted by this change and I will admit that it's possible that no one will be

Re: [DISCUSSION] Rename master branch to main

2020-08-04 Thread Viliam Durina
gt; > > >> Best, > > > >> Danny Chan > > > >> 在 2020年7月29日 +0800 AM7:08,Michael Mior ,写道: > > > >>> Actually, the argument that the term "master" in git didn't > originate > > > >>> from master/slave is not tr

Re: [DISCUSSION] Rename master branch to main

2020-07-29 Thread Viliam Durina
> - If we follow the links from the article Michael posted, the term > "master" in git does not originate from "master record" but rather from > master/slave. > No it doesn't. The fact that someone used the term "slave" as an example doesn't mean the master/slave concept applies to relationships

Re: [DISCUSSION] Rename master branch to main

2020-07-28 Thread Viliam Durina
> It’s probably derived from “master” as in the “gold master” [1] which is > the mix from which a sound engineer would cut a record or CD. And who knows > where that term came from? > Of course! Dictionaries are clear, see https://www.merriam-webster.com/dictionary/master or

Re: [DISCUSSION] Rename master branch to main

2020-07-28 Thread Viliam Durina
mpact change that can potentially > > make us even more welcoming to new contributors, which is a benefit to > > us all :) > > > > [0] > http://www.kapwing.com/blog/how-to-rename-your-master-branch-to-main-in-git/ > > [1] https://github.com/github/roadmap/issues/63

Re: How to support case-insensitive identifier resolution?

2020-06-18 Thread Viliam Durina
ve a deterministic semantic I think. > > Best, > Danny Chan > 在 2020年6月18日 +0800 PM4:23,dev@calcite.apache.org,写道: > > > > when the identifier was > > quoted and case-insensitive, if it wasn't > -- Viliam Durina Jet Developer hazelcast® <https://www.

Re: How to support case-insensitive identifier resolution?

2020-06-18 Thread Viliam Durina
NCHANGED]: "SELECT BIRTHDATE" doesn't > work > > obviously > > 2) [unquoted=UPPER, quoted=UNCHANGED]: "SELECT BIRTHDATE" doesn't work > > again, because parser normalizes unqouted identifier to upper case, but > > RelDataType has a column "birthDate&

Re: [DISCUSS] Some quesitons about the new introduced window table functions (TUMBLE, HOP and SESSION)

2020-06-08 Thread Viliam Durina
CALCITE-3955, Julian has pointed out that we > > should translate the "table" argument as a CURSOR (or TABLE by Viliam), > but > > another question is how to translate the referenced name "time_column", > to > > a correlate variable ? which is also

[jira] [Created] (CALCITE-3970) Table-valued function TUMBLE uses non-standard syntax

2020-05-04 Thread Viliam Durina (Jira)
Viliam Durina created CALCITE-3970: -- Summary: Table-valued function TUMBLE uses non-standard syntax Key: CALCITE-3970 URL: https://issues.apache.org/jira/browse/CALCITE-3970 Project: Calcite

Re: [DISCUSS] Deprecate grouped window functions

2020-04-30 Thread Viliam Durina
>> product_id, count(*), window_start > >>>>>>> FROM TABLE(TUMBLE(order, DESCRIPTOR(.rowtime), INTERVAL '1' hour) > >>>>>>> GROUP BY product_id > >>>>>>> > >>>>>>> I am giving a

Re: STREAM keyword

2020-03-25 Thread Viliam Durina
> > A JOIN B for SYSTEM_TIME AS OF A.PROC_TIME > This sounds like a solution, but it has issues: - The `B` table will have to contain an application-defined `proc_time` column. What if that time is from the future? And even if it's not, what if the record in B is late? A and B tables can be

Re: STREAM keyword

2020-03-24 Thread Viliam Durina
So how would you do a simple stream enrichment query? That is one that for each new record in an append-only relation will join a matching record from a mutable relation that's valid at the processing time? This use case is common, for example in credit card fraud detection, for each transaction

Re: STREAM keyword

2020-03-23 Thread Viliam Durina
'v + u.v'. If you want to compute > the join of two time-varying relations istream(u join v) = (istream(u) > join v) union (u join istream(v)). So you see that we are using the > 'stream' of each side. I find this symmetric treatment of all TVRs to > be compelling.) > > Jul

Re: STREAM keyword

2020-03-20 Thread Viliam Durina
> Does it matter which table is a steam? if the "STREAM" query runs > continuously, the output (table) from the query is a stream, and likely > this stream gives you delta updates periodically. In my understanding, it does. If both tables are a stream, you get a change stream from both. You're

Re: STREAM keyword

2020-03-20 Thread Viliam Durina
OF, there may be a > system-maintained column that records when product was last updated. > > Julian > > On Fri, Mar 20, 2020 at 12:01 AM Viliam Durina > wrote: > > > > On Thu, 19 Mar 2020 at 21:04, Julian Hyde wrote: > > > > Suppose you execute

Re: STREAM keyword

2020-03-20 Thread Viliam Durina
On Thu, 19 Mar 2020 at 21:04, Julian Hyde wrote: Suppose you execute that query at 10am and get a particular result. ... you > execute again at 10.10am. > I execute that query at 10am and expect it to run continuously. My understanding is that a query with `EMIT STREAM` will run continuously.

STREAM keyword

2020-03-19 Thread Viliam Durina
Hi all, I'm not sure if this is an appropriate forum, I want to discuss concepts in the "One SQL to Rule Them All" paper. The paper uses `EMIT STREAM` clause, but Calcite uses the `STREAM` keyword after `SELECT`, but in my understanding, these are the same. I'm wondering about the supposed