You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by jb...@apache.org on 2016/06/23 14:16:37 UTC

[49/56] [abbrv] incubator-carbondata git commit: Deleting unnecessary code added after merge from master

Deleting unnecessary code added after merge from master


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/9d89d69e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/9d89d69e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/9d89d69e

Branch: refs/heads/master
Commit: 9d89d69e77bb63bef017b29f599282bd2ad9d2fd
Parents: 7972709
Author: ravipesala <ra...@gmail.com>
Authored: Mon Jun 20 21:46:47 2016 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Mon Jun 20 21:46:47 2016 +0530

----------------------------------------------------------------------
 .../aggregator/impl/AvgTimestampAggregator.java | 113 ------------------
 .../aggregator/impl/SumTimestampAggregator.java |  89 --------------
 .../DirectDictionaryDimensionAggregator.java    | 117 -------------------
 3 files changed, 319 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/9d89d69e/core/src/main/java/org/carbondata/query/aggregator/impl/AvgTimestampAggregator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/query/aggregator/impl/AvgTimestampAggregator.java b/core/src/main/java/org/carbondata/query/aggregator/impl/AvgTimestampAggregator.java
deleted file mode 100644
index 9058d64..0000000
--- a/core/src/main/java/org/carbondata/query/aggregator/impl/AvgTimestampAggregator.java
+++ /dev/null
@@ -1,113 +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.carbondata.query.aggregator.impl;
-
-import java.nio.ByteBuffer;
-import java.sql.Timestamp;
-
-import org.carbondata.query.aggregator.MeasureAggregator;
-
-public class AvgTimestampAggregator extends AvgDoubleAggregator {
-
-  /**
-   * serialVersionUID
-   */
-  private static final long serialVersionUID = 5463736686281089871L;
-
-  /**
-   * Average Aggregate function which will add all the aggregate values and it
-   * will increment the total count every time, for average value
-   *
-   * @param newVal new value
-   */
-  @Override public void agg(Object newVal) {
-    if (newVal instanceof byte[]) {
-      ByteBuffer buffer = ByteBuffer.wrap((byte[]) newVal);
-      buffer.rewind();
-      while (buffer.hasRemaining()) {
-        aggVal += buffer.getDouble();
-        count += buffer.getDouble();
-        firstTime = false;
-      }
-    } else if (newVal instanceof Timestamp) {
-      aggVal += ((Timestamp) newVal).getTime();
-      count++;
-      firstTime = false;
-    } else if (newVal instanceof Number) {
-      aggVal += ((Number) newVal).doubleValue();
-      count++;
-      firstTime = false;
-    }
-  }
-
-  /**
-   * Return the average of the aggregate values
-   *
-   * @return average aggregate value
-   */
-  @Override public Double getDoubleValue() {
-    return aggVal / (count * 1000L);
-  }
-
-  /**
-   * This method return the average value as an object
-   *
-   * @return average value as an object
-   */
-  @Override public Object getValueObject() {
-    return aggVal / (count * 1000L);
-  }
-
-  /**
-   * @see MeasureAggregator#setNewValue(Object)
-   */
-  @Override public void setNewValue(Object newValue) {
-    aggVal = (Double) newValue;
-    count = 1;
-  }
-
-  @Override public MeasureAggregator getCopy() {
-    AvgTimestampAggregator avg = new AvgTimestampAggregator();
-    avg.aggVal = aggVal;
-    avg.count = count;
-    avg.firstTime = firstTime;
-    return avg;
-  }
-
-  @Override public boolean equals(Object obj) {
-    if (!(obj instanceof AvgTimestampAggregator)) {
-      return false;
-    }
-    AvgTimestampAggregator o = (AvgTimestampAggregator) obj;
-    return getDoubleValue().equals(o.getDoubleValue());
-  }
-
-  @Override public int hashCode() {
-    return getDoubleValue().hashCode();
-  }
-
-  public String toString() {
-    return (aggVal / (count * 1000L)) + "";
-  }
-
-  @Override public MeasureAggregator getNew() {
-    return new AvgTimestampAggregator();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/9d89d69e/core/src/main/java/org/carbondata/query/aggregator/impl/SumTimestampAggregator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/query/aggregator/impl/SumTimestampAggregator.java b/core/src/main/java/org/carbondata/query/aggregator/impl/SumTimestampAggregator.java
deleted file mode 100644
index fd8a201..0000000
--- a/core/src/main/java/org/carbondata/query/aggregator/impl/SumTimestampAggregator.java
+++ /dev/null
@@ -1,89 +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.carbondata.query.aggregator.impl;
-
-import java.sql.Timestamp;
-
-import org.carbondata.query.aggregator.MeasureAggregator;
-
-public class SumTimestampAggregator extends SumDoubleAggregator {
-
-  /**
-   * serialVersionUID
-   */
-  private static final long serialVersionUID = 623750056131364540L;
-
-  /**
-   * aggregate value
-   */
-  private double aggVal;
-
-  /**
-   * This method will update the aggVal it will add new value to aggVal
-   *
-   * @param newVal new value
-   */
-  @Override public void agg(Object newVal) {
-    if (newVal instanceof Timestamp) {
-      aggVal += ((Timestamp) newVal).getTime();
-      firstTime = false;
-    } else if (newVal instanceof Number) {
-      aggVal += ((Number) newVal).doubleValue();
-      firstTime = false;
-    }
-  }
-
-  /**
-   * This method will return aggVal
-   *
-   * @return sum value
-   */
-
-  @Override public Double getDoubleValue() {
-    return aggVal / 1000L;
-  }
-
-  @Override public MeasureAggregator getCopy() {
-    SumTimestampAggregator aggr = new SumTimestampAggregator();
-    aggr.aggVal = aggVal;
-    aggr.firstTime = firstTime;
-    return aggr;
-  }
-
-  public String toString() {
-    return (aggVal / 1000L) + "";
-  }
-
-  @Override public boolean equals(Object obj) {
-    if (!(obj instanceof SumTimestampAggregator)) {
-      return false;
-    }
-    SumTimestampAggregator o = (SumTimestampAggregator) obj;
-    return getDoubleValue().equals(o.getDoubleValue());
-  }
-
-  @Override public int hashCode() {
-    return getDoubleValue().hashCode();
-  }
-
-  @Override public MeasureAggregator getNew() {
-    return new SumTimestampAggregator();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/9d89d69e/core/src/main/java/org/carbondata/query/carbon/aggregator/dimension/impl/DirectDictionaryDimensionAggregator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/query/carbon/aggregator/dimension/impl/DirectDictionaryDimensionAggregator.java b/core/src/main/java/org/carbondata/query/carbon/aggregator/dimension/impl/DirectDictionaryDimensionAggregator.java
deleted file mode 100644
index 8794021..0000000
--- a/core/src/main/java/org/carbondata/query/carbon/aggregator/dimension/impl/DirectDictionaryDimensionAggregator.java
+++ /dev/null
@@ -1,117 +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.carbondata.query.carbon.aggregator.dimension.impl;
-
-import java.nio.ByteBuffer;
-import java.sql.Timestamp;
-
-import org.carbondata.core.constants.CarbonCommonConstants;
-import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
-import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryKeyGeneratorFactory;
-import org.carbondata.core.util.CarbonUtil;
-import org.carbondata.query.aggregator.MeasureAggregator;
-import org.carbondata.query.carbon.aggregator.dimension.DimensionDataAggregator;
-import org.carbondata.query.carbon.executor.util.QueryUtil;
-import org.carbondata.query.carbon.model.DimensionAggregatorInfo;
-import org.carbondata.query.carbon.result.AbstractScannedResult;
-
-/**
- * Class which will be used to aggregate the direct dictionary dimension data
- */
-public class DirectDictionaryDimensionAggregator implements DimensionDataAggregator {
-
-  /**
-   * info object which store information about dimension to be aggregated
-   */
-  private DimensionAggregatorInfo dimensionAggeragtorInfo;
-
-  /**
-   * start index of the aggregator for current dimension column
-   */
-  private int aggregatorStartIndex;
-
-  /**
-   * buffer used to convert mdkey to surrogate key
-   */
-  private ByteBuffer buffer;
-
-  /**
-   * data index in the file
-   */
-  private int blockIndex;
-
-  /**
-   * to store index which will be used to aggregate
-   * number type value like sum avg
-   */
-  private int[] numberTypeAggregatorIndex;
-
-  /**
-   * DirectDictionaryGenerator
-   */
-  private DirectDictionaryGenerator directDictionaryGenerator;
-
-  /**
-   * to store index which will be used to aggregate
-   * actual type value like max, min, dictinct count
-   */
-  private int[] actualTypeAggregatorIndex;
-
-  public DirectDictionaryDimensionAggregator(DimensionAggregatorInfo dimensionAggeragtorInfo,
-      int aggregatorStartIndex, int blockIndex) {
-    this.dimensionAggeragtorInfo = dimensionAggeragtorInfo;
-    this.aggregatorStartIndex = aggregatorStartIndex;
-    this.blockIndex = blockIndex;
-    buffer = ByteBuffer.allocate(CarbonCommonConstants.INT_SIZE_IN_BYTE);
-    numberTypeAggregatorIndex =
-        QueryUtil.getNumberTypeIndex(this.dimensionAggeragtorInfo.getAggList());
-    actualTypeAggregatorIndex =
-        QueryUtil.getActualTypeIndex(this.dimensionAggeragtorInfo.getAggList());
-    directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory
-        .getDirectDictionaryGenerator(this.dimensionAggeragtorInfo.getDim().getDataType());
-  }
-
-  /**
-   * Below method will be used to aggregate the dimension data
-   *
-   * @param scannedResult scanned result
-   * @param aggeragtor    aggregator used to aggregate the data
-   */
-  @Override public void aggregateDimensionData(AbstractScannedResult scannedResult,
-      MeasureAggregator[] aggeragtor) {
-    byte[] dimensionData = scannedResult.getDimensionKey(blockIndex);
-    int surrogateKey = CarbonUtil.getSurrogateKey(dimensionData, buffer);
-    Object valueFromSurrogate = directDictionaryGenerator.getValueFromSurrogate(surrogateKey);
-    if (null != valueFromSurrogate) {
-      Timestamp dataBasedOnDataType = new Timestamp((long) valueFromSurrogate / 1000);
-
-      if (actualTypeAggregatorIndex.length > 0) {
-        for (int j = 0; j < actualTypeAggregatorIndex.length; j++) {
-          aggeragtor[aggregatorStartIndex + actualTypeAggregatorIndex[j]].agg(dataBasedOnDataType);
-        }
-      }
-      if (numberTypeAggregatorIndex.length > 0) {
-        for (int j = 0; j < numberTypeAggregatorIndex.length; j++) {
-          aggeragtor[aggregatorStartIndex + numberTypeAggregatorIndex[j]].agg(dataBasedOnDataType);
-        }
-      }
-    }
-  }
-
-}