[jira] [Created] (CALCITE-3375) calcite concat function

2019-09-26 Thread cui (Jira)
cui created CALCITE-3375:


 Summary: calcite concat function
 Key: CALCITE-3375
 URL: https://issues.apache.org/jira/browse/CALCITE-3375
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.21.0
Reporter: cui


I use calcite to connect mysql to test, I have two column test data , age(int) 
and name(varchar) and the table name is test.score_new, and I have two row test 
data following:
--

id  nameage
--

1   飞   16
--
when I use the sql : select '飞'||16 or select '飞'||'16' , it will return the 
right result : EXPR$0=飞16
But when I use the sql : select "name"||"age" from "test"."score_new", it will 
return the result : EXPR$0=1,
and sql : select "sid"||"sid" from "test"."score_new", it will return : 
EXPR$0=1,
and sql : select "name"||"name" from "test"."score_new", it will return : 
EXPR$0=0,
the result is not what I want, I want to get the result : 飞16, why ? and How to 
solve this problem



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (CALCITE-3235) Add CONCAT function for Redshift

2019-09-25 Thread cui (Jira)


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

cui commented on CALCITE-3235:
--

I use calcite to connect mysql to test, I have two column test data , age(int) 
and name(varchar) and the table name is test.score_new, and I have two row test 
data following:
++-+-+
| id | name| age |
++-+-+
|  1 | 飞  |  16 |
++-+-+
when I use the sql : select '飞'||16 or select '飞'||'16' , it will return the 
right result : EXPR$0=飞16
But when I use the sql : select "name"||"age" from "test"."score_new", it will 
return the result : EXPR$0=1,
and sql : select "sid"||"sid" from "test"."score_new", it will return : 
EXPR$0=1,
and sql : select "name"||"name" from "test"."score_new", it will return : 
EXPR$0=0,
the result is not what I want, I want to get the result : 飞16, why ? and How to 
solve this problem

> Add CONCAT function for Redshift
> 
>
> Key: CALCITE-3235
> URL: https://issues.apache.org/jira/browse/CALCITE-3235
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Ryan Fu
>Assignee: Julian Hyde
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.21.0
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Get this error:
> {{No match found for function signature CONCAT(, , 
> ...)}}
> When using CONCAT, e.g.
> {{SELECT CONCAT('a', city) FROM public.aircraft}}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (CALCITE-3351) calcite mysql utf8 throws exception in Chinese

2019-09-16 Thread cui (Jira)


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

cui commented on CALCITE-3351:
--

Thanks for translating,this is the first to commit JIRA,next I will commit in 
English.

> calcite mysql utf8 throws exception in Chinese
> --
>
> Key: CALCITE-3351
> URL: https://issues.apache.org/jira/browse/CALCITE-3351
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.19.0
> Environment: Happened on both Windows and MacOS.
>Reporter: cui
>Priority: Major
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Exception was thrown when connecting with mySQL to query Chinese. The 
> following SQL was executed: 
> select * from \"test\".\"score_new\" where \"name\"= \'催\' limit 1
> ,if change "getDefaultCharset" in  "RelDataTypeFactoryImpl" to 
> return Charset.forName("UTF8");
> there will be also exception thrown as the following:
> java.sql.SQLException: Error while executing SQL "select * from 
> "test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT 
> *java.sql.SQLException: Error while executing SQL "select * from 
> "test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT 
> *FROM `score_new`WHERE `name` = u&'\50ac'LIMIT 1] on JDBC sub-schema at 
> org.apache.calcite.avatica.Helper.createException(Helper.java:56) at 
> org.apache.calcite.avatica.Helper.createException(Helper.java:41) at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
>  at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
>  at QueryMysql.main(QueryMysql.java:42)Caused by: java.lang.RuntimeException: 
> While executing SQL [SELECT *FROM `score_new`WHERE `name` = u&'\50ac'



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Created] (CALCITE-3351) calcite mysql utf8中文查询报错

2019-09-16 Thread cui (Jira)
cui created CALCITE-3351:


 Summary: calcite mysql utf8中文查询报错
 Key: CALCITE-3351
 URL: https://issues.apache.org/jira/browse/CALCITE-3351
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.19.0
 Environment: 无论是windows还是mac,都会出同样的错误
Reporter: cui


发现连接mysql进行中文查询时候,执行这条sql:

select * from \"test\".\"score_new\" where \"name\"= \'催\' limit 1报错

,后来修改了RelDataTypeFactoryImpl的

getDefaultCharset方法为

return Charset.forName("UTF8");

还是报错,报错如下:

java.sql.SQLException: Error while executing SQL "select * from 
"test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT 
*java.sql.SQLException: Error while executing SQL "select * from 
"test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT 
*FROM `score_new`WHERE `name` = u&'\50ac'LIMIT 1] on JDBC sub-schema at 
org.apache.calcite.avatica.Helper.createException(Helper.java:56) at 
org.apache.calcite.avatica.Helper.createException(Helper.java:41) at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
 at 
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
 at QueryMysql.main(QueryMysql.java:42)Caused by: java.lang.RuntimeException: 
While executing SQL [SELECT *FROM `score_new`WHERE `name` = u&'\50ac'



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Created] (CALCITE-2004) The TableFunction left outer join was improperly translated

2017-10-08 Thread Xingcan Cui (JIRA)
Xingcan Cui created CALCITE-2004:


 Summary: The TableFunction left outer join was improperly 
translated
 Key: CALCITE-2004
 URL: https://issues.apache.org/jira/browse/CALCITE-2004
 Project: Calcite
  Issue Type: Bug
Reporter: Xingcan Cui
Assignee: Julian Hyde


Currently the TableFunction left outer join is translated to a 
{{LogicalCorrelate}} followed by a {{LogicalFilter}}. For instance, given a 
simple table {{WordCount(word:String, frequency:Int)}}, a table function 
{{split: word:String => (letter:String, length:String)}}, and a query {{SELECT 
word, letter, length FROM WordCount LEFT JOIN LATERAL TABLE(split(word)) AS T 
(letter, length) ON frequency = length OR length < 5"}} the query will be 
translated to the logical plan below.
{code:java}
LogicalProject(word=[$0], name=[$2], length=[$3])
  LogicalFilter(condition=[OR(=($1, CAST($3):BIGINT), <($3, 5))])
LogicalCorrelate(correlation=[$cor0], joinType=[left], 
requiredColumns=[{0}])
  LogicalTableScan(table=[[WordCount]])
  LogicalTableFunctionScan(invocation=[split($cor0.word)], 
rowType=[RecordType(VARCHAR(65536) _1, INTEGER _2)], elementType=[class 
[Ljava.lang.Object;])
{code}
With this plan, an outer row might be completely filtered out (instead of being 
padded with null) if the join predicate filter filters out all join results 
produced by a correlate join for the outer row. Maybe we should attach the 
filter to the correlate operation.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)