carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [1/2] incubator-carbondata git commit: coverity and fortify fixes
Date Tue, 03 Jan 2017 15:49:55 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master a68fd0cbc -> 84e727bc2


coverity and fortify fixes


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

Branch: refs/heads/master
Commit: 808999cd69af007e2005b154a34d8751c32a32c1
Parents: a68fd0c
Author: vincentchenfei <vincent.chenfei@huawei.com>
Authored: Fri Dec 30 20:11:26 2016 +0530
Committer: chenliang613 <chenliang613@apache.org>
Committed: Tue Jan 3 23:48:58 2017 +0800

----------------------------------------------------------------------
 .../carbondata/core/carbon/ColumnIdentifier.java  |  5 +++--
 .../DriverQueryStatisticsRecorderImpl.java        | 18 ++++++++++--------
 .../core/writer/CarbonDictionaryWriterImpl.java   |  7 +++++--
 .../carbondata/scan/executor/util/QueryUtil.java  |  7 ++++---
 4 files changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/808999cd/core/src/main/java/org/apache/carbondata/core/carbon/ColumnIdentifier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/ColumnIdentifier.java b/core/src/main/java/org/apache/carbondata/core/carbon/ColumnIdentifier.java
index 9dda92c..62ae748 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/ColumnIdentifier.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/ColumnIdentifier.java
@@ -68,10 +68,11 @@ public class ColumnIdentifier implements Serializable {
    * @return
    */
   public String getColumnProperty(String columnProperty) {
+    String property = null;
     if (null != columnProperties) {
-      return columnProperties.get(columnProperty);
+      property = columnProperties.get(columnProperty);
     }
-    return null;
+    return property;
   }
 
   public DataType getDataType() {

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/808999cd/core/src/main/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImpl.java
b/core/src/main/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImpl.java
index 04b12a9..d9ad576 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImpl.java
@@ -78,14 +78,16 @@ public class DriverQueryStatisticsRecorderImpl implements QueryStatisticsRecorde
    *
    * @param statistic
    */
-  public synchronized void recordStatisticsForDriver(QueryStatistic statistic, String queryId)
{
-    // refresh query Statistics Map
-    if (queryStatisticsMap.get(queryId) != null) {
-      queryStatisticsMap.get(queryId).add(statistic);
-    } else {
-      List<QueryStatistic> newQueryStatistics = new ArrayList<QueryStatistic>();
-      newQueryStatistics.add(statistic);
-      queryStatisticsMap.put(queryId, newQueryStatistics);
+  public void recordStatisticsForDriver(QueryStatistic statistic, String queryId) {
+    synchronized (lock) {
+      // refresh query Statistics Map
+      if (queryStatisticsMap.get(queryId) != null) {
+        queryStatisticsMap.get(queryId).add(statistic);
+      } else {
+        List<QueryStatistic> newQueryStatistics = new ArrayList<QueryStatistic>();
+        newQueryStatistics.add(statistic);
+        queryStatisticsMap.put(queryId, newQueryStatistics);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/808999cd/core/src/main/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImpl.java
b/core/src/main/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImpl.java
index a23ba75..f8e8a65 100644
--- a/core/src/main/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImpl.java
@@ -285,8 +285,11 @@ public class CarbonDictionaryWriterImpl implements CarbonDictionaryWriter
{
   private void validateDictionaryFileOffsetWithLastSegmentEntryOffset() throws IOException
{
     // read last dictionary chunk meta entry from dictionary metadata file
     chunkMetaObjectForLastSegmentEntry = getChunkMetaObjectForLastSegmentEntry();
-    int bytesToTruncate =
-        (int) (chunk_start_offset - chunkMetaObjectForLastSegmentEntry.getEnd_offset());
+    int bytesToTruncate = 0;
+    if (null != chunkMetaObjectForLastSegmentEntry) {
+      bytesToTruncate =
+              (int) (chunk_start_offset - chunkMetaObjectForLastSegmentEntry.getEnd_offset());
+    }
     if (bytesToTruncate > 0) {
       LOGGER.info("some inconsistency in dictionary file for column " + this.columnIdentifier);
       // truncate the dictionary data till chunk meta end offset

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/808999cd/core/src/main/java/org/apache/carbondata/scan/executor/util/QueryUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/executor/util/QueryUtil.java b/core/src/main/java/org/apache/carbondata/scan/executor/util/QueryUtil.java
index 680876c..3f9ebb5 100644
--- a/core/src/main/java/org/apache/carbondata/scan/executor/util/QueryUtil.java
+++ b/core/src/main/java/org/apache/carbondata/scan/executor/util/QueryUtil.java
@@ -955,9 +955,10 @@ public class QueryUtil {
         filterMeasure.add((CarbonMeasure) ((ColumnExpression) expression).getCarbonColumn());
       }
       return;
-    }
-    for (Expression child : expression.getChildren()) {
-      addColumnDimensions(child, filterDimensions, filterMeasure);
+    } else if (null != expression) {
+      for (Expression child : expression.getChildren()) {
+        addColumnDimensions(child, filterDimensions, filterMeasure);
+      }
     }
   }
 


Mime
View raw message