You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Dayue Gao (JIRA)" <ji...@apache.org> on 2016/11/16 08:38:58 UTC
[jira] [Commented] (KYLIN-2200) CompileException on UNION ALL query
when result only contains one column
[ https://issues.apache.org/jira/browse/KYLIN-2200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15669833#comment-15669833 ]
Dayue Gao commented on KYLIN-2200:
----------------------------------
Here is calcite generated code
{code:java}
/* 1 */ public static class Record1_0 implements java.io.Serializable {
/* 2 */ public long f0;
/* 3 */ public Record1_0() {}
/* 4 */ public boolean equals(Object o) {
/* 5 */ if (this == o) {
/* 6 */ return true;
/* 7 */ }
/* 8 */ if (!(o instanceof Record1_0)) {
/* 9 */ return false;
/* 10 */ }
/* 11 */ return this.f0 == ((Record1_0) o).f0;
/* 12 */ }
/* 13 */
/* 14 */ public int hashCode() {
/* 15 */ int h = 0;
/* 16 */ h = org.apache.calcite.runtime.Utilities.hash(h, this.f0);
/* 17 */ return h;
/* 18 */ }
/* 19 */
/* 20 */ public int compareTo(Record1_0 that) {
/* 21 */ final int c;
/* 22 */ c = org.apache.calcite.runtime.Utilities.compare(this.f0, that.f0);
/* 23 */ if (c != 0) {
/* 24 */ return c;
/* 25 */ }
/* 26 */ return 0;
/* 27 */ }
/* 28 */
/* 29 */ public String toString() {
/* 30 */ return "{f0=" + this.f0 + "}";
/* 31 */ }
/* 32 */
/* 33 */ }
/* 34 */
/* 35 */ org.apache.calcite.DataContext root;
/* 36 */
/* 37 */ public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root0) {
/* 38 */ root = root0;
/* 39 */ final org.apache.calcite.linq4j.Enumerable _inputEnumerable = ((org.apache.kylin.query.schema.OLAPTable) root.getRootSchema().getSubSchema("DEFAULT").getTable("KYLIN_SALES")).executeOLAPQuery(root, 0);
/* 40 */ final org.apache.calcite.linq4j.AbstractEnumerable child = new org.apache.calcite.linq4j.AbstractEnumerable(){
/* 41 */ public org.apache.calcite.linq4j.Enumerator enumerator() {
/* 42 */ return new org.apache.calcite.linq4j.Enumerator(){
/* 43 */ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator();
/* 44 */ public void reset() {
/* 45 */ inputEnumerator.reset();
/* 46 */ }
/* 47 */
/* 48 */ public boolean moveNext() {
/* 49 */ return inputEnumerator.moveNext();
/* 50 */ }
/* 51 */
/* 52 */ public void close() {
/* 53 */ inputEnumerator.close();
/* 54 */ }
/* 55 */
/* 56 */ public Object current() {
/* 57 */ return org.apache.calcite.runtime.SqlFunctions.toLong(((Object[]) inputEnumerator.current())[8]);
/* 58 */ }
/* 59 */
/* 60 */ };
/* 61 */ }
/* 62 */
/* 63 */ };
/* 64 */ final org.apache.calcite.linq4j.Enumerable _inputEnumerable0 = ((org.apache.kylin.query.schema.OLAPTable) root.getRootSchema().getSubSchema("DEFAULT").getTable("KYLIN_SALES")).executeOLAPQuery(root, 1);
/* 65 */ final org.apache.calcite.linq4j.AbstractEnumerable child1 = new org.apache.calcite.linq4j.AbstractEnumerable(){
/* 66 */ public org.apache.calcite.linq4j.Enumerator enumerator() {
/* 67 */ return new org.apache.calcite.linq4j.Enumerator(){
/* 68 */ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable0.enumerator();
/* 69 */ public void reset() {
/* 70 */ inputEnumerator.reset();
/* 71 */ }
/* 72 */
/* 73 */ public boolean moveNext() {
/* 74 */ return inputEnumerator.moveNext();
/* 75 */ }
/* 76 */
/* 77 */ public void close() {
/* 78 */ inputEnumerator.close();
/* 79 */ }
/* 80 */
/* 81 */ public Object current() {
/* 82 */ return ((Record11_1) inputEnumerator.current()).COUNT__;
/* 83 */ }
/* 84 */
/* 85 */ };
/* 86 */ }
/* 87 */
/* 88 */ };
/* 89 */ return org.apache.calcite.linq4j.Linq4j.singletonEnumerable(child.aggregate(new org.apache.calcite.linq4j.function.Function0() {
/* 90 */ public Object apply() {
/* 91 */ long $SUM0a0s0;
/* 92 */ $SUM0a0s0 = 0;
/* 93 */ Record1_0 record0;
/* 94 */ record0 = new Record1_0();
/* 95 */ record0.f0 = $SUM0a0s0;
/* 96 */ return record0;
/* 97 */ }
/* 98 */ }
/* 99 */ .apply(), new org.apache.calcite.linq4j.function.Function2() {
/* 100 */ public Record1_0 apply(Record1_0 acc, long in) {
/* 101 */ acc.f0 = acc.f0 + in;
/* 102 */ return acc;
/* 103 */ }
/* 104 */ public Record1_0 apply(Record1_0 acc, Long in) {
/* 105 */ return apply(
/* 106 */ acc,
/* 107 */ in.longValue());
/* 108 */ }
/* 109 */ public Record1_0 apply(Object acc, Object in) {
/* 110 */ return apply(
/* 111 */ (Record1_0) acc,
/* 112 */ (Long) in);
/* 113 */ }
/* 114 */ }
/* 115 */ , new org.apache.calcite.linq4j.function.Function1() {
/* 116 */ public long apply(Record1_0 acc) {
/* 117 */ return acc.f0;
/* 118 */ }
/* 119 */ public Object apply(Object acc) {
/* 120 */ return apply(
/* 121 */ (Record1_0) acc);
/* 122 */ }
/* 123 */ }
/* 124 */ )).concat(org.apache.calcite.linq4j.Linq4j.singletonEnumerable(child1.aggregate(new org.apache.calcite.linq4j.function.Function0() {
/* 125 */ public Object apply() {
/* 126 */ long $SUM0a0s0;
/* 127 */ $SUM0a0s0 = 0;
/* 128 */ Record1_0 record0;
/* 129 */ record0 = new Record1_0();
/* 130 */ record0.f0 = $SUM0a0s0;
/* 131 */ return record0;
/* 132 */ }
/* 133 */ }
/* 134 */ .apply(), new org.apache.calcite.linq4j.function.Function2() {
/* 135 */ public Record1_0 apply(Record1_0 acc, long in) {
/* 136 */ acc.f0 = acc.f0 + in;
/* 137 */ return acc;
/* 138 */ }
/* 139 */ public Record1_0 apply(Record1_0 acc, Long in) {
/* 140 */ return apply(
/* 141 */ acc,
/* 142 */ in.longValue());
/* 143 */ }
/* 144 */ public Record1_0 apply(Object acc, Object in) {
/* 145 */ return apply(
/* 146 */ (Record1_0) acc,
/* 147 */ (Long) in);
/* 148 */ }
/* 149 */ }
/* 150 */ , new org.apache.calcite.linq4j.function.Function1() {
/* 151 */ public long apply(Record1_0 acc) {
/* 152 */ return acc.f0;
/* 153 */ }
/* 154 */ public Object apply(Object acc) {
/* 155 */ return apply(
/* 156 */ (Record1_0) acc);
/* 157 */ }
/* 158 */ }
/* 159 */ ))).take(50000);
/* 160 */ }
/* 161 */
/* 162 */
/* 163 */ public Class getElementType() {
/* 164 */ return long.class;
/* 165 */ }
/* 166 */
/* 167 */
{code}
Line 82 "return ((Record11_1) inputEnumerator.current()).COUNT__;". The class definition of Record11_1 is not generated.
> CompileException on UNION ALL query when result only contains one column
> ------------------------------------------------------------------------
>
> Key: KYLIN-2200
> URL: https://issues.apache.org/jira/browse/KYLIN-2200
> Project: Kylin
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: v1.5.4.1
> Reporter: Dayue Gao
> Assignee: Dayue Gao
>
> {code:sql}
> select count(*) from kylin_sales
> union all
> select count(*) from kylin_sales
> {code}
> got following exception
> {noformat}
> Caused by: org.codehaus.commons.compiler.CompileException: Line 82, Column 32: Cannot determine simple type name "Record11_1"
> at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10092)
> at org.codehaus.janino.UnitCompiler.getReferenceType(UnitCompiler.java:5375)
> at org.codehaus.janino.UnitCompiler.getReferenceType(UnitCompiler.java:5184)
> at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:5165)
> at org.codehaus.janino.UnitCompiler.access$12600(UnitCompiler.java:183)
> at org.codehaus.janino.UnitCompiler$16.visitReferenceType(UnitCompiler.java:5096)
> at org.codehaus.janino.Java$ReferenceType.accept(Java.java:2880)
> at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:5136)
> at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:5598)
> at org.codehaus.janino.UnitCompiler.access$13300(UnitCompiler.java:183)
> at org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:5104)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)