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

StackOverflowError when running a JDBC query

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.14.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I've ran the following code:

      try (ResultSet rs = statement.executeQuery(
                      "SELECT p.name, r.views " +
                          "FROM reports.a as r " +
                          "INNER JOIN main.b as p ON p.id = CAST(r.p_id AS INT) AND p.id = 196 " +
                          "WHERE p.id = 196 " +
                          "AND r.p_id = 196 " +
                          "AND r.data_timestamp = TIMESTAMP '2017-11-14 00:00:00'  " )) {
      

      And I'm getting the following StackOverflowError:

      Exception in thread "main" java.lang.StackOverflowError
      	at com.google.common.collect.ImmutableList.indexOf(ImmutableList.java:339)
      	at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source)
      	at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source)
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:235)
      	at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:71)
      	at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source)
      	at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source)
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:235)
      	at org.apache.calcite.rel.metadata.RelMdUtil.estimateFilteredRows(RelMdUtil.java:718)
      	at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:123)
      	at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source)
      	at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source)
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:235)
      	at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:71)
      	at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source)
      	at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source)
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:235)
      	at org.apache.calcite.rel.metadata.RelMdUtil.estimateFilteredRows(RelMdUtil.java:718)
      	at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:123)
      	at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source)
      	at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source)
      ...
      

      It's solved by removing "AND p.id = 196" from the INNER JOIN, but it's still worth fixing.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                eysegal Eyal Segal
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: