You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/03/08 01:33:16 UTC

incubator-atlas git commit: ATLAS-1655: Metrics query enhancement

Repository: incubator-atlas
Updated Branches:
  refs/heads/master f87f5f22b -> 7d622bdfa


ATLAS-1655: Metrics query enhancement

Signed-off-by: Madhan Neethiraj <ma...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/7d622bdf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/7d622bdf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/7d622bdf

Branch: refs/heads/master
Commit: 7d622bdfae11d535d184497e0221584a59f73e49
Parents: f87f5f2
Author: apoorvnaik <an...@hortonworks.com>
Authored: Tue Mar 7 15:55:49 2017 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Tue Mar 7 16:09:37 2017 -0800

----------------------------------------------------------------------
 .../apache/atlas/util/AtlasGremlin2QueryProvider.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7d622bdf/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java b/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
index 9acc1a9..4743b73 100644
--- a/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
+++ b/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
@@ -22,21 +22,21 @@ public class AtlasGremlin2QueryProvider extends AtlasGremlinQueryProvider {
     public String getQuery(final AtlasGremlinQuery gremlinQuery) {
         switch (gremlinQuery) {
             case TYPE_COUNT_METRIC:
-                return "g.V().has('__type', 'typeSystem').filter({it.'__type.category'.name() != 'TRAIT'}).count()";
+                return "g.V().has('__type', 'typeSystem').filter({!it.'__type.category'.name().matches('TRAIT')}).count()";
             case TYPE_UNUSED_COUNT_METRIC:
-                return "g.V('__type', 'typeSystem').filter({ it.'__type.category'.name() != 'TRAIT' && it.inE.count() == 0}).count()";
+                return "g.V('__type', 'typeSystem').filter({ !it.getProperty('__type.category').name().matches('TRAIT') && it.inE().count() == 0}).count()";
             case ENTITY_COUNT_METRIC:
                 return "g.V().has('__superTypeNames', T.in, ['Referenceable']).count()";
             case TAG_COUNT_METRIC:
-                return "g.V().has('__type', 'typeSystem').filter({it.'__type.category'.name() == 'TRAIT'}).count()";
+                return "g.V().has('__type', 'typeSystem').filter({it.getProperty('__type.category').name().matches('TRAIT')}).count()";
             case ENTITY_DELETED_METRIC:
-                return "g.V().has('__superTypeNames', T.in, ['Referenceable']).has('__status', 'DELETED').count()";
+                return "g.V().has('__typeName', T.in, g.V().has('__type', 'typeSystem').filter{it.getProperty('__type.category').name().matches('CLASS')}.'__type.name'.toSet()).has('__status', 'DELETED').count()";
             case ENTITIES_PER_TYPE_METRIC:
-                return "g.V().has('__typeName', T.in, g.V().has('__type', 'typeSystem').filter({it.'__type.category'.name() != 'TRAIT'}).'__type.name'.toSet()).groupCount{it.'__typeName'}.cap.toList()";
+                return "g.V().has('__typeName', T.in, g.V().has('__type', 'typeSystem').filter{it.getProperty('__type.category').name() == 'CLASS'}.'__type.name'.toSet()).groupCount{it.getProperty('__typeName')}.cap.toList()";
             case TAGGED_ENTITIES_METRIC:
-                return "g.V().has('__superTypeNames', T.in, ['Referenceable']).has('__traitNames').count()";
+                return "g.V().has('__traitNames', T.in, g.V().has('__type', 'typeSystem').filter{it.getProperty('__type.category').name() == 'TRAIT'}.'__type.name'.toSet()).count()";
             case ENTITIES_FOR_TAG_METRIC:
-                return "g.V().has('__typeName', T.in, g.V().has('__type', 'typeSystem').filter{it.'__type.category'.name() == 'TRAIT'}.'__type.name'.toSet()).groupCount{it.'__typeName'}.cap.toList()";
+                return "g.V().has('__typeName', T.in, g.V().has('__type', 'typeSystem').filter{it.getProperty('__type.category').name() == 'TRAIT'}.'__type.name'.toSet()).groupCount{it.getProperty('__typeName')}.cap.toList()";
             case EXPORT_BY_GUID_FULL:
                 return "g.V('__guid', startGuid).bothE().bothV().has('__guid').__guid.dedup().toList()";
             case EXPORT_BY_GUID_CONNECTED_IN_EDGE: