Sorry, correction to the previous comments: the factory approach would work
well with Phoenix-only rels, but might be problematic with heuristic rel
tree containing more than one conventions. Actually the test case with
which I ran into this problem was about joining a Phoenix table with a
Hsqldb table.

Instead I think it might work the other way around: remove the default
instance, use one that matches LogicalFilter and LogicalProject. Tried it
with my existing test cases and it worked so far. Is that correct in theory?


Thanks,
Maryann

On Wed, Jun 24, 2015 at 10:37 PM, Maryann Xue <[email protected]> wrote:

> Just realized that aside from the filter and project factories, the
> constructor of FilterProjectTransposeRule also allow customizing matching
> classes, which I think will be enough for my use case even without the
> factories. But again, AggregateFilterTransposeRule does not have it.
>
>
> Thanks,
> Maryann
>
> On Wed, Jun 24, 2015 at 10:30 PM, Maryann Xue <[email protected]>
> wrote:
>
>> Thanks a lot for the idea, Julian! Think that'll work. But I suppose
>> other XXXTransposeRule might have the same issue, so should we add factory
>> method in those classes too if they don't yet have it? (for example,
>> AggregateFilterTransposeRule)
>>
>>
>> Thanks,
>> Maryann
>>
>> On Wed, Jun 24, 2015 at 6:42 PM, Julian Hyde <[email protected]> wrote:
>>
>>> Have you tried using your own instance of the rule, calling new
>>> FilterProjectTransposeRule with your sub-classes and your own
>>> factories?
>>>
>>> On Wed, Jun 24, 2015 at 2:33 PM, Maryann Xue <[email protected]>
>>> wrote:
>>> > The PhoenixServerProject checks the input convention in the
>>> Constructor and
>>> > if it's not a PhoenixRel convention, the above RuntimeException is
>>> thrown.
>>> >
>>> > On Wed, Jun 24, 2015 at 5:32 PM, Maryann Xue <[email protected]>
>>> wrote:
>>> >
>>> >> Hi Julian,
>>> >>
>>> >> Encountered the following exception when applying
>>> >> FilterProjectTransposeRule, which was due to the attempt of pushing a
>>> >> LogicalFilter (Convention NONE) on top of a PhoenixServerProject into
>>> the
>>> >> project.
>>> >>
>>> >> So I am wondering would it help if we prohibited XXXTransposeRule for
>>> >> RelNode of Convention.NONE on top of a RelNode of any other
>>> convention?
>>> >>
>>> >> java.lang.AssertionError: Internal error: Error while applying rule
>>> >> FilterProjectTransposeRule, args
>>> >>
>>> [rel#6280:LogicalFilter.NONE.[](input=rel#273:Subset#4.PHOENIX_SERVER.[],condition==(CAST($4):INTEGER,
>>> >> $10)),
>>> >>
>>> rel#276:PhoenixServerProject.PHOENIX_SERVER.[](input=rel#275:Subset#19.PHOENIX_SERVER.[],time_id=$1,the_date=$2,the_day=$3,the_month=$4,the_year=$5,day_of_month=$6,week_of_year=$7,month_of_year=$8,quarter=$9,fiscal_period=$10,THE_YEAR=$0)]
>>> >> at org.apache.calcite.util.Util.newInternal(Util.java:790)
>>> >> at
>>> >>
>>> org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:251)
>>> >> at
>>> >>
>>> org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:801)
>>> >> at org.apache.calcite.tools.Programs$5.run(Programs.java:272)
>>> >> at
>>> org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:320)
>>> >> at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:142)
>>> >> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:274)
>>> >> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:188)
>>> >> at
>>> >>
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:669)
>>> >> at
>>> >>
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:570)
>>> >> at
>>> >>
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:539)
>>> >> at
>>> >>
>>> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:173)
>>> >> at
>>> >>
>>> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:560)
>>> >> at
>>> >>
>>> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:477)
>>> >> at
>>> >>
>>> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:109)
>>> >> at
>>> >>
>>> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:130)
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.CalciteTest$Sql.getResult(CalciteTest.java:108)
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.CalciteTest$Sql.explainIs(CalciteTest.java:96)
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.CalciteTest.testConnectJoinHsqldb(CalciteTest.java:822)
>>> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> >> at
>>> >>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> >> at
>>> >>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> >> at java.lang.reflect.Method.invoke(Method.java:606)
>>> >> at
>>> >>
>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>>> >> at
>>> >>
>>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>>> >> at
>>> >>
>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>>> >> at
>>> >>
>>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>>> >> at
>>> >>
>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>>> >> at
>>> >>
>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>>> >> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>>> >> at
>>> >>
>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>>> >> at
>>> >>
>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>>> >> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>>> >> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>>> >> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>>> >> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>>> >> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>>> >> at
>>> >>
>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>>> >> at
>>> >>
>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>>> >> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>>> >> at
>>> >>
>>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>> >> at
>>> >>
>>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>> >> at
>>> >>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>>> >> at
>>> >>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>>> >> at
>>> >>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>>> >> at
>>> >>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
>>> >> Caused by: java.lang.RuntimeException
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.rel.PhoenixServerProject.<init>(PhoenixServerProject.java:41)
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.rel.PhoenixServerProject.create(PhoenixServerProject.java:34)
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.rel.PhoenixServerProject.copy(PhoenixServerProject.java:48)
>>> >> at
>>> >>
>>> org.apache.phoenix.calcite.rel.PhoenixServerProject.copy(PhoenixServerProject.java:1)
>>> >> at
>>> >>
>>> org.apache.calcite.rel.rules.FilterProjectTransposeRule.onMatch(FilterProjectTransposeRule.java:109)
>>> >> at
>>> >>
>>> org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:228)
>>> >> ... 44 more
>>> >>
>>> >>
>>> >> Thanks,
>>> >> Maryann
>>> >>
>>>
>>
>>
>

Reply via email to