[jira] [Created] (CALCITE-6021) Add CURRENT_DATETIME function (enabled in BigQuery library)

2023-09-21 Thread Tanner Clary (Jira)
Tanner Clary created CALCITE-6021:
-

 Summary: Add CURRENT_DATETIME function (enabled in BigQuery 
library)
 Key: CALCITE-6021
 URL: https://issues.apache.org/jira/browse/CALCITE-6021
 Project: Calcite
  Issue Type: Bug
Reporter: Tanner Clary


Calcite supports parsing and validation for the CURRENT_DATETIME function 
according to CALCITE-4297 . However a native implementation was never added.

The docs for the function may be found here: 
 
https://cloud.google.com/bigquery/docs/reference/standard-sql/datetime_functions#current_datetime

An example:
{{SELECT CURRENT_DATETIME([timezone])}} should return the current time as a 
{{DATETIME}} (a Calcite TIMESTAMP_WITH_LOCAL_TIME_ZONE). There is an optional 
time zone argument.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: gradle build main branch encounters error

2023-09-21 Thread P.F. ZHAN
It seems caused by the pr of issue,
https://issues.apache.org/jira/browse/CALCITE-5920
I revert this pr locally, it works.


On Fri, Sep 22, 2023 at 2:54 AM P.F. ZHAN  wrote:

> I rebased the newest code, and built the code locally
>
> * What went wrong:
> Execution failed for task ':linq4j:forbiddenApisMain'.
> > de.thetaphi.forbiddenapis.ForbiddenApiException: Check for forbidden API
> calls failed while scanning class
> 'org.apache.calcite.linq4j.QueryableRecorder$57':
> java.lang.ClassNotFoundException:
> org.apache.calcite.linq4j.QueryableDefaults$NonLeafReplayableQueryable
> (while looking up details about referenced class
> 'org.apache.calcite.linq4j.QueryableRecorder$57')
>
>
>


gradle build main branch encounters error

2023-09-21 Thread P.F. ZHAN
I rebased the newest code, and built the code locally

* What went wrong:
Execution failed for task ':linq4j:forbiddenApisMain'.
> de.thetaphi.forbiddenapis.ForbiddenApiException: Check for forbidden API
calls failed while scanning class
'org.apache.calcite.linq4j.QueryableRecorder$57':
java.lang.ClassNotFoundException:
org.apache.calcite.linq4j.QueryableDefaults$NonLeafReplayableQueryable
(while looking up details about referenced class
'org.apache.calcite.linq4j.QueryableRecorder$57')


Re: PR CALCITE-6008 Review Request

2023-09-21 Thread Tanner Clary
Hi Jiabao,

Thanks for opening this PR, I left a couple of comments.

Best,
Tanner

On Thu, Sep 21, 2023 at 3:55 AM Jiabao Sun 
wrote:

> Hi community,
>
> I have submitted a PR with CALCITE-6008
> to correct ARRAY_AGG function's return type.
>
> If someone has time, please help me to review the PR, I would
> appreciate it very much.
>
> 1.CALCITE-6008:
> Jira: https://issues.apache.org/jira/browse/CALCITE-6008
> PR: https://github.com/apache/calcite/pull/3430
>
> Best,
> Jiabao
>


[jira] [Created] (CALCITE-6020) SqlToRelConverter should not replace windowed SUM with equivalent expression using SUM0

2023-09-21 Thread Zoltan Haindrich (Jira)
Zoltan Haindrich created CALCITE-6020:
-

 Summary: SqlToRelConverter should not replace windowed SUM with 
equivalent expression using SUM0
 Key: CALCITE-6020
 URL: https://issues.apache.org/jira/browse/CALCITE-6020
 Project: Calcite
  Issue Type: Improvement
Reporter: Zoltan Haindrich
Assignee: Zoltan Haindrich


{{SqlToRelConverter}} replaces {{SUM}} with {{SUM0}} around 
[here|https://github.com/apache/calcite/blob/e1991e08a225ef08c2402ab35c310d88fff3c222/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L5885]

This might have been needed at some point in the past - but I think it will be 
better to leave it as {{SUM}} - as in case there is no {{SUM0}} in the system 
that will be replaced with a {{COALESCE(SUM(...) , 0 )}} to provide it - as see 
[here|https://github.com/apache/calcite/blob/e1991e08a225ef08c2402ab35c310d88fff3c222/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java#L1288]




--
This message was sent by Atlassian Jira
(v8.20.10#820010)


PR CALCITE-6008 Review Request

2023-09-21 Thread Jiabao Sun
Hi community, 

I have submitted a PR with CALCITE-6008 
to correct ARRAY_AGG function's return type.

If someone has time, please help me to review the PR, I would
appreciate it very much.

1.CALCITE-6008:
Jira: https://issues.apache.org/jira/browse/CALCITE-6008
PR: https://github.com/apache/calcite/pull/3430

Best,
Jiabao


PR CALCITE-6008 Review Request

2023-09-21 Thread Jiabao Sun
Hi community, 

I have submitted a PR with CALCITE-6008 
to correct ARRAY_AGG function's return type.

If someone has time, please help me to review the PR, I would
appreciate it very much.

1.CALCITE-6008:
Jira: https://issues.apache.org/jira/browse/CALCITE-6008
PR: https://github.com/apache/calcite/pull/3430

Best,
Jiabao


[jira] [Created] (CALCITE-6019) Excessive cast when UDF receives nullable JavaType

2023-09-21 Thread Vladimir Sitnikov (Jira)
Vladimir Sitnikov created CALCITE-6019:
--

 Summary: Excessive cast when UDF receives nullable JavaType
 Key: CALCITE-6019
 URL: https://issues.apache.org/jira/browse/CALCITE-6019
 Project: Calcite
  Issue Type: Bug
  Components: core
Reporter: Vladimir Sitnikov


See CALCITE-6018, however, CALCITE-6018 is about the "ability to declare 
nullable, non-optional parameter" while this issue is about the excessive NOT 
NULL cast.

Just in case, adding {{@Strict}} to {{retainedSize}} does not make CAST go away.

It causes weird "cast(... NOT NULL)" even though my {{retainedSize}} function 
processes null just fine.
{noformat}
expr#4=[TO_HEAP_REFERENCE($t3)],
expr#5=[CAST($t4):JavaType(class java.lang.Object) NOT NULL],
expr#6=[retainedSize($t5)],
{noformat}
{{TO_HEAP_REFERENCE}} returns nullable {{HeapReference}} (Java class): 
[https://github.com/vlsi/mat-calcite-plugin/blob/4d4aa2284eeec69bc51da0c2e769ded06ef9ab97/MatCalcitePlugin/src/com/github/vlsi/mat/calcite/schema/objects/HeapOperatorTable.java#L27-L28]

{{retainedSize}} receives a single (nullable) {{Object}} parameter, and it is 
declared as 
[https://github.com/vlsi/mat-calcite-plugin/blob/4d4aa2284eeec69bc51da0c2e769ded06ef9ab97/MatCalcitePlugin/src/com/github/vlsi/mat/calcite/functions/HeapFunctions.java#L129]

I tried adding {{@Parameter(optional=true)}} to {{{}retainedSize{}}}, and it 
does not eliminate {{NOT NULL}} part of the cast.

 

My expectation is that NOT NULL must not be there as both return type and the 
parameter type are nullable. It might be cast should not be there as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)