If the issue can be reproduced using a SQL query on a standard data set, the 
best test case is often a Quidem fragment.

A recent commit that did that: 
https://github.com/apache/calcite/commit/1245db6201. They also added a test to 
the applicable unit test.

I confess it’s not very easy to run Quidem tests from the command line. Maybe 
someone can fix that.

Julian


> On Nov 9, 2023, at 6:30 AM, Egor Ryashin <[email protected]> wrote:
> 
> I wonder which *Test.java should I try to use as a template? I need smth that 
> parses the SQL and uses Volcano optimizer as the stacktrace shows it fails 
> during optimization. 
> 
> BTW, it happened during Apache Druid query execution and I saw the Druid 
> custom join rule was engaged so I thought initially it was on the Druid side. 
> But Apache Druid fixed that with Apache Calcite update to 1.35, so now I’m 
> not sure was it Calcite or Druid or both.
> 
>> On 9 Nov 2023, at 14:52, Ran Tao <[email protected]> wrote:
>> 
>> Hi, Egor, I agree with Julian's opinion, maybe you can use calcite's test
>> set for this case, such as emp, dept, hr and other schema/tables.
>> then developers will easily locate the problem.
>> 
>> Some bugs may have persisted in earlier versions to this day, some were
>> later fixed, and some were covered up.
>> But as long as a specific standard case/sql and a certain calcite version
>> are given,
>> we can easily draw from the commit/code history which commit, which version
>> introduced the problem or it has never worked correctly.
>> 
>> Best Regards,
>> Ran Tao
>> 
>> 
>> Egor Ryashin <[email protected]> 于2023年11月9日周四 18:10写道:
>> 
>>> FYI, it’s not reproduced with Calcite 1.35
>>> 
>>>> On 7 Nov 2023, at 03:10, Julian Hyde <[email protected]> wrote:
>>>> 
>>>> Did you find an existing Jira case? If not, could you log one? You
>>> should create a minimal test case and figure out what are the essential
>>> features that are necessary to reproduce this problem. Ideally convert it
>>> to run on a built-in schema such as Scott (emp and dept tables). This will
>>> help someone fix the case, help someone suggest a workaround, and help
>>> others identify that they are hitting the same issue.
>>>> 
>>>>> On Nov 6, 2023, at 3:51 AM, Egor Ryashin <[email protected]>
>>> wrote:
>>>>> 
>>>>> Hi all,
>>>>> 
>>>>> I’ve just run into this exception:
>>>>> Type mismatch: rowtype of new rel: RecordType(VARCHAR pub, VARCHAR
>>> pub0, DOUBLE NOT NULL $f2) NOT NULL rowtype of set: RecordType(VARCHAR pub,
>>> VARCHAR pub0, DOUBLE rate) NOT NULL
>>>>> 
>>>>> 
>>>>> executing this SQL:
>>>>> SELECT          base."pub”,
>>>>>            Any_value(base.”rate”),
>>>>>             Any_value(comparison."rate")
>>>>> FROM            (
>>>>>                      SELECT   "pub",
>>>>>                               Min(total)/Max(price) AS "rate"
>>>>>                      FROM     "test_data"
>>>>>                      WHERE    "__time" >= timestamp '2022-03-01
>>> 00:00:00'
>>>>>                      GROUP BY "pub"
>>>>>                      ORDER BY TRUE,
>>>>>                               2 limit 500 ) base
>>>>> left outer join
>>>>>             (
>>>>>                      SELECT   "pub",
>>>>>                               min(total)/max(price) AS "rate"
>>>>>                      FROM     "test_data"
>>>>>                      WHERE    "__time" < timestamp '2022-03-01
>>> 00:00:00'
>>>>>                      GROUP BY "pub" ) comparison
>>>>> ON              base."pub" = comparison."pub"
>>>>> GROUP BY        1
>>>>> 
>>>>> looking through JIRA I concluded that bug is still an issue, I wonder
>>> if there’s a known workaround for that?
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
> 

Reply via email to