[
https://issues.apache.org/jira/browse/CALCITE-3443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16959352#comment-16959352
]
huaicui commented on CALCITE-3443:
----------------------------------
[~julianhyde]
I try to use UT to test according you solution, but it doesn't work;
UT test class: RemotePreparedStatementParametersTest
@Test public void testSimpleStringParameterShouldWorkWithCalcite() throws
Exception {
// given
ChinookAvaticaServer server = new ChinookAvaticaServer();
server.startWithCalcite();
Connection connection = DriverManager.getConnection(server.getURL());
// when
// PreparedStatement pS = connection.prepareStatement("SELECT
TIMESTAMPDIFF(day, CAST('2019-01-01' AS DATE), CAST(? AS day))>0 as sent");
PreparedStatement pS = connection.prepareStatement("SELECT TIMESTAMPDIFF(d,
CAST('2019-01-01' AS DATE), CAST(? AS day))>0 as sent");
pS.setString(1, "2019-02-01");
// then
ResultSet resultSet = pS.executeQuery();
server.stop();
}
But that throw other exception: doesn't parse TimeUnit d
> Doesn't parse PreparedStatement successfully for there are placeholders in
> select area
> --------------------------------------------------------------------------------------
>
> Key: CALCITE-3443
> URL: https://issues.apache.org/jira/browse/CALCITE-3443
> Project: Calcite
> Issue Type: Bug
> Components: avatica
> Affects Versions: 1.21.0
> Environment: linux, mac
> Reporter: huaicui
> Priority: Major
>
> Calcite isn't able to parse the sql that there is a placeholder in select
> area, like this:
> {
> "sql":"SELECT TIMESTAMPDIFF(day, CAST('2019-01-01' AS DATE), CAST(? AS
> DATE))>0 as sent",
> "params":[
> {
> "className":"java.lang.String",
> "value":"2019-09-02"
> }
> ]
> }
> We have a scenario that need to set palceholder in select area, please help
> to fix that;
--
This message was sent by Atlassian Jira
(v8.3.4#803005)