[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ordering of columns during a join

For more context, testEquiThetaJoin fails due to the following diff in output:

Expected: is "empid=100; name=Sales; name=Bill\nempid=150; name=Sales;
name=Sebastian\nempid=110; name=Sales; name=Theodore\n"
     but: was "empid=10; name=Bill; name=100\nempid=10;
name=Sebastian; name=150\nempid=10; name=Theodore; name=110\n"

and testNotInEmptyQuery fails with:

Caused by: java.lang.ClassCastException: java.base/java.lang.Long
cannot be cast to java.base/java.lang.Integer
at Baz$19.apply(Unknown Source)
at Baz$19.apply(Unknown Source)
at org.apache.calcite.linq4j.EnumerableDefaults$10$1.moveNext(EnumerableDefaults.java:1140)
at Baz$22$1.moveNext(Unknown Source)
at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.<init>(Linq4j.java:680)
at org.apache.calcite.linq4j.Linq4j.enumeratorIterator(Linq4j.java:98)
at org.apache.calcite.linq4j.AbstractEnumerable.iterator(AbstractEnumerable.java:33)
at org.apache.calcite.avatica.MetaImpl.createCursor(MetaImpl.java:82)
at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:174)
at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)

All of these are failing due to incorrect ordering of columns, I am
just not sure how/where.

On Tue, May 22, 2018 at 6:56 PM, Atri Sharma <atri.jiit@xxxxxxxxx> wrote:
> Hi All,
> As an experiment, I switched the order of inputs to
> EnumerableDefaults::join_ during the implementation stage of
> EnumerableJoin if the Join type is Inner. Since there will be no need
> to generate nulls on either side, I would assume that the choice of
> the side being built and the side being probed would not make a
> difference in the result.
> However, I see multiple test failures. On further investigation, I saw
> that the failures are coming due to change in order of the columns and
> due to the fact that a different column is being built now. For e.g.,
> testInnerJoinValues fails with the following stack:
> Caused by: java.lang.NumberFormatException: For input string: "SameName"
> at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.base/java.lang.Integer.parseInt(Integer.java:652)
> at java.base/java.lang.Integer.parseInt(Integer.java:770)
> at org.apache.calcite.runtime.SqlFunctions.toInt(SqlFunctions.java:1571)
> at org.apache.calcite.runtime.SqlFunctions.toInt(SqlFunctions.java:1581)
> at Baz$4$1.moveNext(Unknown Source)
> at org.apache.calcite.linq4j.EnumerableDefaults.groupBy_(EnumerableDefaults.java:825)
> at org.apache.calcite.linq4j.EnumerableDefaults.groupBy(EnumerableDefaults.java:761)
> at org.apache.calcite.linq4j.DefaultEnumerable.groupBy(DefaultEnumerable.java:302)
> at Baz.bind(Unknown Source)
> at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:365)
> at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:301)
> at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:559)
> at org.apache.calcite.jdbc.Calcite
> Can someone please advise?
> The current code is at:
> https://github.com/atris/calcite/tree/join_side_temp
> Regards,
> Atri