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

"SELECT DISTINCT *" gives ClassCastException at runtime

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.2-incubating
    • Component/s: None
    • Labels:
      None

      Description

      Given the query

      select distinct *
      from "hr"."emps"
      

      Optiq gives the error

      Caused by: java.lang.ClassCastException: net.hydromatic.optiq.test.JdbcTest$Employee cannot be cast to [Ljava.lang.Object;
      	at net.hydromatic.linq4j.function.Functions$ArrayEqualityComparer.hashCode(Functions.java:491)
      	at net.hydromatic.linq4j.EnumerableDefaults$Wrapped.hashCode(EnumerableDefaults.java:2252)
      	at java.util.HashMap.hash(HashMap.java:338)
      	at java.util.HashMap.put(HashMap.java:611)
      	at java.util.HashSet.add(HashSet.java:219)
      	at net.hydromatic.linq4j.EnumerableDefaults.into(EnumerableDefaults.java:2120)
      	at net.hydromatic.linq4j.DefaultEnumerable.into(DefaultEnumerable.java:325)
      	at net.hydromatic.linq4j.EnumerableDefaults.distinct(EnumerableDefaults.java:405)
      	at net.hydromatic.linq4j.DefaultEnumerable.distinct(DefaultEnumerable.java:193)
      	at Baz.bind(Unknown Source)
      	at net.hydromatic.optiq.jdbc.OptiqPrepare$PrepareResult.getEnumerable(OptiqPrepare.java:270)
      

      Suspect that EnumerableAggregateRel is not generating its input record accessor correctly.

      I'll add a test case JdbcTest.testSelectDistinctStar shortly.

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: