[jira] [Commented] (CALCITE-6142) Double quote does not work as literal quote string in sql parsing

2023-11-28 Thread peng wu (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790931#comment-17790931
 ] 

peng wu commented on CALCITE-6142:
--

[~libenchao] SqlParser.Config.withQuoting sets the identifier quoting string, 
right? 
With it set to Quoting.DOUBLE_QUOTE, the BACK_TICK in my expression is not 
recognized and the parser threw new exception.
It seems Config.withQuoting cannot cover the ability of the two parameters 
IdentifierQuoteString and LiteralQuoteString.

> Double quote does not work as literal quote string in sql parsing
> -
>
> Key: CALCITE-6142
> URL: https://issues.apache.org/jira/browse/CALCITE-6142
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.32.0, 1.36.0
>Reporter: peng wu
>Priority: Critical
>
> When tried to parse spark sql express where double quote(") as literal quote 
> string, calcite sql parser threw an exception: 
> org.apache.calcite.sql.parser.impl.ParseException: Encountered "\"" at 
> line 1, column 26.
> Was expecting one of:
>     "ABS" ...
>     "ARRAY" ...    "AVG" ...
> The literal quote string is specified in sql parser config.
> Here is my test case:
> {code:java}
> public static void main(String[] args) throws Exception {
> String sqlQuery = "case  when `Area` in (   \"Region1\", \"Region2\", 
> \"Region3\"  ) then `Sales`  else null end";
> //create spark dialect
> SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT
> .withDatabaseProduct(SqlDialect.DatabaseProduct.SPARK)
> .withUnquotedCasing(Casing.UNCHANGED)
> .withNullCollation(NullCollation.LOW)
> .withIdentifierQuoteString("`")
> .withLiteralQuoteString("\"");
> SqlDialect sparkDialect = new SparkSqlDialect(context);
> SqlParser.Config config = 
> sparkDialect.configureParser(SqlParser.config());
> // Create an SQL parser
> SqlParser parser = SqlParser.create(sqlQuery, config);
> // Parse the query into an AST. Here the exception occurred
> SqlNode sqlNode = parser.parseExpression();
>   } {code}



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790913#comment-17790913
 ] 

Caican Cai commented on CALCITE-6140:
-

percentile_rank seems to have the same problem

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png, 
> image-2023-11-29-10-19-11-614.png
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6142) Double quote does not work as literal quote string in sql parsing

2023-11-28 Thread Benchao Li (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790897#comment-17790897
 ] 

Benchao Li commented on CALCITE-6142:
-

{{SqlDialect}} is now mainly used for rel2sql, not sql2rel. To config the 
Parser behavior, you can directly configure {{SqlParser.Config}}, e.g. 
{{withQuoting(Quoting.DOUBLE_QUOTE_BACKSLASH)}}.

> Double quote does not work as literal quote string in sql parsing
> -
>
> Key: CALCITE-6142
> URL: https://issues.apache.org/jira/browse/CALCITE-6142
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.32.0, 1.36.0
>Reporter: peng wu
>Priority: Critical
>
> When tried to parse spark sql express where double quote(") as literal quote 
> string, calcite sql parser threw an exception: 
> org.apache.calcite.sql.parser.impl.ParseException: Encountered "\"" at 
> line 1, column 26.
> Was expecting one of:
>     "ABS" ...
>     "ARRAY" ...    "AVG" ...
> The literal quote string is specified in sql parser config.
> Here is my test case:
> {code:java}
> public static void main(String[] args) throws Exception {
> String sqlQuery = "case  when `Area` in (   \"Region1\", \"Region2\", 
> \"Region3\"  ) then `Sales`  else null end";
> //create spark dialect
> SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT
> .withDatabaseProduct(SqlDialect.DatabaseProduct.SPARK)
> .withUnquotedCasing(Casing.UNCHANGED)
> .withNullCollation(NullCollation.LOW)
> .withIdentifierQuoteString("`")
> .withLiteralQuoteString("\"");
> SqlDialect sparkDialect = new SparkSqlDialect(context);
> SqlParser.Config config = 
> sparkDialect.configureParser(SqlParser.config());
> // Create an SQL parser
> SqlParser parser = SqlParser.create(sqlQuery, config);
> // Parse the query into an AST. Here the exception occurred
> SqlNode sqlNode = parser.parseExpression();
>   } {code}



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


[jira] [Updated] (CALCITE-6142) Double quote does not work as literal quote string in sql parsing

2023-11-28 Thread peng wu (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

peng wu updated CALCITE-6142:
-
Description: 
When tried to parse spark sql express where double quote(") as literal quote 
string, calcite sql parser threw an exception: 
org.apache.calcite.sql.parser.impl.ParseException: Encountered "\"" at line 
1, column 26.
Was expecting one of:
    "ABS" ...
    "ARRAY" ...    "AVG" ...
The literal quote string is specified in sql parser config.

Here is my test case:
{code:java}
public static void main(String[] args) throws Exception {
String sqlQuery = "case  when `Area` in (   \"Region1\", \"Region2\", 
\"Region3\"  ) then `Sales`  else null end";
//create spark dialect
SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT
.withDatabaseProduct(SqlDialect.DatabaseProduct.SPARK)
.withUnquotedCasing(Casing.UNCHANGED)
.withNullCollation(NullCollation.LOW)
.withIdentifierQuoteString("`")
.withLiteralQuoteString("\"");
SqlDialect sparkDialect = new SparkSqlDialect(context);
SqlParser.Config config = sparkDialect.configureParser(SqlParser.config());
// Create an SQL parser
SqlParser parser = SqlParser.create(sqlQuery, config);
// Parse the query into an AST. Here the exception occurred
SqlNode sqlNode = parser.parseExpression();
  } {code}

  was:
When tried to parse spark sql express where double quote(") as literal quote 
string, calcite sql parser threw an exception: 
org.apache.calcite.sql.parser.impl.ParseException: Encountered "\"" at line 
1, column 26.
Was expecting one of:
    "ABS" ...
    "ARRAY" ...    "AVG" ...
The literal quote string is specified in sql parser config.

Environment: (was: Here is my test case:
{code:java}
public static void main(String[] args) throws Exception {
String sqlQuery = "case  when `Area` in (   \"Region1\", \"Region2\", 
\"Region3\"  ) then `Sales`  else null end";
//create spark dialect
SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT
.withDatabaseProduct(SqlDialect.DatabaseProduct.SPARK)
.withUnquotedCasing(Casing.UNCHANGED)
.withNullCollation(NullCollation.LOW)
.withIdentifierQuoteString("`")
.withLiteralQuoteString("\"");
SqlDialect sparkDialect = new SparkSqlDialect(context);
SqlParser.Config config = sparkDialect.configureParser(SqlParser.config());
// Create an SQL parser
SqlParser parser = SqlParser.create(sqlQuery, config);
// Parse the query into an AST. Here the exception occurred
SqlNode sqlNode = parser.parseExpression();
  } {code})

> Double quote does not work as literal quote string in sql parsing
> -
>
> Key: CALCITE-6142
> URL: https://issues.apache.org/jira/browse/CALCITE-6142
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.32.0, 1.36.0
>Reporter: peng wu
>Priority: Critical
>
> When tried to parse spark sql express where double quote(") as literal quote 
> string, calcite sql parser threw an exception: 
> org.apache.calcite.sql.parser.impl.ParseException: Encountered "\"" at 
> line 1, column 26.
> Was expecting one of:
>     "ABS" ...
>     "ARRAY" ...    "AVG" ...
> The literal quote string is specified in sql parser config.
> Here is my test case:
> {code:java}
> public static void main(String[] args) throws Exception {
> String sqlQuery = "case  when `Area` in (   \"Region1\", \"Region2\", 
> \"Region3\"  ) then `Sales`  else null end";
> //create spark dialect
> SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT
> .withDatabaseProduct(SqlDialect.DatabaseProduct.SPARK)
> .withUnquotedCasing(Casing.UNCHANGED)
> .withNullCollation(NullCollation.LOW)
> .withIdentifierQuoteString("`")
> .withLiteralQuoteString("\"");
> SqlDialect sparkDialect = new SparkSqlDialect(context);
> SqlParser.Config config = 
> sparkDialect.configureParser(SqlParser.config());
> // Create an SQL parser
> SqlParser parser = SqlParser.create(sqlQuery, config);
> // Parse the query into an AST. Here the exception occurred
> SqlNode sqlNode = parser.parseExpression();
>   } {code}



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


[jira] [Created] (CALCITE-6142) Double quote does not work as literal quote string in sql parsing

2023-11-28 Thread peng wu (Jira)
peng wu created CALCITE-6142:


 Summary: Double quote does not work as literal quote string in sql 
parsing
 Key: CALCITE-6142
 URL: https://issues.apache.org/jira/browse/CALCITE-6142
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.36.0, 1.32.0
 Environment: Here is my test case:
{code:java}
public static void main(String[] args) throws Exception {
String sqlQuery = "case  when `Area` in (   \"Region1\", \"Region2\", 
\"Region3\"  ) then `Sales`  else null end";
//create spark dialect
SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT
.withDatabaseProduct(SqlDialect.DatabaseProduct.SPARK)
.withUnquotedCasing(Casing.UNCHANGED)
.withNullCollation(NullCollation.LOW)
.withIdentifierQuoteString("`")
.withLiteralQuoteString("\"");
SqlDialect sparkDialect = new SparkSqlDialect(context);
SqlParser.Config config = sparkDialect.configureParser(SqlParser.config());
// Create an SQL parser
SqlParser parser = SqlParser.create(sqlQuery, config);
// Parse the query into an AST. Here the exception occurred
SqlNode sqlNode = parser.parseExpression();
  } {code}
Reporter: peng wu


When tried to parse spark sql express where double quote(") as literal quote 
string, calcite sql parser threw an exception: 
org.apache.calcite.sql.parser.impl.ParseException: Encountered "\"" at line 
1, column 26.
Was expecting one of:
    "ABS" ...
    "ARRAY" ...    "AVG" ...
The literal quote string is specified in sql parser config.



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790869#comment-17790869
 ] 

Caican Cai commented on CALCITE-6140:
-

!image-2023-11-29-10-19-11-614.png!

Thank you for your reminding. I'm sorry for the unclear description. It's 
obvious from the picture here that PERCENT function is supported. My main 
problem is that 1 PERCENT parsing result is obviously different from 
PERCENT_CONT in my submitted test. 2. I don't find the corresponding 
documentation in the documentation of MySQL and Postgres in mainstream 
databases. I'm wondering if it's necessary to keep this function

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png, 
> image-2023-11-29-10-19-11-614.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caican Cai updated CALCITE-6140:

Attachment: image-2023-11-29-10-19-11-614.png

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png, 
> image-2023-11-29-10-19-11-614.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caican Cai updated CALCITE-6140:

Attachment: (was: Screenshot_13-1.png)

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caican Cai updated CALCITE-6140:

Attachment: Screenshot_13-1.png

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caican Cai updated CALCITE-6140:

Attachment: (was: Screenshot_13.png)

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Caican Cai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caican Cai updated CALCITE-6140:

Attachment: Screenshot_13.png

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Tanner Clary (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790867#comment-17790867
 ] 

Tanner Clary commented on CALCITE-6140:
---

Your screenshot shows PERCENTILE_CONT but your example is for PERCENTILE, I'm 
not sure what the issue is to be honest. [~caicancai]

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Francis Chuang (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francis Chuang updated CALCITE-6139:

Fix Version/s: avatica-go-5.3.0

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Egor Ryashin
>Priority: Major
> Fix For: avatica-go-5.3.0
>
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Assigned] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Francis Chuang (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francis Chuang reassigned CALCITE-6139:
---

Assignee: Egor Ryashin  (was: Francis Chuang)

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Egor Ryashin
>Priority: Major
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790858#comment-17790858
 ] 

caicancai commented on CALCITE-6140:


!image-2023-11-29-09-56-04-992.png!

This is obviously supported in sqlParserTest

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

caicancai updated CALCITE-6140:
---
Attachment: image-2023-11-29-09-56-04-992.png

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
> Attachments: image-2023-11-29-09-56-04-992.png
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790855#comment-17790855
 ] 

caicancai commented on CALCITE-6140:


For example, SELECT 'PERCENTILE' (' X ', 0.5) WITHIN GROUP (ORDER BY 3) 
contains two extra quotes for 'PERCENTILE'

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790850#comment-17790850
 ] 

caicancai commented on CALCITE-6140:


If there is an abnormal result, the sql parsed through it is obviously 
different from the result of PERCENTILE_DISC and PERCENTILE_COUT

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790846#comment-17790846
 ] 

caicancai commented on CALCITE-6140:


It seems that there is no such function in many databases, I only know that 
hive supports this function, but I see that sqlParserTest is marked with this 
function, should we delete this mark

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Jiajun Xie (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790842#comment-17790842
 ] 

Jiajun Xie commented on CALCITE-6140:
-

[~caicancai]  What do you mean the results?

 

You only added the test for SqlParserTest and there are no any execution 
results.

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6141) Add a dedicated gradle property for the checkstyle version to be used with jdk8

2023-11-28 Thread Francis Chuang (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francis Chuang updated CALCITE-6141:

Fix Version/s: avatica-1.24.0

> Add a dedicated gradle property for the checkstyle version to be used with 
> jdk8
> ---
>
> Key: CALCITE-6141
> URL: https://issues.apache.org/jira/browse/CALCITE-6141
> Project: Calcite
>  Issue Type: Improvement
>  Components: avatica
>Affects Versions: avatica-1.23.0
>Reporter: Sergey Nuyanzin
>Assignee: Sergey Nuyanzin
>Priority: Major
>  Labels: pull-request-available
> Fix For: avatica-1.24.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The issue is that in case of jdk8 in order to compile it with jdk8 there 
> should be specified checkstyle version. 
> Since current java version could be detected during compilation it could also 
> detect which checkstyle version should be used.
> This issue was also mentioned in ML  
> https://lists.apache.org/thread/r27kdvvhr0222nqlog7xzn5y3yjvz6jp 



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


[jira] [Resolved] (CALCITE-6141) Add a dedicated gradle property for the checkstyle version to be used with jdk8

2023-11-28 Thread Francis Chuang (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francis Chuang resolved CALCITE-6141.
-
Resolution: Fixed

> Add a dedicated gradle property for the checkstyle version to be used with 
> jdk8
> ---
>
> Key: CALCITE-6141
> URL: https://issues.apache.org/jira/browse/CALCITE-6141
> Project: Calcite
>  Issue Type: Improvement
>  Components: avatica
>Affects Versions: avatica-1.23.0
>Reporter: Sergey Nuyanzin
>Assignee: Sergey Nuyanzin
>Priority: Major
>  Labels: pull-request-available
> Fix For: avatica-1.24.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The issue is that in case of jdk8 in order to compile it with jdk8 there 
> should be specified checkstyle version. 
> Since current java version could be detected during compilation it could also 
> detect which checkstyle version should be used.
> This issue was also mentioned in ML  
> https://lists.apache.org/thread/r27kdvvhr0222nqlog7xzn5y3yjvz6jp 



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


[jira] [Updated] (CALCITE-6141) Add a dedicated gradle property for the checkstyle version to be used with jdk8

2023-11-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated CALCITE-6141:

Labels: pull-request-available  (was: )

> Add a dedicated gradle property for the checkstyle version to be used with 
> jdk8
> ---
>
> Key: CALCITE-6141
> URL: https://issues.apache.org/jira/browse/CALCITE-6141
> Project: Calcite
>  Issue Type: Improvement
>  Components: avatica
>Affects Versions: avatica-1.23.0
>Reporter: Sergey Nuyanzin
>Assignee: Sergey Nuyanzin
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> The issue is that in case of jdk8 in order to compile it with jdk8 there 
> should be specified checkstyle version. 
> Since current java version could be detected during compilation it could also 
> detect which checkstyle version should be used.
> This issue was also mentioned in ML  
> https://lists.apache.org/thread/r27kdvvhr0222nqlog7xzn5y3yjvz6jp 



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


[jira] [Created] (CALCITE-6141) Add a dedicated gradle property for the checkstyle version to be used with jdk8

2023-11-28 Thread Sergey Nuyanzin (Jira)
Sergey Nuyanzin created CALCITE-6141:


 Summary: Add a dedicated gradle property for the checkstyle 
version to be used with jdk8
 Key: CALCITE-6141
 URL: https://issues.apache.org/jira/browse/CALCITE-6141
 Project: Calcite
  Issue Type: Improvement
  Components: avatica
Affects Versions: avatica-1.23.0
Reporter: Sergey Nuyanzin
Assignee: Sergey Nuyanzin


The issue is that in case of jdk8 in order to compile it with jdk8 there should 
be specified checkstyle version. 
Since current java version could be detected during compilation it could also 
detect which checkstyle version should be used.
This issue was also mentioned in ML  
https://lists.apache.org/thread/r27kdvvhr0222nqlog7xzn5y3yjvz6jp 



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Tanner Clary (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790760#comment-17790760
 ] 

Tanner Clary commented on CALCITE-6140:
---

[~caicancai] I left a comment on the PR but just for clarity I'm not sure what 
the {{PERCENTILE}} function is.

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790717#comment-17790717
 ] 

Julian Hyde commented on CALCITE-6140:
--

[~tanclary], Can you review this, and merge it if it is a helpful addition to 
the test suite. Or mark it a duplicate if it is covered by your ongoing work on 
PERCENTILE in BigQuery.

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6138) Parser does not accept TIMESTAMP WITH TIME ZONE as a data type

2023-11-28 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790708#comment-17790708
 ] 

Julian Hyde commented on CALCITE-6138:
--

Contributions welcome.

> Parser does not accept TIMESTAMP WITH TIME ZONE as a data type
> --
>
> Key: CALCITE-6138
> URL: https://issues.apache.org/jira/browse/CALCITE-6138
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.36.0
>Reporter: Mihai Budiu
>Priority: Minor
>
> The current SQL grammar accepts either TIMESTAMP WITHOUT TIME ZONE or 
> TIMESTAMP WITH LOCAL TIME ZONE. It does not accept the version without LOCAL: 
> TIMESTAMP WITH TIME ZONE. This is a legal type in other SQL dialects, and it 
> appears in the SQL 92 standard.
> The Calcite documentation also lists the rejected type as a legal scalar 
> type: [https://calcite.apache.org/docs/reference.html#scalar-types]
> So there is a bug: either the compiler is wrong, or the documentation is 
> wrong. The main question is "which one?"



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


[jira] [Commented] (CALCITE-6138) Parser does not accept TIMESTAMP WITH TIME ZONE as a data type

2023-11-28 Thread Mihai Budiu (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790705#comment-17790705
 ] 

Mihai Budiu commented on CALCITE-6138:
--

CALCITE-208 set up this as a goal in 2014

> Parser does not accept TIMESTAMP WITH TIME ZONE as a data type
> --
>
> Key: CALCITE-6138
> URL: https://issues.apache.org/jira/browse/CALCITE-6138
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.36.0
>Reporter: Mihai Budiu
>Priority: Minor
>
> The current SQL grammar accepts either TIMESTAMP WITHOUT TIME ZONE or 
> TIMESTAMP WITH LOCAL TIME ZONE. It does not accept the version without LOCAL: 
> TIMESTAMP WITH TIME ZONE. This is a legal type in other SQL dialects, and it 
> appears in the SQL 92 standard.
> The Calcite documentation also lists the rejected type as a legal scalar 
> type: [https://calcite.apache.org/docs/reference.html#scalar-types]
> So there is a bug: either the compiler is wrong, or the documentation is 
> wrong. The main question is "which one?"



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


[jira] [Commented] (CALCITE-6044) Column uniqueness for single-row relations

2023-11-28 Thread Paul Jackson (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790648#comment-17790648
 ] 

Paul Jackson commented on CALCITE-6044:
---

[~julianhyde] the PR is ready for another review.

> Column uniqueness for single-row relations
> --
>
> Key: CALCITE-6044
> URL: https://issues.apache.org/jira/browse/CALCITE-6044
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Paul Jackson
>Assignee: Paul Jackson
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> A single-row relation can result from a {{LIMIT 1}} or an aggregation without 
> {{{}GROUP BY{}}}. Every column in one of these relations should be unique by 
> virtue of having a max row count of 1.
> When joining with a single-row relation on a key field, the join result 
> should no longer require that key field for uniqueness. For example, suppose 
> the {{emp}} table had a composite key {{{}(empno,hiredate){}}}. If we join on 
> {{hiredate=max(hiredate)}} then {{empno}} alone should be a unique column:
>  
> {code:java}
> SELECT * FROM emp A
> JOIN ( SELECT MAX(hiredate) last_hired  FROM emp) B
> ON A.hiredate = B.last_hired
> {code}
> {{join(A,B).empno}} should be unique because {{(A.empno,A.hiredate)}} is 
> unique and {{A.hiredate}} is effectively constant because it is equal to 
> {{{}B.last_hired{}}}.
> Here are some {{RelMetadataTests}} cases that I think should pass.
> {code:java}
> @Test void testColumnUniquenessForLimit1() {
>   final String sql = ""
>  + "select *\n"
>  + "from emp\n"
>  + "limit 1";
>   sql(sql)
>   .assertThatAreColumnsUnique(bitSetOf(0), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(1), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(), is(true));
> }
> @Test void testColumnUniquenessForJoinOnLimit1() {
>   final String sql = ""
>  + "select *\n"
>  + "from emp A\n"
>  + "join (\n"
>  + "  select * from emp\n"
>  + "  limit 1) B\n"
>  + "on A.empno = B.empno";
>   sql(sql)
>   .assertThatAreColumnsUnique(bitSetOf(0), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(1), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(9), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(10), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(), is(true));
> }
> @Test void testColumnUniquenessForJoinOnAggregation() {
>   final String sql = ""
>  + "select *\n"
>  + "from emp A\n"
>  + "join (\n"
>  + "  select max(empno) AS maxno from emp) B\n"
>  + "on A.empno = B.maxno";
>   sql(sql)
>   .assertThatAreColumnsUnique(bitSetOf(0), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(9), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(1), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(), is(true));
> }
> @Test void testColumnUniquenessForCorrelatedSubquery() {
>   final String sql = ""
>  + "select *\n"
>  + "from emp A\n"
>  + "where empno = (\n"
>  + "  select max(empno) from emp)";
>   sql(sql)
>   .assertThatAreColumnsUnique(bitSetOf(0), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(1), is(true))
>   .assertThatAreColumnsUnique(bitSetOf(), is(true));
> } {code}
>  



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


[jira] [Updated] (CALCITE-6140) Add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

caicancai updated CALCITE-6140:
---
Summary: Add percentile test on SqlParserTest  (was: add percentile test on 
SqlParserTest)

> Add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Comment Edited] (CALCITE-6140) add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790631#comment-17790631
 ] 

caicancai edited comment on CALCITE-6140 at 11/28/23 3:41 PM:
--

h1. The results of percentile test seem to be a little different from the 
results of percentile_cont and percentile_disc. I'm not sure if this is a bug


was (Author: JIRAUSER302115):
h1. The results of percentile test seem to be a little different from the 
results of percentile_cont and percentile_disc.

> add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] (CALCITE-6140) add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ https://issues.apache.org/jira/browse/CALCITE-6140 ]


caicancai deleted comment on CALCITE-6140:


was (Author: JIRAUSER302115):
h1. The results of percentile test seem to be a little different from the 
results of percentile_cont and percentile_disc.

> add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) add percentile test on SqlParserTest

2023-11-28 Thread caicancai (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790631#comment-17790631
 ] 

caicancai commented on CALCITE-6140:


h1. The results of percentile test seem to be a little different from the 
results of percentile_cont and percentile_disc.

> add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: caicancai
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Commented] (CALCITE-6140) add percentile test on SqlParserTest

2023-11-28 Thread Jira


[ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790628#comment-17790628
 ] 

蔡灿材 commented on CALCITE-6140:
--

h1. The results of percentile test seem to be a little different from the 
results of percentile_cont and percentile_disc.

> add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: 蔡灿材
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Updated] (CALCITE-6140) add percentile test on SqlParserTest

2023-11-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated CALCITE-6140:

Labels: pull-request-available  (was: )

> add percentile test on SqlParserTest
> 
>
> Key: CALCITE-6140
> URL: https://issues.apache.org/jira/browse/CALCITE-6140
> Project: Calcite
>  Issue Type: Test
>  Components: tests
>Affects Versions: 1.36.0
>Reporter: 蔡灿材
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Missing percentile test examples



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


[jira] [Created] (CALCITE-6140) add percentile test on SqlParserTest

2023-11-28 Thread Jira
蔡灿材 created CALCITE-6140:


 Summary: add percentile test on SqlParserTest
 Key: CALCITE-6140
 URL: https://issues.apache.org/jira/browse/CALCITE-6140
 Project: Calcite
  Issue Type: Test
  Components: tests
Affects Versions: 1.36.0
Reporter: 蔡灿材
 Fix For: 1.37.0


Missing percentile test examples



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


[jira] [Commented] (CALCITE-6126) Return type check fails with OVER

2023-11-28 Thread Paul Jackson (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790589#comment-17790589
 ] 

Paul Jackson commented on CALCITE-6126:
---

[~julianhyde]  I'm sorry. I notified you on the wrong ticket.

> Return type check fails with OVER
> -
>
> Key: CALCITE-6126
> URL: https://issues.apache.org/jira/browse/CALCITE-6126
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Paul Jackson
>Priority: Major
>
> The following {{RelMetadataTest}} test fails:
> {{@Test void testOverNoPartitioning() {}}
> {{  sql("select max(empno) over (rows between 2 preceding and 0 following) 
> from emp")}}
> {{    .assertThatAreColumnsUnique(bitSetOf(0), is(false))}}
> {{    .assertThatUniqueKeysAre();}}
> {{}}}
> With this error:
> {{java.lang.AssertionError: Conversion to relational algebra failed to 
> preserve datatypes:}}
> {{validated type:}}
> {{RecordType(INTEGER EXPR$0) NOT NULL}}
> {{converted type:}}
> {{RecordType(INTEGER NOT NULL EXPR$0) NOT NULL}}
> {{rel:}}
> {{LogicalProject(EXPR$0=[MAX($0) OVER ()])}}
> {{  LogicalTableScan(table=[[CATALOG, SALES, EMP]])}}
> {{ at 
> org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:507)}}
> {{ at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:622)}}
> {{ at 
> org.apache.calcite.sql.test.AbstractSqlTester.convertSqlToRel2(AbstractSqlTester.java:541)}}
> {{ at 
> org.apache.calcite.sql.test.SqlTester.convertSqlToRel(SqlTester.java:291)}}
> {{ at 
> org.apache.calcite.test.RelMetadataFixture.sqlToRel(RelMetadataFixture.java:189)}}
> {{ at 
> org.apache.calcite.test.RelSupplier$SqlRelSupplier.apply2(RelSupplier.java:104)}}
> {{ at 
> org.apache.calcite.test.RelMetadataFixture.toRel(RelMetadataFixture.java:195)}}
> {{ at 
> org.apache.calcite.test.RelMetadataFixture.assertThatAreColumnsUnique(RelMetadataFixture.java:508)}}
>  



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


[jira] [Commented] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Egor Ryashin (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790569#comment-17790569
 ] 

Egor Ryashin commented on CALCITE-6139:
---

I guess this should fix that 
[https://github.com/apache/calcite-avatica-go/pull/71]

Tested manually.

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Francis Chuang
>Priority: Major
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Commented] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Egor Ryashin (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790535#comment-17790535
 ] 

Egor Ryashin commented on CALCITE-6139:
---

That *println* won't help, because it fails before  
[https://github.com/apache/calcite-avatica-go/blob/main/rows.go#L111 
|https://github.com/apache/calcite-avatica-go/blob/main/rows.go#L111]

I found out that the first frame comes here: 
`go-test/vendor/github.com/apache/calcite-avatica-go/v5/connection.go:205` 

The output of
{code:java}
fmt.Println("first frame ", resultSets[0].FirstFrame.Offset, 
len(resultSets[0].FirstFrame.Rows)){code}
is
{code:java}
first frame  0 5000{code}

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Francis Chuang
>Priority: Major
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Commented] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Francis Chuang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790507#comment-17790507
 ] 

Francis Chuang commented on CALCITE-6139:
-

Can you edit row.go per my previous comment so that we can see if the server is 
sending back the correct offset?

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Francis Chuang
>Priority: Major
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Commented] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Egor Ryashin (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790506#comment-17790506
 ] 

Egor Ryashin commented on CALCITE-6139:
---

Can be reproduced with this sample:
{code:go}
package main

import (
"database/sql"
"fmt"
"time"

_ "github.com/apache/calcite-avatica-go/v5"
)

func main() {
jdbcUrl := "http://localhost:8082/druid/v2/sql/avatica-protobuf;

db, err := sql.Open("avatica", jdbcUrl)
if err != nil {
panic(err)
}
defer func() {
err = db.Close()
if err != nil {
fmt.Println(err)
panic(err)
}
}()

sql5 := `
SELECT
bid_price, bid_price, publisher, __time, id, domain from test_data 
`

rows, err := db.Query(sql5)
if err != nil {
panic(err)
}
defer func() {
err = rows.Close()
if err != nil {
fmt.Println(err)
panic(err)
}
}()

var m1 float32
var m2 float32
var d, p any
var id int
var tm time.Time

for rows.Next() {
err := rows.Scan(, , , , , )
if err != nil {
panic(err)
}
}
if rows.Err() != nil {
panic(rows.Err())

}
}


  {code}

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Francis Chuang
>Priority: Major
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Commented] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Francis Chuang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17790504#comment-17790504
 ] 

Francis Chuang commented on CALCITE-6139:
-

Please run `go mod vendor` in your project to use vendoring and edit `row.go` 
to add `fmt.Println(frame)` here: 
[https://github.com/apache/calcite-avatica-go/blob/main/rows.go#L111]

When you do that, is offset populated in the frame returned from the server?

> Avatica-Go sends the same offset for the FetchRequest
> -
>
> Key: CALCITE-6139
> URL: https://issues.apache.org/jira/browse/CALCITE-6139
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica-go
>Affects Versions: avatica-go-5.2.0
>Reporter: Egor Ryashin
>Assignee: Francis Chuang
>Priority: Major
>
> This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
> {_}"Druid can only fetch forward. Requested offset”{_}.
> I tried to debug that and saw that any simple query fails if it triggers 
> fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
> is sent
> {code:java}
> msg := {
> StatementHandle:    s.handle,
> ParameterValues:    s.parametersToTypedValues(args),
> FirstFrameMaxSize:  s.conn.config.frameMaxSize,
> HasParameterValues: true,
> }{code}
> and the result set is created after
> {code:java}
> rsets = append(rsets, {
> columns: columns,
> done:    frame.Done,
> offset:  frame.Offset,
> data:    data,
> }){code}
> then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
> (the data for that offset was returned with the {*}ExecuteRequest{*})
> res, err := r.conn.httpClient.post(context.Background(), 
> {
> {code:java}
> ConnectionId: r.conn.connectionId,
> StatementId:  r.statementID,
> Offset:   resultSet.offset,
> FrameMaxSize: r.conn.config.frameMaxSize,
> }){code}
> So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
> makes Druid to fail.



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


[jira] [Created] (CALCITE-6139) Avatica-Go sends the same offset for the FetchRequest

2023-11-28 Thread Egor Ryashin (Jira)
Egor Ryashin created CALCITE-6139:
-

 Summary: Avatica-Go sends the same offset for the FetchRequest
 Key: CALCITE-6139
 URL: https://issues.apache.org/jira/browse/CALCITE-6139
 Project: Calcite
  Issue Type: Bug
  Components: avatica-go
Affects Versions: avatica-go-5.2.0
Reporter: Egor Ryashin
Assignee: Francis Chuang


This exception happens when *Apache Druid Avatica* protobuf endpoint is used: 
{_}"Druid can only fetch forward. Requested offset”{_}.
I tried to debug that and saw that any simple query fails if it triggers 
fetching of multiple frames. I speculate that when the first *ExucuteRequest* 
is sent


{code:java}
msg := {
StatementHandle:    s.handle,
ParameterValues:    s.parametersToTypedValues(args),
FirstFrameMaxSize:  s.conn.config.frameMaxSize,
HasParameterValues: true,
}{code}


and the result set is created after


{code:java}
rsets = append(rsets, {
columns: columns,
done:    frame.Done,
offset:  frame.Offset,
data:    data,
}){code}


then for the next frame *FetchRequest* is sent but it uses the same 0 offset 
(the data for that offset was returned with the {*}ExecuteRequest{*})

res, err := r.conn.httpClient.post(context.Background(), {
{code:java}
ConnectionId: r.conn.connectionId,
StatementId:  r.statementID,
Offset:   resultSet.offset,
FrameMaxSize: r.conn.config.frameMaxSize,
}){code}


So, in short, I think *Avatica-Go* sends 2 requests with the same offset that 
makes Druid to fail.



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