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

Mihai Budiu resolved CALCITE-7413.
----------------------------------
    Fix Version/s: 1.42.0
       Resolution: Fixed

Fixed in 
[https://github.com/apache/calcite/commit/dd34021fbc30381e8f20fb51666cef9e6c69d3e6]

Thank you for the bug report and contribution [~terran2010] 

> Add Concat and  Substring function (enabled in Mongodb library)
> ---------------------------------------------------------------
>
>                 Key: CALCITE-7413
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7413
>             Project: Calcite
>          Issue Type: New Feature
>          Components: mongodb-adapter
>    Affects Versions: 1.41.0
>            Reporter: terran2010
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.42.0
>
>
> The SQL:
> {code}
> SELECT city || ' ' || state  from zips{code}
> Currently reporting errors:
> {code:java}
> Caused by: java.lang.IllegalStateException: Unable to implement 
> EnumerableCalc(expr#0..1=[{inputs}], EXPR$0=[$t0]): rowcount = 100.0, 
> cumulative cost = {135.0 rows, 800.6170185988092 cpu, 0.0 io}, id = 63
>   MongoToEnumerableConverter: rowcount = 100.0, cumulative cost = {35.0 rows, 
> 500.6170185988092 cpu, 0.0 io}, id = 61
>     MongoSort(sort0=[$1], dir0=[ASC]): rowcount = 100.0, cumulative cost = 
> {25.0 rows, 490.6170185988092 cpu, 0.0 io}, id = 59
>       MongoProject(EXPR$0=[||(||(CAST(ITEM($0, 'city')):VARCHAR(20), ' '), 
> CAST(ITEM($0, 'state')):VARCHAR(2))], POP=[CAST(ITEM($0, 'pop')):INTEGER]): 
> rowcount = 100.0, cumulative cost = {20.0 rows, 30.1 cpu, 0.0 io}, id = 57
>         MongoTableScan(table=[[mongo_raw, zips]]): rowcount = 100.0, 
> cumulative cost = {10.0 rows, 10.100000000000001 cpu, 0.0 io}, id = 13
>  {code}
> The SQL:
> {code:java}
> SELECT SUBSTRING(city FROM 1 FOR 2) from zips {code}
> Currently reporting errors:
> {code:java}
> Caused by: java.lang.IllegalStateException: Unable to implement 
> EnumerableCalc(expr#0..1=[{inputs}], EXPR$0=[$t0]): rowcount = 100.0, 
> cumulative cost = {135.0 rows, 800.6170185988092 cpu, 0.0 io}, id = 63
>   MongoToEnumerableConverter: rowcount = 100.0, cumulative cost = {35.0 rows, 
> 500.6170185988092 cpu, 0.0 io}, id = 61
>     MongoSort(sort0=[$1], dir0=[ASC]): rowcount = 100.0, cumulative cost = 
> {25.0 rows, 490.6170185988092 cpu, 0.0 io}, id = 59
>       MongoProject(EXPR$0=[SUBSTRING(CAST(ITEM($0, 'city')):VARCHAR(20), 1, 
> 2)], POP=[CAST(ITEM($0, 'pop')):INTEGER]): rowcount = 100.0, cumulative cost 
> = {20.0 rows, 30.1 cpu, 0.0 io}, id = 57
>         MongoTableScan(table=[[mongo_raw, zips]]): rowcount = 100.0, 
> cumulative cost = {10.0 rows, 10.100000000000001 cpu, 0.0 io}, id = 13
>  {code}
> We can consider increasing support for the Concat and  Substring  function, 
> Because it is frequently used



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

Reply via email to