Skip to content

Commit

Permalink
KYLIN-4828 Add more sql test cases into NBuildAndQueryTest
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcclp authored and hit-lacus committed Nov 30, 2020
1 parent 51ff5ec commit d46fc4a
Show file tree
Hide file tree
Showing 263 changed files with 21,302 additions and 1,409 deletions.
18 changes: 18 additions & 0 deletions build/CI/kylin-system-testing/query/sql/sql_subquery/query14.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

select
lstg_format_name,
sum(price) as gvm
Expand Down
108 changes: 108 additions & 0 deletions core-common/src/main/java/org/apache/kylin/common/util/Quadruple.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.kylin.common.util;

/**
* Utility class to manage a quadruple. Copied from org.apache.hadoop.hbase.util.Pair
*/
public class Quadruple<A, B, C, D> {
private A first;
private B second;
private C third;
private D fourth;

public Quadruple(A first, B second, C third, D fourth) {
this.first = first;
this.second = second;
this.third = third;
this.fourth = fourth;
}

// ctor cannot infer types w/o warning but a method can.
public static <A, B, C, D> Quadruple<A, B, C, D> create(A first, B second, C third, D fourth) {
return new Quadruple<A, B, C, D>(first, second, third, fourth);
}

public int hashCode() {
int hashFirst = (first != null ? first.hashCode() : 0);
int hashSecond = (second != null ? second.hashCode() : 0);
int hashThird = (third != null ? third.hashCode() : 0);
int hashFourth = (fourth != null ? fourth.hashCode() : 0);

return (hashFirst >> 1) ^ hashSecond ^ (hashThird << 1) ^ (hashFourth << 1);
}

public boolean equals(Object obj) {
if (!(obj instanceof Quadruple)) {
return false;
}

Quadruple<?, ?, ?, ?> otherQuadruple = (Quadruple<?, ?, ?, ?>) obj;

if (first != otherQuadruple.first && (first != null && !(first.equals(otherQuadruple.first))))
return false;
if (second != otherQuadruple.second && (second != null && !(second.equals(otherQuadruple.second))))
return false;
if (third != otherQuadruple.third && (third != null && !(third.equals(otherQuadruple.third))))
return false;
if (fourth != otherQuadruple.fourth && (fourth != null && !(fourth.equals(otherQuadruple.fourth))))
return false;

return true;
}

public String toString() {
return "(" + first + ", " + second + ", " + third + ", " + fourth + ")";
}

public A getFirst() {
return first;
}

public void setFirst(A first) {
this.first = first;
}

public B getSecond() {
return second;
}

public void setSecond(B second) {
this.second = second;
}

public C getThird() {
return third;
}

public void setThird(C third) {
this.third = third;
}

public D getFourth() {
return fourth;
}

public void setFourth(D fourth) {
this.fourth = fourth;
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public boolean equals(Object obj) {
}

public String toString() {
return "(" + first + ", " + second + "," + third + " )";
return "(" + first + ", " + second + ", " + third + ")";
}

public A getFirst() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ SELECT sum(price) as sum_price
FROM TEST_KYLIN_FACT
WHERE CAL_DT > cast(TIMESTAMPADD(Day, -15000, CURRENT_DATE) as DATE)
GROUP BY CAL_DT
;{"scanRowCount":731,"scanBytes":215217,"scanFiles":1,"cuboidId":262144}
;{"scanRowCount":731,"scanBytes":0,"scanFiles":1,"cuboidId":[262144]}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ SELECT sum(price) as sum_price
FROM TEST_KYLIN_FACT
WHERE CAL_DT > '2013-06-01'
GROUP BY CAL_DT
;{"scanRowCount":731,"scanBytes":215217,"scanFiles":1,"cuboidId":262144}
;{"scanRowCount":731,"scanBytes":0,"scanFiles":1,"cuboidId":[262144]}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ inner JOIN edw.test_cal_dt as test_cal_dt
where
extract(DAY from test_cal_dt.cal_dt) = 12
group by test_cal_dt.cal_dt
;{"scanRowCount":1462,"scanBytes":215217,"scanFiles":2,"cuboidId":262144}
;{"scanRowCount":1462,"scanBytes":0,"scanFiles":2,"cuboidId":[262144]}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

select SLR_SEGMENT_CD
from TEST_KYLIN_FACT
group by SLR_SEGMENT_CD
group by SLR_SEGMENT_CD
;{"scanRowCount":300,"scanBytes":0,"scanFiles":1,"cuboidId":[14336]}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
--

select DISTINCT SLR_SEGMENT_CD
from TEST_KYLIN_FACT
from TEST_KYLIN_FACT
;{"scanRowCount":300,"scanBytes":0,"scanFiles":1,"cuboidId":[14336]}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
--

select MAX(SLR_SEGMENT_CD)
from TEST_KYLIN_FACT
from TEST_KYLIN_FACT
;{"scanRowCount":300,"scanBytes":0,"scanFiles":1,"cuboidId":[14336]}
2 changes: 1 addition & 1 deletion kylin-it/src/test/resources/query/sql_distinct/query00.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ select lstg_format_name, cal_dt,
count(distinct seller_id) as DIST_SELLER
from test_kylin_fact
group by lstg_format_name, cal_dt
;{"scanRowCount":9287,"scanBytes":384041,"scanFiles":1,"cuboidId":276480}
;{"scanRowCount":9287,"scanBytes":0,"scanFiles":1,"cuboidId":[276480]}
Binary file not shown.
Binary file not shown.
Empty file.
Loading

0 comments on commit d46fc4a

Please sign in to comment.