eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jay...@apache.org
Subject [08/10] eagle git commit: [EAGLE-1081] Checkstyle fixes for eagle-entity-base module
Date Wed, 07 Feb 2018 07:07:15 GMT
http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/ListQueryAPIResponseEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/ListQueryAPIResponseEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/ListQueryAPIResponseEntity.java
index 3f748d6..93e714b 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/ListQueryAPIResponseEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/ListQueryAPIResponseEntity.java
@@ -20,59 +20,77 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 
 /**
- * TODO: (hchen9) currently we disable firstTimestamp in response avoid breaking older client implementation, but we may need to remove "firstTimestamp" from @JsonIgnoreProperties(ignoreUnknown = true,value={"firstTimestamp"}) to enable the feature later
+ * TODO: (hchen9) currently we disable firstTimestamp in response avoid breaking older client implementation,
+ * but we may need to remove "firstTimestamp" from @JsonIgnoreProperties(ignoreUnknown =
+ * true,value={"firstTimestamp"}) to enable the feature later
  */
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@JsonIgnoreProperties(ignoreUnknown = true,value={"firstTimestamp"})
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true, value = {
+    "firstTimestamp"
+    })
 public class ListQueryAPIResponseEntity {
-	private boolean success;
-	private String exception;
-	private int totalResults;
-	private long elapsedms;
-	private long lastTimestamp;
-	private long firstTimestamp;
-	public long getFirstTimestamp() {
-		return firstTimestamp;
-	}
-	public void setFirstTimestamp(long firstTimestamp) {
-		this.firstTimestamp = firstTimestamp;
-	}
-	private Object obj;
-
-	public long getElapsedms() {
-		return elapsedms;
-	}
-	public void setElapsedms(long elapsedms) {
-		this.elapsedms = elapsedms;
-	}
-	public boolean isSuccess() {
-		return success;
-	}
-	public void setSuccess(boolean success) {
-		this.success = success;
-	}
-	public String getException() {
-		return exception;
-	}
-	public void setException(String exception) {
-		this.exception = exception;
-	}
-	public int getTotalResults() {
-		return totalResults;
-	}
-	public void setTotalResults(int totalResults) {
-		this.totalResults = totalResults;
-	}
-	public long getLastTimestamp() {
-		return lastTimestamp;
-	}
-	public void setLastTimestamp(long lastTimestamp) {
-		this.lastTimestamp = lastTimestamp;
-	}
-	public Object getObj() {
-		return obj;
-	}
-	public void setObj(Object obj) {
-		this.obj = obj;
-	}
-}
\ No newline at end of file
+    private boolean success;
+    private String exception;
+    private int totalResults;
+    private long elapsedms;
+    private long lastTimestamp;
+    private long firstTimestamp;
+
+    public long getFirstTimestamp() {
+        return firstTimestamp;
+    }
+
+    public void setFirstTimestamp(long firstTimestamp) {
+        this.firstTimestamp = firstTimestamp;
+    }
+
+    private Object obj;
+
+    public long getElapsedms() {
+        return elapsedms;
+    }
+
+    public void setElapsedms(long elapsedms) {
+        this.elapsedms = elapsedms;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public String getException() {
+        return exception;
+    }
+
+    public void setException(String exception) {
+        this.exception = exception;
+    }
+
+    public int getTotalResults() {
+        return totalResults;
+    }
+
+    public void setTotalResults(int totalResults) {
+        this.totalResults = totalResults;
+    }
+
+    public long getLastTimestamp() {
+        return lastTimestamp;
+    }
+
+    public void setLastTimestamp(long lastTimestamp) {
+        this.lastTimestamp = lastTimestamp;
+    }
+
+    public Object getObj() {
+        return obj;
+    }
+
+    public void setObj(Object obj) {
+        this.obj = obj;
+    }
+}

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogReader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogReader.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogReader.java
index da1e1ab..a0dd29a 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogReader.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogReader.java
@@ -19,10 +19,11 @@ package org.apache.eagle.log.entity;
 import java.io.Closeable;
 import java.io.IOException;
 
-public interface LogReader<T> extends Closeable{
-	public void open() throws IOException;
+public interface LogReader<T> extends Closeable {
+    public void open() throws IOException;
 
-	public void close() throws IOException;
-	
-	public T read() throws IOException;
+    @Override
+    public void close() throws IOException;
+
+    public T read() throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogWriter.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogWriter.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogWriter.java
index 6ef4ee3..9c10cd4 100644
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogWriter.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/LogWriter.java
@@ -19,14 +19,15 @@ package org.apache.eagle.log.entity;
 import java.io.Closeable;
 import java.io.IOException;
 
-public interface LogWriter extends Closeable{
-	public void flush() throws IOException;
+public interface LogWriter extends Closeable {
+    public void flush() throws IOException;
 
-	public void open() throws IOException;
+    public void open() throws IOException;
 
-	public void close() throws IOException;
+    @Override
+    public void close() throws IOException;
 
-	public byte[] write(InternalLog log) throws IOException;
-	
-	public void updateByRowkey(byte[] rowkey, InternalLog log) throws IOException;
-}
\ No newline at end of file
+    public byte[] write(InternalLog log) throws IOException;
+
+    public void updateByRowkey(byte[] rowkey, InternalLog log) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
index a430393..4bf82e6 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
@@ -28,90 +28,106 @@ import org.apache.eagle.log.entity.meta.Prefix;
 import org.apache.eagle.log.entity.meta.Table;
 import org.apache.eagle.log.entity.meta.TimeSeries;
 
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
 @Table("eagle_metric")
 @ColumnFamily("f")
 @Prefix("dmeta")
 @Service("MetricMetadataService")
 @TimeSeries(false)
 @Indexes({
-	@Index(name="Index_1_name", columns = { "name" }, unique = true)
-	})
+          @Index(name = "Index_1_name", columns = {
+                                                   "name"
+          }, unique = true)
+    })
 public class MetricMetadataEntity extends TaggedLogAPIEntity {
-	
-	@Column("a")
-	private String storeType;
-	@Column("b")
-	private String displayName;
-	@Column("c")
-	private String defaultDownSamplingFunction;
-	@Column("d")
-	private String defaultAggregateFunction;
-	@Column("e")
-	private String aggFunctions;
-	@Column("f")
-	private String downSamplingFunctions;
-	@Column("g")
-	private String resolutions;
-	@Column("h")
-	private String drillDownPaths;
-	
-	public String getStoreType() {
-		return storeType;
-	}
-	public void setStoreType(String storeType) {
-		this.storeType = storeType;
-		pcs.firePropertyChange("storeType", null, null);
-	}
-	public String getDisplayName() {
-		return displayName;
-	}
-	public void setDisplayName(String displayName) {
-		this.displayName = displayName;
-		pcs.firePropertyChange("displayName", null, null);
-	}
-	public String getDefaultDownSamplingFunction() {
-		return defaultDownSamplingFunction;
-	}
-	public void setDefaultDownSamplingFunction(String defaultDownSamplingFunction) {
-		this.defaultDownSamplingFunction = defaultDownSamplingFunction;
-		pcs.firePropertyChange("defaultDownSamplingFunction", null, null);
-	}
-	public String getDefaultAggregateFunction() {
-		return defaultAggregateFunction;
-	}
-	public void setDefaultAggregateFunction(String defaultAggregateFunction) {
-		this.defaultAggregateFunction = defaultAggregateFunction;
-		pcs.firePropertyChange("defaultAggregateFunction", null, null);
-	}
-	public String getAggFunctions() {
-		return aggFunctions;
-	}
-	public void setAggFunctions(String aggFunctions) {
-		this.aggFunctions = aggFunctions;
-		pcs.firePropertyChange("aggFunctions", null, null);
-	}
-	public String getDownSamplingFunctions() {
-		return downSamplingFunctions;
-	}
-	public void setDownSamplingFunctions(String downSamplingFunctions) {
-		this.downSamplingFunctions = downSamplingFunctions;
-		pcs.firePropertyChange("downSamplingFunctions", null, null);
-	}
-	public String getResolutions() {
-		return resolutions;
-	}
-	public void setResolutions(String resolutions) {
-		this.resolutions = resolutions;
-		pcs.firePropertyChange("resolutions", null, null);
-	}
-	public String getDrillDownPaths() {
-		return drillDownPaths;
-	}
-	public void setDrillDownPaths(String drillDownPaths) {
-		this.drillDownPaths = drillDownPaths;
-		pcs.firePropertyChange("drillDownPaths", null, null);
-	}
-	
+
+    @Column("a")
+    private String storeType;
+    @Column("b")
+    private String displayName;
+    @Column("c")
+    private String defaultDownSamplingFunction;
+    @Column("d")
+    private String defaultAggregateFunction;
+    @Column("e")
+    private String aggFunctions;
+    @Column("f")
+    private String downSamplingFunctions;
+    @Column("g")
+    private String resolutions;
+    @Column("h")
+    private String drillDownPaths;
+
+    public String getStoreType() {
+        return storeType;
+    }
+
+    public void setStoreType(String storeType) {
+        this.storeType = storeType;
+        pcs.firePropertyChange("storeType", null, null);
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+        pcs.firePropertyChange("displayName", null, null);
+    }
+
+    public String getDefaultDownSamplingFunction() {
+        return defaultDownSamplingFunction;
+    }
+
+    public void setDefaultDownSamplingFunction(String defaultDownSamplingFunction) {
+        this.defaultDownSamplingFunction = defaultDownSamplingFunction;
+        pcs.firePropertyChange("defaultDownSamplingFunction", null, null);
+    }
+
+    public String getDefaultAggregateFunction() {
+        return defaultAggregateFunction;
+    }
+
+    public void setDefaultAggregateFunction(String defaultAggregateFunction) {
+        this.defaultAggregateFunction = defaultAggregateFunction;
+        pcs.firePropertyChange("defaultAggregateFunction", null, null);
+    }
+
+    public String getAggFunctions() {
+        return aggFunctions;
+    }
+
+    public void setAggFunctions(String aggFunctions) {
+        this.aggFunctions = aggFunctions;
+        pcs.firePropertyChange("aggFunctions", null, null);
+    }
+
+    public String getDownSamplingFunctions() {
+        return downSamplingFunctions;
+    }
+
+    public void setDownSamplingFunctions(String downSamplingFunctions) {
+        this.downSamplingFunctions = downSamplingFunctions;
+        pcs.firePropertyChange("downSamplingFunctions", null, null);
+    }
+
+    public String getResolutions() {
+        return resolutions;
+    }
+
+    public void setResolutions(String resolutions) {
+        this.resolutions = resolutions;
+        pcs.firePropertyChange("resolutions", null, null);
+    }
+
+    public String getDrillDownPaths() {
+        return drillDownPaths;
+    }
+
+    public void setDrillDownPaths(String drillDownPaths) {
+        this.drillDownPaths = drillDownPaths;
+        pcs.firePropertyChange("drillDownPaths", null, null);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierCreationListener.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierCreationListener.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierCreationListener.java
index b0eeaed..890540d 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierCreationListener.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierCreationListener.java
@@ -19,10 +19,10 @@ package org.apache.eagle.log.entity;
 import java.util.Map;
 
 public interface QualifierCreationListener {
-	/**
-	 * Qualifier <b>display name</b> mapped to qualifier value in bytes[]
-	 *
-	 * @param qualifiers
-	 */
-	public void qualifierCreated(Map<String, byte[]> qualifiers);
+    /**
+     * Qualifier <b>display name</b> mapped to qualifier value in bytes[]
+     *
+     * @param qualifiers
+     */
+    public void qualifierCreated(Map<String, byte[]> qualifiers);
 }

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierNotDefinedException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierNotDefinedException.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierNotDefinedException.java
index 88135bb..1225ba7 100644
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierNotDefinedException.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/QualifierNotDefinedException.java
@@ -16,13 +16,13 @@
  */
 package org.apache.eagle.log.entity;
 
-public class QualifierNotDefinedException extends Exception{
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
+public class QualifierNotDefinedException extends Exception {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
 
-	public QualifierNotDefinedException(String message){
-		super(message);
-	}
+    public QualifierNotDefinedException(String message) {
+        super(message);
+    }
 }

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyBuilder.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyBuilder.java
index 5154cc4..2ef0680 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyBuilder.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyBuilder.java
@@ -27,114 +27,122 @@ import org.apache.eagle.log.entity.meta.EntityDefinition;
 import org.apache.eagle.common.ByteUtil;
 
 public class RowkeyBuilder {
-	
-	public static final int EMPTY_PARTITION_DEFAULT_HASH_CODE = 0;
-	
-	/**
-	 * Generate the internal sorted hashmap for tags. Please note the partition tags should not be included in the result map.
-	 * @param partitions array of partition tags in order
-	 * @param tags tags of the entity
-	 * @return the sorted hash map of the tags
-	 */
-	public static SortedMap<Integer, Integer> generateSortedTagMap(String[] partitions, Map<String, String> tags) {
-		final SortedMap<Integer, Integer> tagHashMap = new TreeMap<Integer, Integer>();
-		for (Map.Entry<String, String> entry: tags.entrySet()) {
-			final String tagName = entry.getKey();
-			final String tagValue = entry.getValue();
-			// If it's a partition tag, we need to remove it from tag hash list. It need to 
-			// put to the fix partition hash slot in rowkey.
-			if (tagValue == null || isPartitionTag(partitions, tagName))
-				continue;
-			tagHashMap.put(tagName.hashCode(), tagValue.hashCode());
-		}
-		return tagHashMap;
-	}
-	
-	/**
-	 * build rowkey from InternalLog object
-	 * @param log internal log entity to write
-	 * @return the rowkey of the entity
-	 */
-	public static byte[] buildRowkey(InternalLog log) {
-		final String[] partitions = log.getPartitions();
-		final Map<String, String> tags = log.getTags();
-		final SortedMap<Integer, Integer> tagHashMap = generateSortedTagMap(partitions, tags);
-		
-		// reverse timestamp
-		long ts = Long.MAX_VALUE - log.getTimestamp();
-		
-		List<Integer> partitionHashValues = new ArrayList<Integer>();
-		if (partitions != null) {
-			for (String partition : partitions) {
-				final String tagValue = tags.get(partition);
-				if (tagValue != null) {
-					partitionHashValues.add(tagValue.hashCode());
-				} else {
-					partitionHashValues.add(EMPTY_PARTITION_DEFAULT_HASH_CODE);
-				}
-			}
-		}
-		return buildRowkey(log.getPrefix().hashCode(), partitionHashValues, ts, tagHashMap);
-	}
-	
-	public static long getTimestamp(byte[] rowkey, EntityDefinition ed) {
-		if (!ed.isTimeSeries()) {
-			return EntityConstants.FIXED_WRITE_TIMESTAMP;
-		}
-		final int offset = (ed.getPartitions() == null) ? 4 : (4 + ed.getPartitions().length * 4);
-		return Long.MAX_VALUE - ByteUtil.bytesToLong(rowkey, offset);
-	}
-	
-	/**
-	 * Check if the tagName is one of the partition tags
-	 * @param partitions paritition tags of the entity
-	 * @param tagName the tag name that needs to check
-	 * @return
-	 */
-	private static boolean isPartitionTag(String[] partitions, String tagName) {
-		if (partitions != null) {
-			for (String partition : partitions) {
-				if (partition.equals(tagName)) {
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * rowkey is: prefixHash:4 + (partitionValueHash:4)* + timestamp:8 + (tagnameHash:4 + tagvalueHash:4)*
-	 * partition fields are sorted by partition definition order, while tag fields are sorted by tag name's 
-	 * hash code values. 
-	 */
-	private static byte[] buildRowkey(int prefixHash, List<Integer> partitionHashValues, long timestamp, SortedMap<Integer, Integer> tags){
-		// allocate byte array for rowkey
-		final int len = 4 + 8 + tags.size() * (4 + 4) + (partitionHashValues.size() * 4);
-		final byte[] rowkey = new byte[len];
-		int offset = 0;
-
-		// 1. set prefix
-		ByteUtil.intToBytes(prefixHash, rowkey, offset);
-		offset += 4;
-		
-		// 2. set partition
-		for (Integer partHash : partitionHashValues) {
-			ByteUtil.intToBytes(partHash, rowkey, offset);
-			offset += 4;
-		}
-		
-		// 3. set timestamp
-		ByteUtil.longToBytes(timestamp, rowkey, offset);
-		offset += 8;
-
-		// 4. set tag key/value hashes
-		for (Map.Entry<Integer, Integer> entry : tags.entrySet()) {
-			ByteUtil.intToBytes(entry.getKey(), rowkey, offset);
-			offset += 4;
-			ByteUtil.intToBytes(entry.getValue(), rowkey, offset);
-			offset += 4;
-		}
-		
-		return rowkey;
-	}
+
+    public static final int EMPTY_PARTITION_DEFAULT_HASH_CODE = 0;
+
+    /**
+     * Generate the internal sorted hashmap for tags. Please note the partition tags should not be included in
+     * the result map.
+     *
+     * @param partitions array of partition tags in order
+     * @param tags tags of the entity
+     * @return the sorted hash map of the tags
+     */
+    public static SortedMap<Integer, Integer> generateSortedTagMap(String[] partitions,
+                                                                   Map<String, String> tags) {
+        final SortedMap<Integer, Integer> tagHashMap = new TreeMap<Integer, Integer>();
+        for (Map.Entry<String, String> entry : tags.entrySet()) {
+            final String tagName = entry.getKey();
+            final String tagValue = entry.getValue();
+            // If it's a partition tag, we need to remove it from tag hash list. It need to
+            // put to the fix partition hash slot in rowkey.
+            if (tagValue == null || isPartitionTag(partitions, tagName)) {
+                continue;
+            }
+            tagHashMap.put(tagName.hashCode(), tagValue.hashCode());
+        }
+        return tagHashMap;
+    }
+
+    /**
+     * build rowkey from InternalLog object
+     *
+     * @param log internal log entity to write
+     * @return the rowkey of the entity
+     */
+    public static byte[] buildRowkey(InternalLog log) {
+        final String[] partitions = log.getPartitions();
+        final Map<String, String> tags = log.getTags();
+        final SortedMap<Integer, Integer> tagHashMap = generateSortedTagMap(partitions, tags);
+
+        // reverse timestamp
+        long ts = Long.MAX_VALUE - log.getTimestamp();
+
+        List<Integer> partitionHashValues = new ArrayList<Integer>();
+        if (partitions != null) {
+            for (String partition : partitions) {
+                final String tagValue = tags.get(partition);
+                if (tagValue != null) {
+                    partitionHashValues.add(tagValue.hashCode());
+                } else {
+                    partitionHashValues.add(EMPTY_PARTITION_DEFAULT_HASH_CODE);
+                }
+            }
+        }
+        return buildRowkey(log.getPrefix().hashCode(), partitionHashValues, ts, tagHashMap);
+    }
+
+    /**
+     * rowkey is: prefixHash:4 + (partitionValueHash:4)* + timestamp:8 + (tagnameHash:4 + tagvalueHash:4)*
+     * partition fields are sorted by partition definition order, while tag fields are sorted by tag name's
+     * hash code values.
+     */
+    private static byte[] buildRowkey(int prefixHash, List<Integer> partitionHashValues, long timestamp,
+                                      SortedMap<Integer, Integer> tags) {
+        // allocate byte array for rowkey
+        final int len = 4 + 8 + tags.size() * (4 + 4) + (partitionHashValues.size() * 4);
+        final byte[] rowkey = new byte[len];
+        int offset = 0;
+
+        // 1. set prefix
+        ByteUtil.intToBytes(prefixHash, rowkey, offset);
+        offset += 4;
+
+        // 2. set partition
+        for (Integer partHash : partitionHashValues) {
+            ByteUtil.intToBytes(partHash, rowkey, offset);
+            offset += 4;
+        }
+
+        // 3. set timestamp
+        ByteUtil.longToBytes(timestamp, rowkey, offset);
+        offset += 8;
+
+        // 4. set tag key/value hashes
+        for (Map.Entry<Integer, Integer> entry : tags.entrySet()) {
+            ByteUtil.intToBytes(entry.getKey(), rowkey, offset);
+            offset += 4;
+            ByteUtil.intToBytes(entry.getValue(), rowkey, offset);
+            offset += 4;
+        }
+
+        return rowkey;
+    }
+
+    public static long getTimestamp(byte[] rowkey, EntityDefinition ed) {
+        if (!ed.isTimeSeries()) {
+            return EntityConstants.FIXED_WRITE_TIMESTAMP;
+        }
+        final int offset = (ed.getPartitions() == null) ? 4 : (4 + ed.getPartitions().length * 4);
+        return Long.MAX_VALUE - ByteUtil.bytesToLong(rowkey, offset);
+    }
+
+    /**
+     * Check if the tagName is one of the partition tags
+     *
+     * @param partitions paritition tags of the entity
+     * @param tagName the tag name that needs to check
+     * @return
+     */
+    private static boolean isPartitionTag(String[] partitions, String tagName) {
+        if (partitions != null) {
+            for (String partition : partitions) {
+                if (partition.equals(tagName)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyQueryAPIResponseEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyQueryAPIResponseEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyQueryAPIResponseEntity.java
index 953d12b..6189983 100644
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyQueryAPIResponseEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/RowkeyQueryAPIResponseEntity.java
@@ -18,28 +18,33 @@ package org.apache.eagle.log.entity;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
 public class RowkeyQueryAPIResponseEntity {
-	private boolean success;
-	private String exception;
-	private Object obj;
-
-	public boolean isSuccess() {
-		return success;
-	}
-	public void setSuccess(boolean success) {
-		this.success = success;
-	}
-	public String getException() {
-		return exception;
-	}
-	public void setException(String exception) {
-		this.exception = exception;
-	}
-	public Object getObj() {
-		return obj;
-	}
-	public void setObj(Object obj) {
-		this.obj = obj;
-	}
-}
\ No newline at end of file
+    private boolean success;
+    private String exception;
+    private Object obj;
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public String getException() {
+        return exception;
+    }
+
+    public void setException(String exception) {
+        this.exception = exception;
+    }
+
+    public Object getObj() {
+        return obj;
+    }
+
+    public void setObj(Object obj) {
+        this.obj = obj;
+    }
+}

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
index 68db2c4..e9c0dca 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
@@ -23,126 +23,138 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * search condition includes the following:
- * 1. prefix - part of rowkey
- * 2. startTime,endTime - timestamp, part of rowkey
- * 3. hbase filter converted from query 
- * 4. aggregate parameters
- * 4. sort options
- * 5. output fields and tags
- * 6. entityName
- * 7. pagination: pageSize and startRowkey
+ * search condition includes the following: 1. prefix - part of rowkey 2. startTime,endTime - timestamp, part
+ * of rowkey 3. hbase filter converted from query 4. aggregate parameters 4. sort options 5. output fields and
+ * tags 6. entityName 7. pagination: pageSize and startRowkey
  */
-public class SearchCondition{
-	private long startTime;
-	private long endTime;
-	private Filter filter;
-	private List<String> outputFields;
-	private boolean outputAll;
-	private long pageSize;
-	private String startRowkey;
-	private String entityName;
-	private List<String> partitionValues;
-	private ORExpression queryExpression;
-
-	public boolean isOutputVerbose() {
-		return outputVerbose;
-	}
-
-	public void setOutputVerbose(boolean outputVerbose) {
-		this.outputVerbose = outputVerbose;
-	}
-
-	public Map<String, String> getOutputAlias() {
-		return outputAlias;
-	}
-
-	public void setOutputAlias(Map<String, String> outputAlias) {
-		this.outputAlias = outputAlias;
-	}
-
-	private boolean outputVerbose;
-	private Map<String,String> outputAlias;
-
-	/**
-	 * copy constructor
-	 * @param sc
-	 */
-	public SearchCondition(SearchCondition sc){
-		this.startTime = sc.startTime;
-		this.endTime = sc.endTime;
-		this.filter = sc.filter;
-		this.outputFields = sc.outputFields;
-		this.pageSize = sc.pageSize;
-		this.startRowkey = sc.startRowkey;
-		this.entityName = sc.entityName;
-		this.partitionValues = sc.partitionValues;
-		this.queryExpression = sc.queryExpression;
-	}
-	
-	public SearchCondition(){
-	}
-	
-	public Filter getFilter() {
-		return filter;
-	}
-	public void setFilter(Filter filter) {
-		this.filter = filter;
-	}
-	public long getPageSize() {
-		return pageSize;
-	}
-	public void setPageSize(long pageSize) {
-		this.pageSize = pageSize;
-	}
-	public String getStartRowkey() {
-		return startRowkey;
-	}
-	public void setStartRowkey(String startRowkey) {
-		this.startRowkey = startRowkey;
-	}
-	public String getEntityName() {
-		return entityName;
-	}
-	public void setEntityName(String entityName) {
-		this.entityName = entityName;
-	}
-	public List<String> getOutputFields() {
-		return outputFields;
-	}
-	public void setOutputFields(List<String> outputFields) {
-		this.outputFields = outputFields;
-	}
-	public long getStartTime() {
-		return startTime;
-	}
-	public void setStartTime(long startTime) {
-		this.startTime = startTime;
-	}
-	public long getEndTime() {
-		return endTime;
-	}
-	public void setEndTime(long endTime) {
-		this.endTime = endTime;
-	}
-	public List<String> getPartitionValues() {
-		return partitionValues;
-	}
-	public void setPartitionValues(List<String> partitionValues) {
-		this.partitionValues = partitionValues;
-	}
-	public ORExpression getQueryExpression() {
-		return queryExpression;
-	}
-	public void setQueryExpression(ORExpression queryExpression) {
-		this.queryExpression = queryExpression;
-	}
-
-	public boolean isOutputAll() {
-		return outputAll;
-	}
-
-	public void setOutputAll(boolean outputAll) {
-		this.outputAll = outputAll;
-	}
+public class SearchCondition {
+    private long startTime;
+    private long endTime;
+    private Filter filter;
+    private List<String> outputFields;
+    private boolean outputAll;
+    private long pageSize;
+    private String startRowkey;
+    private String entityName;
+    private List<String> partitionValues;
+    private ORExpression queryExpression;
+
+    public boolean isOutputVerbose() {
+        return outputVerbose;
+    }
+
+    public void setOutputVerbose(boolean outputVerbose) {
+        this.outputVerbose = outputVerbose;
+    }
+
+    public Map<String, String> getOutputAlias() {
+        return outputAlias;
+    }
+
+    public void setOutputAlias(Map<String, String> outputAlias) {
+        this.outputAlias = outputAlias;
+    }
+
+    private boolean outputVerbose;
+    private Map<String, String> outputAlias;
+
+    /**
+     * copy constructor
+     * 
+     * @param sc
+     */
+    public SearchCondition(SearchCondition sc) {
+        this.startTime = sc.startTime;
+        this.endTime = sc.endTime;
+        this.filter = sc.filter;
+        this.outputFields = sc.outputFields;
+        this.pageSize = sc.pageSize;
+        this.startRowkey = sc.startRowkey;
+        this.entityName = sc.entityName;
+        this.partitionValues = sc.partitionValues;
+        this.queryExpression = sc.queryExpression;
+    }
+
+    public SearchCondition() {
+    }
+
+    public Filter getFilter() {
+        return filter;
+    }
+
+    public void setFilter(Filter filter) {
+        this.filter = filter;
+    }
+
+    public long getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(long pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public String getStartRowkey() {
+        return startRowkey;
+    }
+
+    public void setStartRowkey(String startRowkey) {
+        this.startRowkey = startRowkey;
+    }
+
+    public String getEntityName() {
+        return entityName;
+    }
+
+    public void setEntityName(String entityName) {
+        this.entityName = entityName;
+    }
+
+    public List<String> getOutputFields() {
+        return outputFields;
+    }
+
+    public void setOutputFields(List<String> outputFields) {
+        this.outputFields = outputFields;
+    }
+
+    public long getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(long startTime) {
+        this.startTime = startTime;
+    }
+
+    public long getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(long endTime) {
+        this.endTime = endTime;
+    }
+
+    public List<String> getPartitionValues() {
+        return partitionValues;
+    }
+
+    public void setPartitionValues(List<String> partitionValues) {
+        this.partitionValues = partitionValues;
+    }
+
+    public ORExpression getQueryExpression() {
+        return queryExpression;
+    }
+
+    public void setQueryExpression(ORExpression queryExpression) {
+        this.queryExpression = queryExpression;
+    }
+
+    public boolean isOutputAll() {
+        return outputAll;
+    }
+
+    public void setOutputAll(boolean outputAll) {
+        this.outputAll = outputAll;
+    }
 }

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/StreamReader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/StreamReader.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/StreamReader.java
index 005a2e2..36aa0b6 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/StreamReader.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/StreamReader.java
@@ -20,36 +20,39 @@ import java.util.ArrayList;
 import java.util.List;
 
 public abstract class StreamReader {
-	protected List<EntityCreationListener> _listeners = new ArrayList<EntityCreationListener>();
+    protected List<EntityCreationListener> listeners = new ArrayList<EntityCreationListener>();
 
-	/**
-	 * Listener can be only notified after it is added to listener list
-	 * @param listener
-	 */
-	public synchronized void register(EntityCreationListener listener){
-		_listeners.add(listener);
-	}
-	
-	/**
-	 * Listener can not get notification once after it is removed from listener list
-	 * @param listener
-	 */
-	public synchronized void unregister(EntityCreationListener listener){
-		_listeners.remove(listener);
-	}
-	
-	public abstract void readAsStream() throws Exception;
-	
-	/**
-	 * Get scanned last entity timestamp
-	 * 
-	 * @return
-	 */
-	public abstract long getLastTimestamp();
-	
-	/**
-	 * Get scanned first entity timestamp
-	 * @return
-	 */
-	public abstract long getFirstTimestamp();
-}
\ No newline at end of file
+    /**
+     * Listener can be only notified after it is added to listener list
+     *
+     * @param listener
+     */
+    public synchronized void register(EntityCreationListener listener) {
+        listeners.add(listener);
+    }
+
+    /**
+     * Listener can not get notification once after it is removed from listener list
+     *
+     * @param listener
+     */
+    public synchronized void unregister(EntityCreationListener listener) {
+        listeners.remove(listener);
+    }
+
+    public abstract void readAsStream() throws Exception;
+
+    /**
+     * Get scanned last entity timestamp
+     *
+     * @return
+     */
+    public abstract long getLastTimestamp();
+
+    /**
+     * Get scanned first entity timestamp
+     *
+     * @return
+     */
+    public abstract long getFirstTimestamp();
+}

http://git-wip-us.apache.org/repos/asf/eagle/blob/6e919c2e/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/filter/BooleanExpressionComparator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/filter/BooleanExpressionComparator.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/filter/BooleanExpressionComparator.java
index 0d71e10..6ecf93c 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/filter/BooleanExpressionComparator.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/filter/BooleanExpressionComparator.java
@@ -37,15 +37,11 @@ import java.io.IOException;
 import java.util.*;
 
 /**
- * BooleanExpressionComparator
- *
- * Currently support double expression only.
- *
- * TODO: 1) thread-safe? 2) Rewrite filter expression to evaluate once
- *
+ * BooleanExpressionComparator Currently support double expression only. TODO: 1) thread-safe? 2) Rewrite
+ * filter expression to evaluate once
  */
 public class BooleanExpressionComparator implements WritableComparable<List<KeyValue>> {
-    private final static Logger LOG = LoggerFactory.getLogger(BooleanExpressionComparator.class);
+    private static final Logger LOG = LoggerFactory.getLogger(BooleanExpressionComparator.class);
 
     // Should be Writable
     private QualifierFilterEntity filterEntity;
@@ -62,22 +58,23 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
 
     private Set<String> requiredFields = new HashSet<String>();
 
-    public BooleanExpressionComparator(){}
+    public BooleanExpressionComparator() {
+    }
 
-    public BooleanExpressionComparator(QualifierFilterEntity entity,EntityDefinition ed){
-        this.filterEntity  = entity;
+    public BooleanExpressionComparator(QualifierFilterEntity entity, EntityDefinition ed) {
+        this.filterEntity = entity;
         this.ed = ed;
         try {
             this.init();
         } catch (Exception ex) {
             // Client side expression validation to fast fail if having error
-            LOG.error("Got exception: "+ex.getMessage(),ex);
-            throw new ExpressionEvaluationException(ex.getMessage(),ex);
+            LOG.error("Got exception: " + ex.getMessage(), ex);
+            throw new ExpressionEvaluationException(ex.getMessage(), ex);
         }
     }
 
     private void init() throws ParsiiInvalidException, ParseException {
-        LOG.info("Filter expression: "+filterEntity.toString());
+        LOG.info("Filter expression: " + filterEntity.toString());
         if (filterEntity.getKey() != null) {
             if (filterEntity.getKeyType() == TokenType.NUMBER) {
                 leftValue = Double.parseDouble(filterEntity.getKey());
@@ -100,11 +97,14 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
             throw new IllegalStateException("QualifierFilterEntity value is null");
         }
 
-        if (this.filterEntity.getOp() == null)
+        if (this.filterEntity.getOp() == null) {
             throw new IllegalStateException("QualifierFilterEntity op is null");
+        }
         this.func = _opExprFuncMap.get(this.filterEntity.getOp());
-        if (this.func == null)
-            throw new IllegalStateException("No boolean evaluation function found for operation: " + this.filterEntity.getOp());
+        if (this.func == null) {
+            throw new IllegalStateException("No boolean evaluation function found for operation: "
+                                            + this.filterEntity.getOp());
+        }
     }
 
     /**
@@ -114,24 +114,26 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
      * @return evaluation result as true (1) or false (0)
      * @throws Exception
      */
-    private boolean eval(Map<String,Double> context) throws Exception {
-        if(filterEntity.getKeyType() != TokenType.NUMBER){
-            leftValue = eval(filterEntity.getKey(),context);
+    private boolean eval(Map<String, Double> context) throws Exception {
+        if (filterEntity.getKeyType() != TokenType.NUMBER) {
+            leftValue = eval(filterEntity.getKey(), context);
         }
-        if(filterEntity.getValueType() != TokenType.NUMBER){
-            rightValue = eval(filterEntity.getValue(),context);
+        if (filterEntity.getValueType() != TokenType.NUMBER) {
+            rightValue = eval(filterEntity.getValue(), context);
         }
-        if(Double.isInfinite(leftValue) || Double.isInfinite(rightValue)){
-//            if(LOG.isDebugEnabled()) {
+        if (Double.isInfinite(leftValue) || Double.isInfinite(rightValue)) {
+            // if(LOG.isDebugEnabled()) {
             if (Double.isInfinite(leftValue)) {
-                LOG.warn("Evaluation result of key: " + this.filterEntity.getKey() + " is " + leftValue + " (Infinite), ignore");
+                LOG.warn("Evaluation result of key: " + this.filterEntity.getKey() + " is " + leftValue
+                         + " (Infinite), ignore");
             } else {
-                LOG.warn("Evaluation result of value: "+this.filterEntity.getValue()+" is "+rightValue+" (Infinite), ignore");
+                LOG.warn("Evaluation result of value: " + this.filterEntity.getValue() + " is " + rightValue
+                         + " (Infinite), ignore");
             }
-//            }
+            // }
             return false;
         }
-        return func.eval(leftValue,rightValue);
+        return func.eval(leftValue, rightValue);
     }
 
     /**
@@ -142,38 +144,40 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
      * @return
      * @throws Exception
      */
-    private double eval(String expr,Map<String,Double> context) throws Exception {
+    private double eval(String expr, Map<String, Double> context) throws Exception {
         return ExpressionParser.parse(expr).eval(context);
     }
 
     /**
-     *
      * @param row List[KeyValue] All key values in a row
-     *
      * @return 0 to filter out row [false], otherwise to include row into scanner [true]
      */
     @Override
     public int compareTo(List<KeyValue> row) {
-        Map<String,Double> context = new HashMap<String, Double>();
-        for(KeyValue kv:row){
+        Map<String, Double> context = new HashMap<String, Double>();
+        for (KeyValue kv : row) {
             String qualifierName = new String(kv.getQualifier());
 
             // Because assume just handle about double value
             // so ignore tag whose value is String
-            if(!this.ed.isTag(qualifierName)){
+            if (!this.ed.isTag(qualifierName)) {
                 Qualifier qualifier = this.ed.getQualifierNameMap().get(qualifierName);
                 String displayName = qualifier.getDisplayName();
-                if(displayName == null) displayName = qualifierName;
+                if (displayName == null) {
+                    displayName = qualifierName;
+                }
                 try {
-                    if(this.requiredFields.contains(displayName)) {
+                    if (this.requiredFields.contains(displayName)) {
                         EntitySerDeser serDeser = qualifier.getSerDeser();
-                        double value = EntityQualifierUtils.convertObjToDouble(serDeser.deserialize(kv.getValue()));
+                        double value = EntityQualifierUtils
+                            .convertObjToDouble(serDeser.deserialize(kv.getValue()));
                         if (Double.isNaN(value)) {
                             context.put(displayName, value);
                         }
                     }
-                }catch (Exception ex){
-                    LOG.warn("Failed to parse value of field "+displayName+" as double, ignore: "+ex.getMessage(),ex);
+                } catch (Exception ex) {
+                    LOG.warn("Failed to parse value of field " + displayName + " as double, ignore: "
+                             + ex.getMessage(), ex);
                 }
             }
         }
@@ -182,22 +186,22 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
 
     /**
      * @param context Map[String,Double]
-     *
      * @return context.keySet().containsAll(this.requiredFields) && eval(context) ? 1:0;
      */
-    int compareTo(Map<String,Double> context){
+    int compareTo(Map<String, Double> context) {
         try {
-            if(context.keySet().containsAll(this.requiredFields)){
-                return eval(context)? 1:0;
-            }else{
-                if(LOG.isDebugEnabled()) {
-                    LOG.debug("Require variables: [" + StringUtils.join(this.requiredFields, ",") + "], but just given: [" + StringUtils.join(context.keySet(), ",") + "]");
+            if (context.keySet().containsAll(this.requiredFields)) {
+                return eval(context) ? 1 : 0;
+            } else {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Require variables: [" + StringUtils.join(this.requiredFields, ",")
+                              + "], but just given: [" + StringUtils.join(context.keySet(), ",") + "]");
                 }
                 return 0;
             }
         } catch (Exception e) {
-            LOG.error(e.getMessage(),e);
-            throw new ExpressionEvaluationException(e.getMessage(),e);
+            LOG.error(e.getMessage(), e);
+            throw new ExpressionEvaluationException(e.getMessage(), e);
         }
     }
 
@@ -216,31 +220,31 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
 
         try {
             this.init();
-        } catch (Exception ex){
-            LOG.error("Got exception: "+ex.getMessage(),ex);
-            throw new IOException(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            LOG.error("Got exception: " + ex.getMessage(), ex);
+            throw new IOException(ex.getMessage(), ex);
         }
     }
 
-    private static Map<ComparisonOperator,BooleanExprFunc> _opExprFuncMap = new HashMap<ComparisonOperator, BooleanExprFunc>();
+    private static Map<ComparisonOperator, BooleanExprFunc> _opExprFuncMap = new HashMap<ComparisonOperator, BooleanExprFunc>();
 
     static {
-        _opExprFuncMap.put(ComparisonOperator.EQUAL,new EqualExprFunc());
-        _opExprFuncMap.put(ComparisonOperator.IS,new EqualExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.EQUAL, new EqualExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.IS, new EqualExprFunc());
 
-        _opExprFuncMap.put(ComparisonOperator.NOT_EQUAL,new NotEqualExprFunc());
-        _opExprFuncMap.put(ComparisonOperator.IS_NOT,new NotEqualExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.NOT_EQUAL, new NotEqualExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.IS_NOT, new NotEqualExprFunc());
 
-        _opExprFuncMap.put(ComparisonOperator.LESS,new LessExprFunc());
-        _opExprFuncMap.put(ComparisonOperator.LESS_OR_EQUAL,new LessOrEqualExprFunc());
-        _opExprFuncMap.put(ComparisonOperator.GREATER,new GreaterExprFunc());
-        _opExprFuncMap.put(ComparisonOperator.GREATER_OR_EQUAL,new GreaterOrEqualExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.LESS, new LessExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.LESS_OR_EQUAL, new LessOrEqualExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.GREATER, new GreaterExprFunc());
+        _opExprFuncMap.put(ComparisonOperator.GREATER_OR_EQUAL, new GreaterOrEqualExprFunc());
 
         // "Life should be much better with functional programming language" - Hao Chen Nov 18th, 2014
     }
 
     private static interface BooleanExprFunc {
-        boolean eval(double val1,double val2);
+        boolean eval(double val1, double val2);
     }
 
     private static class EqualExprFunc implements BooleanExprFunc {
@@ -249,6 +253,7 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
             return val1 == val2;
         }
     }
+
     private static class NotEqualExprFunc implements BooleanExprFunc {
         @Override
         public boolean eval(double val1, double val2) {
@@ -262,18 +267,21 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
             return val1 < val2;
         }
     }
+
     private static class LessOrEqualExprFunc implements BooleanExprFunc {
         @Override
         public boolean eval(double val1, double val2) {
             return val1 <= val2;
         }
     }
+
     private static class GreaterExprFunc implements BooleanExprFunc {
         @Override
         public boolean eval(double val1, double val2) {
             return val1 > val2;
         }
     }
+
     private static class GreaterOrEqualExprFunc implements BooleanExprFunc {
         @Override
         public boolean eval(double val1, double val2) {
@@ -281,13 +289,15 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
         }
     }
 
-    public static class ExpressionEvaluationException extends RuntimeException{
+    public static class ExpressionEvaluationException extends RuntimeException {
         public ExpressionEvaluationException(String message, Throwable cause) {
             super(message, cause);
         }
+
         public ExpressionEvaluationException(String message) {
             super(message);
         }
+
         public ExpressionEvaluationException(Throwable cause) {
             super(cause);
         }
@@ -295,6 +305,6 @@ public class BooleanExpressionComparator implements WritableComparable<List<KeyV
 
     @Override
     public String toString() {
-        return this.getClass().getSimpleName()+" ("+this.filterEntity.toString()+")";
+        return this.getClass().getSimpleName() + " (" + this.filterEntity.toString() + ")";
     }
-}
\ No newline at end of file
+}


Mime
View raw message