Yuri Au Yong created CALCITE-974:
------------------------------------

             Summary: Delete expression causing SqlValidatorException
                 Key: CALCITE-974
                 URL: https://issues.apache.org/jira/browse/CALCITE-974
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: next
         Environment: linux
            Reporter: Yuri Au Yong
            Assignee: Julian Hyde


**SQL “delete from tbl” causes SqlValidatorException :**
Nov 12, 2015 10:47:47 PM org.apache.calcite.sql.validate.SqlValidatorException 
<init>
SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: Column '*' not 
found in any table

**Cause of SqlValidatorException:**
In CALCITE-546 [https://issues.apache.org/jira/browse/CALCITE-546], "new 
SqlIdentifier("*", starPos)" is changed to "SqlIdentifier.star(starPos)". 
However, in the latest SqlValidatorImpl.java code some of the 
"SqlIdentifier.star(starPos)" is somehow changed back to "new 
SqlIdentifier("*", starPos)" causing code to break and exception.

**After star fix**
After i fixed the "SqlIdentifier.star" problem (see attached starFix.txt) and 
run the DeleteExprTest.java (attached) I am met with java.lang.OutOfMemoryError:

java.lang.OutOfMemoryError: Java heap space
        at Baz$1.apply(ANONYMOUS.java:9)
        at Baz$1.apply(ANONYMOUS.java:18)
        at 
org.apache.calcite.linq4j.EnumerableDefaults$13$1.current(EnumerableDefaults.java:1781)
        at 
org.apache.calcite.linq4j.EnumerableDefaults.into(EnumerableDefaults.java:2791)
        at 
org.apache.calcite.linq4j.DefaultEnumerable.into(DefaultEnumerable.java:343)
        at Baz.bind(Baz.java:21)
        at 
org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:326)
        at 
org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:281)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:545)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:536)
        at 
org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:190)
        at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:65)
        at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:1)
        at 
org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:566)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:578)
        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.execute(AvaticaStatement.java:177)
        at 
org.apache.calcite.test.JdbcFrontLinqBackTest.testdelete(JdbcFrontLinqBackTest.java:406)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:507)
        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)

**Generated Code:**
FINE: Plan after physical tweaks: EnumerableTableModify(table=[[foo, bar]], 
operation=[DELETE], updateColumnList=[[]], flattened=[false]): rowcount = 
100.0, cumulative cost = {200.0 rows, 101.0 cpu, 0.0 io}, id = 47
  EnumerableTableScan(table=[[foo, bar]]): rowcount = 100.0, cumulative cost = 
{100.0 rows, 101.0 cpu, 0.0 io}, id = 28


/*   1 */ org.apache.calcite.DataContext root;
/*   2 */ 
/*   3 */ public org.apache.calcite.linq4j.Enumerable bind(final 
org.apache.calcite.DataContext root0) {
/*   4 */   root = root0;
/*   5 */   final java.util.Collection collection = 
((org.apache.calcite.schema.ModifiableTable) 
root.getRootSchema().getSubSchema("foo").getTable("bar")).getModifiableCollection();
/*   6 */   final int _count = collection.size();
/*   7 */   org.apache.calcite.schema.Schemas.queryable(root, 
root.getRootSchema().getSubSchema("foo"), 
org.apache.calcite.test.JdbcTest.Employee.class, 
"bar").asEnumerable().select(new org.apache.calcite.linq4j.function.Function1() 
{
/*   8 */     public org.apache.calcite.test.JdbcTest.Employee 
apply(org.apache.calcite.test.JdbcTest.Employee o) {
/*   9 */       return new org.apache.calcite.test.JdbcTest.Employee(
/*  10 */           o.empid,
/*  11 */           o.deptno,
/*  12 */           o.name,
/*  13 */           o.salary,
/*  14 */           o.commission);
/*  15 */     }
/*  16 */     public Object apply(Object o) {
/*  17 */       return apply(
/*  18 */         (org.apache.calcite.test.JdbcTest.Employee) o);
/*  19 */     }
/*  20 */   }
/*  21 */   ).into(collection);
/*  22 */   return org.apache.calcite.linq4j.Linq4j.singletonEnumerable((long) 
(collection.size() - _count));
/*  23 */ }
/*  24 */ 
/*  25 */ 
/*  26 */ public Class getElementType() {
/*  27 */   return long.class;
/*  28 */ }
/*  29 */ 
/*  30 */ 
JVMDUMP039I Processing dump event "systhrow", detail 
"java/lang/OutOfMemoryError" at 2015/11/16 15:29:08 - please wait.





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

Reply via email to