Repository: kylin Updated Branches: refs/heads/master 06e1ea296 -> 4a6aed92e
minor changes Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/4a6aed92 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/4a6aed92 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/4a6aed92 Branch: refs/heads/master Commit: 4a6aed92ea9ad1d155037dda756a19e55d50dec2 Parents: 06e1ea2 Author: Hongbin Ma <mahong...@apache.org> Authored: Tue May 17 18:45:20 2016 +0800 Committer: Hongbin Ma <mahong...@apache.org> Committed: Tue May 17 18:45:20 2016 +0800 ---------------------------------------------------------------------- .../kylin/common/util/NumberIterators.java | 50 -------------------- .../kylin/common/util/ValueIterators.java | 50 ++++++++++++++++++++ .../apache/kylin/rest/response/SQLResponse.java | 4 ++ 3 files changed, 54 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/4a6aed92/core-common/src/main/java/org/apache/kylin/common/util/NumberIterators.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/NumberIterators.java b/core-common/src/main/java/org/apache/kylin/common/util/NumberIterators.java deleted file mode 100644 index 4ce317d..0000000 --- a/core-common/src/main/java/org/apache/kylin/common/util/NumberIterators.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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; - -import java.util.Iterator; -import java.util.Set; - -import com.google.common.collect.Sets; - -public class NumberIterators { - - public static <T extends Number> long sum(Iterator<T> iterator) { - long ret = 0; - while (iterator.hasNext()) { - Number element = iterator.next(); - ret += element.longValue(); - } - return ret; - } - - public static <T extends Number> long checkSame(Iterator<T> iterator) { - Set<Long> values = Sets.newHashSet(); - while (iterator.hasNext()) { - Number element = iterator.next(); - values.add(element.longValue()); - } - - if (values.size() > 1) { - throw new IllegalStateException("more than one distinct values exist in the collection:" + values); - } - - return values.iterator().next(); - } -} http://git-wip-us.apache.org/repos/asf/kylin/blob/4a6aed92/core-common/src/main/java/org/apache/kylin/common/util/ValueIterators.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/ValueIterators.java b/core-common/src/main/java/org/apache/kylin/common/util/ValueIterators.java new file mode 100644 index 0000000..9ed85be --- /dev/null +++ b/core-common/src/main/java/org/apache/kylin/common/util/ValueIterators.java @@ -0,0 +1,50 @@ +/* + * 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; + +import java.util.Iterator; +import java.util.Set; + +import com.google.common.collect.Sets; + +public class ValueIterators { + + public static <T extends Number> long sum(Iterator<T> iterator) { + long ret = 0; + while (iterator.hasNext()) { + Number element = iterator.next(); + ret += element.longValue(); + } + return ret; + } + + public static <T> T checkSame(Iterator<T> iterator) { + Set<T> values = Sets.newHashSet(); + while (iterator.hasNext()) { + T element = iterator.next(); + values.add(element); + } + + if (values.size() > 1) { + throw new IllegalStateException("more than one distinct values exist in the collection:" + values); + } + + return values.iterator().next(); + } +} http://git-wip-us.apache.org/repos/asf/kylin/blob/4a6aed92/server/src/main/java/org/apache/kylin/rest/response/SQLResponse.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/response/SQLResponse.java b/server/src/main/java/org/apache/kylin/rest/response/SQLResponse.java index 353dd7e..9c4e9da 100644 --- a/server/src/main/java/org/apache/kylin/rest/response/SQLResponse.java +++ b/server/src/main/java/org/apache/kylin/rest/response/SQLResponse.java @@ -105,6 +105,10 @@ public class SQLResponse implements Serializable { return cube; } + public void setCube(String cube) { + this.cube = cube; + } + public int getAffectedRowCount() { return affectedRowCount; }