You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/04/21 00:29:26 UTC

[4/6] incubator-geode git commit: Removing the inbuilt aggregate classes specific to bucket nodes/ query nodes

Removing the inbuilt aggregate classes specific to bucket nodes/ query nodes


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8bc7afac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8bc7afac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8bc7afac

Branch: refs/heads/feature/GEODE-1269
Commit: 8bc7afac334ecdeee89d9576af95aea2e73a52bf
Parents: 4f85cac
Author: Asif Shahid <as...@snappydata.io>
Authored: Thu Apr 14 22:03:14 2016 -0700
Committer: Asif Shahid <as...@snappydata.io>
Committed: Thu Apr 14 22:03:14 2016 -0700

----------------------------------------------------------------------
 .../query/internal/aggregate/AvgBucketNode.java | 48 --------------------
 .../aggregate/AvgDistinctPRQueryNode.java       | 34 --------------
 .../internal/aggregate/AvgPRQueryNode.java      | 46 -------------------
 .../aggregate/CountDistinctPRQueryNode.java     | 43 ------------------
 .../internal/aggregate/CountPRQueryNode.java    | 47 -------------------
 .../aggregate/SumDistinctPRQueryNode.java       | 45 ------------------
 6 files changed, 263 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bc7afac/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgBucketNode.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgBucketNode.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgBucketNode.java
deleted file mode 100644
index dae038e..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgBucketNode.java
+++ /dev/null
@@ -1,48 +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 com.gemstone.gemfire.cache.query.internal.aggregate;
-
-import com.gemstone.gemfire.cache.query.QueryService;
-
-/**
- * The aggregator for compuing average which is used on the bucket node for
- * partitioned region based queries.
- * 
- *
- */
-public class AvgBucketNode extends Sum {
-
-  private int count = 0;
-
-  @Override
-  public void accumulate(Object value) {
-    if (value != null && value != QueryService.UNDEFINED) {
-      super.accumulate(value);
-      ++count;
-    }
-  }
-
-  /**
-   * Returns a two element array of the total number of values & the computed
-   * sum of the values.
-   */
-  @Override
-  public Object terminate() {
-    return new Object[] { Integer.valueOf(count), super.terminate() };
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bc7afac/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgDistinctPRQueryNode.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgDistinctPRQueryNode.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgDistinctPRQueryNode.java
deleted file mode 100644
index 20d368d..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgDistinctPRQueryNode.java
+++ /dev/null
@@ -1,34 +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 com.gemstone.gemfire.cache.query.internal.aggregate;
-
-/**
- * Computes the final average of distinct values for the partitioned region
- * based queries. This aggregator is initialized on the PR query node & acts on
- * the results obtained from bucket nodes.
- * 
- *
- */
-public class AvgDistinctPRQueryNode extends SumDistinctPRQueryNode {
-
-  @Override
-  public Object terminate() {
-    double sum = ((Number) super.terminate()).doubleValue();
-    double result = sum / this.distinct.size();
-    return downCast(result);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bc7afac/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgPRQueryNode.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgPRQueryNode.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgPRQueryNode.java
deleted file mode 100644
index f892971..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/AvgPRQueryNode.java
+++ /dev/null
@@ -1,46 +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 com.gemstone.gemfire.cache.query.internal.aggregate;
-
-/**
- * Computes the final non distinct average for a partitioned region based query.
- * This aggregator is instantiated on the PR query node.
- * 
- *
- */
-public class AvgPRQueryNode extends Sum {
-  private int count = 0;
-
-  /**
-   * Takes the input of data received from bucket nodes. The data is of the form
-   * of two element array. The first element is the number of values, while the
-   * second element is the sum of the values.
-   */
-  @Override
-  public void accumulate(Object value) {
-    Object[] array = (Object[]) value;
-    this.count += ((Integer) array[0]).intValue();
-    super.accumulate(array[1]);
-  }
-
-  @Override
-  public Object terminate() {
-    double sum = ((Number) super.terminate()).doubleValue();
-    double result = sum / count;
-    return downCast(result);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bc7afac/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountDistinctPRQueryNode.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountDistinctPRQueryNode.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountDistinctPRQueryNode.java
deleted file mode 100644
index b2f88a7..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountDistinctPRQueryNode.java
+++ /dev/null
@@ -1,43 +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 com.gemstone.gemfire.cache.query.internal.aggregate;
-
-import java.util.Set;
-
-/**
- * Computes the count of the distinct rows on the PR query node.
- * 
- *
- */
-public class CountDistinctPRQueryNode extends DistinctAggregator {
-
-  /**
-   * The input data is the Set containing distinct values from each of the
-   * bucket nodes.
-   */
-  @Override
-  public void accumulate(Object value) {
-    this.distinct.addAll((Set) value);
-
-  }
-
-  @Override
-  public Object terminate() {
-    return Integer.valueOf(this.distinct.size());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bc7afac/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountPRQueryNode.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountPRQueryNode.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountPRQueryNode.java
deleted file mode 100644
index 50eb07b..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/CountPRQueryNode.java
+++ /dev/null
@@ -1,47 +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 com.gemstone.gemfire.cache.query.internal.aggregate;
-
-import com.gemstone.gemfire.cache.query.Aggregator;
-
-/**
- * Computes the count of the rows on the PR query node
- * 
- *
- */
-public class CountPRQueryNode implements Aggregator {
-  private int count = 0;
-
-  /**
-   * Recieves the input of the individual counts from the bucket nodes.
-   */
-  @Override
-  public void accumulate(Object value) {
-    this.count += ((Integer) value).intValue();
-  }
-
-  @Override
-  public void init() {
-
-  }
-
-  @Override
-  public Object terminate() {
-    return Integer.valueOf(count);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bc7afac/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/SumDistinctPRQueryNode.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/SumDistinctPRQueryNode.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/SumDistinctPRQueryNode.java
deleted file mode 100644
index bee5df2..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/aggregate/SumDistinctPRQueryNode.java
+++ /dev/null
@@ -1,45 +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 com.gemstone.gemfire.cache.query.internal.aggregate;
-
-import java.util.Set;
-
-/**
- * Computes the sum of distinct values on the PR query node.
- * 
- *
- */
-public class SumDistinctPRQueryNode extends DistinctAggregator {
-
-  /**
-   * The input data is the Set of values(distinct) receieved from each of the
-   * bucket nodes.
-   */
-  @Override
-  public void accumulate(Object value) {
-    this.distinct.addAll((Set) value);
-  }
-
-  @Override
-  public Object terminate() {
-    double sum = 0;
-    for (Object o : this.distinct) {
-      sum += ((Number) o).doubleValue();
-    }
-    return downCast(sum);
-  }
-}