calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: calling CsvScannableTable twice
Date Fri, 18 Dec 2015 18:07:55 GMT
I'd only expect scan to be called once. I see you are using bind
variables (and hence prepare-execute rather than the usual execute) so
that might make a difference. Can you please log a bug and include the
stack trace for each place that scan is called. (Adding "new
RuntimeException().printStackTrace();" to scan should do the trick.

On Fri, Dec 18, 2015 at 9:21 AM, CPC <achalil@gmail.com> wrote:
> Hi josh,
>
> I am using 1.5.0 version.
>
> On 18 December 2015 at 18:49, Josh Elser <josh.elser@gmail.com> wrote:
>
>> CPC wrote:
>>
>>> Hi,
>>>
>>> I just noticed something when i am playing with examples.
>>>
>>>    Class.forName("org.apache.calcite.jdbc.Driver")
>>>
>>>>    val properties: Properties = new Properties()
>>>>
>>>>    properties.setProperty("caseSensitive","true")
>>>>
>>>>    val connection = DriverManager.getConnection("jdbc:calcite:",
>>>> properties)
>>>>
>>>>    val calciteConnection=connection.unwrap(classOf[CalciteConnection])
>>>>
>>>>
>>>>    val schema= (new
>>>>>
>>>>> CsvSchemaFactory()).create(calciteConnection.getRootSchema,null,Map[String,AnyRef]("directory"
>>>>> ->  "src/main/resources/csv","flavor" ->  "scannable").asJava)
>>>>>
>>>>
>>>>    calciteConnection.getRootSchema.add("TEST",schema)
>>>>>
>>>>
>>>>    val statement2=calciteConnection.prepareStatement("select \"tarih\"
>>>>> from \"TEST\".\"timeseries\" where \"sensor\" = ?")
>>>>>
>>>>
>>>>    statement2.setString(1,"sensor38")
>>>>>
>>>>    val resultSet1=statement2.executeQuery()
>>>>
>>>>    while(resultSet1.next())
>>>>
>>>>      println(resultSet1.getString("tarih"))
>>>>
>>>>
>>>>
>>> My example like above. But when i call executeQuery  i noticed
>>> that CsvScannableTable.scan called twice and enumerator iterating on
>>> values. When i inspected stacktraces i found that one of the call come
>>> from
>>> AvaticaConnection.java:463 and the other one  is AvaticaConnection:481 .
>>> Is
>>> this a normal behaviour or bug?
>>>
>>>
>> Can you share what version of Calcite you are using, please?
>>

Mime
View raw message