[jira] [Resolved] (CALCITE-5931) Allow integers like 1.00 in window frame

2023-09-09 Thread Jiajun Xie (Jira)


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

Jiajun Xie resolved CALCITE-5931.
-
Resolution: Fixed

> Allow integers like 1.00 in window frame
> 
>
> Key: CALCITE-5931
> URL: https://issues.apache.org/jira/browse/CALCITE-5931
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Claude Brisson
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> When a number of rows is specified for a window, the code checks that the 
> provided literal is an integral number.
> But the provided check leaves aside numbers like "1.00" (with a scale of 2, 
> but with trailing zeros).
>  



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


[jira] [Commented] (CALCITE-5931) Allow integers like 1.00 in window frame

2023-09-09 Thread Jiajun Xie (Jira)


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

Jiajun Xie commented on CALCITE-5931:
-

Fixed in 
[d4046d0|https://github.com/apache/calcite/commit/d4046d027450bb792481fae46af76719d562c904]

 

Thanks PR for [~cbrisson] , thanks review for [~julianhyde].

> Allow integers like 1.00 in window frame
> 
>
> Key: CALCITE-5931
> URL: https://issues.apache.org/jira/browse/CALCITE-5931
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Claude Brisson
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> When a number of rows is specified for a window, the code checks that the 
> provided literal is an integral number.
> But the provided check leaves aside numbers like "1.00" (with a scale of 2, 
> but with trailing zeros).
>  



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


[jira] [Updated] (CALCITE-5974) Elasticsearch adapter throws ClassCastException when index mapping sets dynamic_templates without properties

2023-09-09 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot updated CALCITE-5974:

Labels: pull-request-available  (was: )

> Elasticsearch adapter throws ClassCastException when index mapping sets 
> dynamic_templates without properties
> 
>
> Key: CALCITE-5974
> URL: https://issues.apache.org/jira/browse/CALCITE-5974
> Project: Calcite
>  Issue Type: Bug
>Affects Versions: 1.35.0
>Reporter: zhaowang
>Assignee: zhaowang
>Priority: Major
>  Labels: pull-request-available
>
> When we use the elasticsearch-adapter, as we config an elasticsearch cluster, 
> it will fetchMapping during initialization.
> If a index set dynamic_templates bug no mappings like this:
>  
> {code:java}
> {
>   "test_index" : {
>     "mappings" : {
>       "dynamic_templates" : [
>         {
>           "integers" : {
>             "match_mapping_type" : "long",
>             "mapping" : {
>               "type" : "integer"
>             }
>           }
>         }
>       ]
>     }
>   }
> } {code}
> {{org.apache.calcite.adapter.elasticsearch.ElasticsearchJson#visitMappingProperties}}
>  throw exception:
>  
> {code:java}
> java.lang.ClassCastException: 
> com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to 
> com.fasterxml.jackson.databind.node.ObjectNode
> at
>  
> org.apache.calcite.adapter.elasticsearch.ElasticsearchJson.visitMappingProperties(ElasticsearchJson.java:133)
>   {code}
> So ElasticsearchTransport initialize failed, all index of this es cluster 
> access failed.



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


[jira] [Commented] (CALCITE-5974) Elasticsearch adapter throws ClassCastException when index mapping sets dynamic_templates without properties

2023-09-09 Thread zhaowang (Jira)


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

zhaowang commented on CALCITE-5974:
---

It's looks much more suitable, I will modify github issue.

> Elasticsearch adapter throws ClassCastException when index mapping sets 
> dynamic_templates without properties
> 
>
> Key: CALCITE-5974
> URL: https://issues.apache.org/jira/browse/CALCITE-5974
> Project: Calcite
>  Issue Type: Bug
>Affects Versions: 1.35.0
>Reporter: zhaowang
>Assignee: zhaowang
>Priority: Major
>
> When we use the elasticsearch-adapter, as we config an elasticsearch cluster, 
> it will fetchMapping during initialization.
> If a index set dynamic_templates bug no mappings like this:
>  
> {code:java}
> {
>   "test_index" : {
>     "mappings" : {
>       "dynamic_templates" : [
>         {
>           "integers" : {
>             "match_mapping_type" : "long",
>             "mapping" : {
>               "type" : "integer"
>             }
>           }
>         }
>       ]
>     }
>   }
> } {code}
> {{org.apache.calcite.adapter.elasticsearch.ElasticsearchJson#visitMappingProperties}}
>  throw exception:
>  
> {code:java}
> java.lang.ClassCastException: 
> com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to 
> com.fasterxml.jackson.databind.node.ObjectNode
> at
>  
> org.apache.calcite.adapter.elasticsearch.ElasticsearchJson.visitMappingProperties(ElasticsearchJson.java:133)
>   {code}
> So ElasticsearchTransport initialize failed, all index of this es cluster 
> access failed.



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


[jira] [Assigned] (CALCITE-5502) RelToSql converter generates where clause with window expression

2023-09-09 Thread Leonid Chistov (Jira)


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

Leonid Chistov reassigned CALCITE-5502:
---

Assignee: Leonid Chistov

> RelToSql converter generates where clause with window expression
> 
>
> Key: CALCITE-5502
> URL: https://issues.apache.org/jira/browse/CALCITE-5502
> Project: Calcite
>  Issue Type: Bug
>  Components: jdbc-adapter
>Affects Versions: 1.32.0
>Reporter: Leonid Chistov
>Assignee: Leonid Chistov
>Priority: Major
>
> Wrong SQL code is generated when Filter (or Calc) node contains window 
> expression.
> Example can be demonstrated by adding following code to 
> RelToSqlConverterTest.java:
> {code:java}
> @Test void testWindowedFilter() {
>   final RelBuilder builder = relBuilder();
>   final RelNode root = builder
>   .scan("DEPT")
>   .filter(
>   builder.lessThan(
> builder.aggregateCall(SqlStdOperatorTable.MAX, 
> builder.field("DEPTNO"))
> .over()
> .partitionBy(builder.field("DNAME"))
> .toRex(),
>   builder.literal(1)
>   )
>   )
>   .build();
>   final String expectedSql = "?";
>   assertThat(toSql(root), isLinux(expectedSql));
> } {code}
> Generated SQL code will look like:
> {code:java}
> SELECT *
> FROM \"scott\".\"DEPT\"
> WHERE (MAX(\"DEPTNO\") OVER (PARTITION BY \"DNAME\" RANGE BETWEEN UNBOUNDED 
> PRECEDING AND UNBOUNDED FOLLOWING)) < 1 {code}
> This is incorrect - window expressions are not allowed in WHERE clause by SQL 
> standard and Calcite itself would produce following error message if this SQL 
> code would be passed as input: 
> {code:java}
> Windowed aggregate expression is illegal in WHERE clause {code}
>  



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


[jira] [Commented] (CALCITE-5931) Allow integers like 1.00 in window frame

2023-09-09 Thread Claude Brisson (Jira)


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

Claude Brisson commented on CALCITE-5931:
-

Thanks for taking over the winagg.iq test. Code looks fine to me.

 

> Allow integers like 1.00 in window frame
> 
>
> Key: CALCITE-5931
> URL: https://issues.apache.org/jira/browse/CALCITE-5931
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Claude Brisson
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> When a number of rows is specified for a window, the code checks that the 
> provided literal is an integral number.
> But the provided check leaves aside numbers like "1.00" (with a scale of 2, 
> but with trailing zeros).
>  



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


[jira] [Resolved] (CALCITE-5980) QuidemTests are not effectively executed on Windows

2023-09-09 Thread Ruben Q L (Jira)


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

Ruben Q L resolved CALCITE-5980.

Resolution: Fixed

Fixed via  
[{{7176860}}|https://github.com/apache/calcite/commit/717686088265aeb1a1b3ba561748c6cb64e1b1b0]
 

> QuidemTests are not effectively executed on Windows
> ---
>
> Key: CALCITE-5980
> URL: https://issues.apache.org/jira/browse/CALCITE-5980
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Ruben Q L
>Assignee: Ruben Q L
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> Discovered by accident on my Windows+IntelliJ environment while I was trying 
> to add new tests on a *.iq file. My new tests did not seem to be executed. I 
> even tried adding syntax errors on purpose into different iq files to force 
> them to fail, but the tests were still successful. The reason seems to be 
> that, at least on my environment (Windows), the test files do not execute any 
> of their statements. This seems caused by the changes introduced in 
> CALCITE-5786.
> While debugging, I found this line in QuidemTest.java (that aims to create 
> the inFile and outFile):
> {code:java}
> protected void checkRun(String path) throws Exception {
>   ...
>   // e.g. path = "sql/agg.iq"
>   // inUrl = "file:/home/fred/calcite/core/build/resources/test/sql/agg.iq"
>   // inFile = "/home/fred/calcite/core/build/resources/test/sql/agg.iq"
>   // outDir = "/home/fred/calcite/core/build/quidem/test/sql"
>   // outFile = "/home/fred/calcite/core/build/quidem/test/sql/agg.iq"
>   inFile = Sources.of(requireNonNull(inUrl, "inUrl")).file();
>   outFile = replaceDir(inFile, "resources", "quidem");
>   ...
> }
> {code}
> But in my case it results on {*}both files being the same{*}, thus when the 
> outFile is created, it actually erases all the tests that were contained 
> inside the inFile, so the test runs nothing.
> The reason for that is that the auxiliary method {{{}replaceDir{}}}:
> {code:java}
>   private static File replaceDir(File file, String target, String 
> replacement) {
> return new File(
> file.getAbsolutePath().replace(n2u('/' + target + '/'),
> n2u('/' + replacement + '/')));
>   }
> {code}
> is trying to replace "/resources/" with "/quidem/" from the inFile absolute 
> path, but in my case this path does not contain the pattern to be replaced, 
> since it contains backslashes: 
> "C:\...\calcite\core\build\resources\test\sql\agg.iq"; so the replacement 
> operation does nothing.



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