Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1031

In prepared statement, CsvScannableTable.scan is called twice

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5.0
    • avatica-1.7.0, 1.7.0
    • avatica
    • None
    • jdk 1.8.0_20 linux mint 17.3

    Description

      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:489 .

      Attachments

        1. threads_report.txt
          3 kB
          Anıl Chalil
        2. threads_report2.txt
          3 kB
          Anıl Chalil

        Activity

          People

            zhenw Zhen Wang
            capacman Anıl Chalil
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: