You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "zhen wang (JIRA)" <ji...@apache.org> on 2015/12/14 16:22:46 UTC

[jira] [Comment Edited] (CALCITE-1015) AssertionError: trivial sort out of cartesian join offset 0

    [ https://issues.apache.org/jira/browse/CALCITE-1015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15056090#comment-15056090 ] 

zhen wang edited comment on CALCITE-1015 at 12/14/15 3:22 PM:
--------------------------------------------------------------

/Users/awang/workspace/apache/calcite/core/src/main/java/org/apache/calcite/rel/core/Sort.java
{code}
    assert !(fetch == null
        && offset == null
        && collation.getFieldCollations().isEmpty())
        : "trivial sort";
{code}

removing the assertion yield correct result. 
sort node occurs simply because of the `offset` in query.  what is a trivial sort anyways? meaning no sort need to be performed?  

it feels to me this is not that important, will someone specify `offset 0` ?


was (Author: zhenw):
/Users/awang/workspace/apache/calcite/core/src/main/java/org/apache/calcite/rel/core/Sort.java
{code}
    assert !(fetch == null
        && offset == null
        && collation.getFieldCollations().isEmpty())
        : "trivial sort";
{code}

removing the assertion yield correct result. 
sort node occurs simply because of the `offset` in query.  what is a trivial sort anyways? meaning no sort need to be performed?  

> AssertionError: trivial sort out of cartesian join offset 0
> -----------------------------------------------------------
>
>                 Key: CALCITE-1015
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1015
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>
> {code:sql}select a."value" a, b."value" b from "bools" a, "bools" b offset 0{code}
> {noformat}
> Error while executing command OkCommand [sql: select a."value" a, b."value" b from "bools" a, "bools" b offset 0
> ]
> java.lang.AssertionError: Internal error: While invoking method 'public org.apache.calcite.sql2rel.RelFieldTrimmer$TrimResult org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(org.apache.calcite.rel.core.Sort,org.apache.calcite.util.ImmutableBitSet,java.util.Set)'
>         at org.apache.calcite.util.Util.newInternal(Util.java:792)
>         at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
>         at org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:248)
>         at org.apache.calcite.sql2rel.RelFieldTrimmer.trim(RelFieldTrimmer.java:155)
>         at org.apache.calcite.sql2rel.SqlToRelConverter.trimUnusedFields(SqlToRelConverter.java:520)
>         at org.apache.calcite.prepare.Prepare.trimUnusedFields(Prepare.java:347)
>         at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:264)
>         at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:190)
>         at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:727)
>         at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:586)
>         at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:556)
>         at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:214)
>         at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:573)
>         at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:571)
>         at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:136)
>         at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:186)
>         at net.hydromatic.quidem.Quidem$CheckResultCommand.execute(Quidem.java:778)
>         at net.hydromatic.quidem.Quidem$CompositeCommand.execute(Quidem.java:1312)
>         at net.hydromatic.quidem.Quidem.execute(Quidem.java:171)
>         at org.apache.calcite.test.JdbcTest.checkRun(JdbcTest.java:4801)
>         at org.apache.calcite.test.JdbcTest.testBooleansInWhere(JdbcTest.java:4317)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
>         at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>         at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
>         at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
>         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
>         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
>         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>         at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
>         at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
>         at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
>         at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>         ... 45 more
> Caused by: java.lang.AssertionError: trivial sort
>         at org.apache.calcite.rel.core.Sort.<init>(Sort.java:96)
>         at org.apache.calcite.rel.logical.LogicalSort.<init>(LogicalSort.java:37)
>         at org.apache.calcite.rel.logical.LogicalSort.create(LogicalSort.java:63)
>         at org.apache.calcite.rel.core.RelFactories$SortFactoryImpl.createSort(RelFactories.java:141)
>         at org.apache.calcite.tools.RelBuilder.sortLimit(RelBuilder.java:1263)
>         at org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:491)
>         ... 50 more
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)