[jira] [Created] (CALCITE-4566) When query contains multiple `AggregateCall`s, materialized view recognition fails

2021-04-06 Thread xzh_dz (Jira)
xzh_dz created CALCITE-4566:
---

 Summary: When query contains multiple `AggregateCall`s, 
materialized view recognition fails
 Key: CALCITE-4566
 URL: https://issues.apache.org/jira/browse/CALCITE-4566
 Project: Calcite
  Issue Type: Wish
Reporter: xzh_dz


{code:java}
// code placeholder
org.apache.calcite.test.MaterializedViewSubstitutionVisitorTest
@Test void testMutilAggCallsMvMatch() {
  final String mv0 = ""
  + "select \"name\", sum(\"deptno\") as sum_deptno\n"
  + "from \"emps\" group by \"name\"";
  final String mv1 = ""
  + "select \"name\", count(distinct \"deptno\")\n"
  + "from \"emps\" group by \"name\"";
  final String query = ""
  + "select count(distinct \"deptno\"), sum(\"deptno\") as sum_deptno\n"
  + "from \"emps\" group by \"name\"";
  sql(query, mv0, mv1).withChecker(
  resultContains("")).ok();
}

protected Sql sql(String query, String materialize0, String materialize1) {
  return ImmutableBeans.create(Sql.class)
  .withMaterializations(ImmutableList.of(Pair.of(materialize0, "MV0"), 
Pair.of(materialize1, "MV1")))
  .withQuery(query)
  .withTester(this);
}
{code}
Exception:
{code:java}
// code placeholder
java.lang.AssertionError: Materialized view failed to be matched by optmized 
results:java.lang.AssertionError: Materialized view failed to be matched by 
optmized results: at 
org.apache.calcite.test.AbstractMaterializedViewTest.checkMaterialize(AbstractMaterializedViewTest.java:120)
 at 
org.apache.calcite.test.AbstractMaterializedViewTest.access$000(AbstractMaterializedViewTest.java:65)
 at 
org.apache.calcite.test.AbstractMaterializedViewTest$Sql.ok(AbstractMaterializedViewTest.java:236)
 at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at 
org.apache.calcite.util.ImmutableBeans.lambda$makeDef$3(ImmutableBeans.java:275)
 at 
org.apache.calcite.util.ImmutableBeans$BeanImpl.invoke(ImmutableBeans.java:446) 
at com.sun.proxy.$Proxy12.ok(Unknown Source) at 
org.apache.calcite.test.MaterializedViewSubstitutionVisitorTest.testMutilAggCallsMvMatch(MaterializedViewSubstitutionVisitorTest.java:1024)
 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:498) at 
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
 at 
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
 at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
 at 
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:139)
 at 
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:131)
 at 
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:81)
 at 
org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
 at 
org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
 at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
 at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
 at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
 at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
 at 
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
 at 
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
 at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
 at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
 at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
 at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
 at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
 at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
 at 

[jira] [Created] (CALCITE-4565) UpperBound and lowerBound are silently re-written incorrectly during sql to rel conversion

2021-04-06 Thread Danny Chen (Jira)
Danny Chen created CALCITE-4565:
---

 Summary: UpperBound and lowerBound are silently re-written 
incorrectly during sql to rel conversion
 Key: CALCITE-4565
 URL: https://issues.apache.org/jira/browse/CALCITE-4565
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: next
Reporter: Danny Chen






--
This message was sent by Atlassian Jira
(v8.3.4#803005)