[jira] [Commented] (CALCITE-3395) add BuiltinMethod for Substring(String, int)

2020-01-02 Thread Feng Zhu (Jira)


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

Feng Zhu commented on CALCITE-3395:
---

Hi, [~yuanyoujun].

In CALCITE-3563, we have added mechnism in code generation to intelligently 
figure out the proper method through overloaded ones.

I think it can solve this problem. Could you verify it?

> add BuiltinMethod for Substring(String, int)
> 
>
> Key: CALCITE-3395
> URL: https://issues.apache.org/jira/browse/CALCITE-3395
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Youjun Yuan
>Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> substring function has two versoins:
> 1, Substring(String, int, int)
> 2, Substring(String, int)
> currently in BuiltinMethod.java, only the first one is defined. Need to 
> define the second one as well, so that we can use both of them.
> Apache Flink(FunctionGenerator.scala), reference the BuiltinMethod, since 
> Calcite only defines 1, not 2, Flink always resolve SUBSTRING to 
> Substring(String, int, int) even if there is only 2 parameters. This problem 
> happens to be covered by method overloading of java, but it's still a 
> potential problem.



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


[jira] [Commented] (CALCITE-3395) add BuiltinMethod for Substring(String, int)

2019-10-21 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-3395:
--

I agree, it would be useful if we had an entry in BuiltInMethod for each 
overload.

> add BuiltinMethod for Substring(String, int)
> 
>
> Key: CALCITE-3395
> URL: https://issues.apache.org/jira/browse/CALCITE-3395
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Youjun Yuan
>Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> substring function has two versoins:
> 1, Substring(String, int, int)
> 2, Substring(String, int)
> currently in BuiltinMethod.java, only the first one is defined. Need to 
> define the second one as well, so that we can use both of them.
> Apache Flink(FunctionGenerator.scala), reference the BuiltinMethod, since 
> Calcite only defines 1, not 2, Flink always resolve SUBSTRING to 
> Substring(String, int, int) even if there is only 2 parameters. This problem 
> happens to be covered by method overloading of java, but it's still a 
> potential problem.



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


[jira] [Commented] (CALCITE-3395) add BuiltinMethod for Substring(String, int)

2019-10-20 Thread Youjun Yuan (Jira)


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

Youjun Yuan commented on CALCITE-3395:
--

Hi Julian,

 

For "addMonths", "overlay", we do have different entries for different 
versions, so adding another entry for "substring" would be a nature fix.

We are leveraging calcite to generate golang code, which does not support 
method overload, hence it's a PROBLEM for us. Though I can walk around this, I 
thought fixing it in calcite would make other's life a little bit easier (in 
similar scenario).

 

I'd like to contribute on this, once we agree it's the right way to go.

> add BuiltinMethod for Substring(String, int)
> 
>
> Key: CALCITE-3395
> URL: https://issues.apache.org/jira/browse/CALCITE-3395
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Youjun Yuan
>Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> substring function has two versoins:
> 1, Substring(String, int, int)
> 2, Substring(String, int)
> currently in BuiltinMethod.java, only the first one is defined. Need to 
> define the second one as well, so that we can use both of them.
> Apache Flink(FunctionGenerator.scala), reference the BuiltinMethod, since 
> Calcite only defines 1, not 2, Flink always resolve SUBSTRING to 
> Substring(String, int, int) even if there is only 2 parameters. This problem 
> happens to be covered by method overloading of java, but it's still a 
> potential problem.



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


[jira] [Commented] (CALCITE-3395) add BuiltinMethod for Substring(String, int)

2019-10-15 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-3395:
--

[~yuanyoujun], There are a few cases where we do code generation for functions 
that are overloaded. We don't check that the arguments match the parameter 
types of the method. It's not totally kosher but we get away with it, and I'm 
not too worried. The main goal of BuiltInMethod is impact analysis (finding all 
the places that we generate calls to String.substring) and for that it works.

> add BuiltinMethod for Substring(String, int)
> 
>
> Key: CALCITE-3395
> URL: https://issues.apache.org/jira/browse/CALCITE-3395
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Youjun Yuan
>Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> substring function has two versoins:
> 1, Substring(String, int, int)
> 2, Substring(String, int)
> currently in BuiltinMethod.java, only the first one is defined. Need to 
> define the second one as well, so that we can use both of them.
> Apache Flink(FunctionGenerator.scala), reference the BuiltinMethod, since 
> Calcite only defines 1, not 2, Flink always resolve SUBSTRING to 
> Substring(String, int, int) even if there is only 2 parameters. This problem 
> happens to be covered by method overloading of java, but it's still a 
> potential problem.



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


[jira] [Commented] (CALCITE-3395) add BuiltinMethod for Substring(String, int)

2019-10-09 Thread Danny Chen (Jira)


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

Danny Chen commented on CALCITE-3395:
-

Calcite support 2 style of subString function:

# One is SUBSTRING(str FROM pos FOR len) defined in SqlStdOperatorTable[1]
# Another is SUBSTR(string, position [, substringLength ]) defined in 
SqlLibraryOperators as a ORACLE dialect operator[2]

[1] 
https://github.com/apache/calcite/blob/e43595482617b1bb991407800c068a0c727e5c17/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java#L1443
[2] 
https://github.com/apache/calcite/blob/e43595482617b1bb991407800c068a0c727e5c17/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L118

> add BuiltinMethod for Substring(String, int)
> 
>
> Key: CALCITE-3395
> URL: https://issues.apache.org/jira/browse/CALCITE-3395
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Youjun Yuan
>Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> substring function has two versoins:
> 1, Substring(String, int, int)
> 2, Substring(String, int)
> currently in BuiltinMethod.java, only the first one is defined. Need to 
> define the second one as well, so that we can use both of them.
> Apache Flink(FunctionGenerator.scala), reference the BuiltinMethod, since 
> Calcite only defines 1, not 2, Flink always resolve SUBSTRING to 
> Substring(String, int, int) even if there is only 2 parameters. This problem 
> happens to be covered by method overloading of java, but it's still a 
> potential problem.



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