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/11/12 18:14:23 UTC

[14/42] atlas git commit: ATLAS-2251: Remove TypeSystem and related implementation, to avoid unncessary duplicate of type details in cache

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/repository/src/test/scala/org/apache/atlas/query/ExpressionTest.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/ExpressionTest.scala b/repository/src/test/scala/org/apache/atlas/query/ExpressionTest.scala
deleted file mode 100755
index 918f327..0000000
--- a/repository/src/test/scala/org/apache/atlas/query/ExpressionTest.scala
+++ /dev/null
@@ -1,172 +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.apache.atlas.query
-
-import org.apache.atlas.DBSandboxer
-import org.apache.atlas.query.Expressions._
-import org.apache.atlas.repository.BaseTest
-import org.testng.annotations.{BeforeMethod, Listeners, Test}
-
-class ExpressionTest extends BaseTest {
-
-    @BeforeMethod
-    override def setup {
-        super.setup
-
-        QueryTestsUtils.setupTypes
-
-    }
-
-    @Test def testClass: Unit = {
-        val e = QueryProcessor.validate(_class("DB"))
-        println(e)
-    }
-
-    @Test def testFilter: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(id("name").`=`(string("Reporting"))))
-        println(e)
-    }
-
-    @Test def testSelect: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(id("name").`=`(string("Reporting"))).
-            select(id("name"), id("owner")))
-        println(e)
-    }
-
-    @Test def testNegTypeTest: Unit = {
-        try {
-            val e = QueryProcessor.validate(_class("DB").where(id("name")))
-            println(e)
-        } catch {
-            case e: ExpressionException if e.getMessage.endsWith("expression: DB where name") => ()
-        }
-    }
-
-    @Test def testIsTrait: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(isTrait("JdbcAccess")))
-        println(e)
-    }
-
-    @Test def testIsTraitNegative: Unit = {
-        try {
-            val e = QueryProcessor.validate(_class("DB").where(isTrait("Jdb")))
-            println(e)
-        } catch {
-            case e: ExpressionException if e.getMessage.endsWith("not a TraitType, expression:  is Jdb") => ()
-        }
-    }
-
-    @Test def testhasField: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(hasField("name")))
-        println(e)
-    }
-
-    @Test def testHasFieldNegative: Unit = {
-        try {
-            val e = QueryProcessor.validate(_class("DB").where(hasField("nam")))
-            println(e)
-        } catch {
-            case e: ExpressionException if e.getMessage.endsWith("not a TraitType, expression:  is Jdb") => ()
-        }
-    }
-
-    @Test def testFieldReference: Unit = {
-        val e = QueryProcessor.validate(_class("DB").field("Table"))
-        println(e)
-    }
-
-    @Test def testNegFieldReference: Unit = {
-        try {
-            val e = QueryProcessor.validate(_class("DB").where(_class("LoadProcess").hasField("name")))
-            println(e)
-        } catch {
-            case e: ExpressionException
-                if e.getMessage.endsWith("srcType of field doesn't match input type, expression: LoadProcess has name") => ()
-        }
-    }
-
-    @Test def testFieldReferenceRedundant: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(_class("DB").hasField("name")))
-        println(e)
-    }
-
-    @Test def testBackReference: Unit = {
-        val e = QueryProcessor.validate(
-            _class("DB").as("db1").field("Table").where(id("db1").field("name").`=`(string("Reporting"))))
-        println(e)
-    }
-
-    @Test def testArith: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(id("name").`=`(string("Reporting"))).
-            select(id("name"), id("createTime") + int(1)))
-        println(e)
-    }
-
-    @Test def testComparisonLogical: Unit = {
-        val e = QueryProcessor.validate(_class("DB").where(id("name").`=`(string("Reporting")).
-            and(id("createTime") + int(1) > int(0))))
-        println(e)
-    }
-
-    @Test def testJoinAndSelect1: Unit = {
-        val e = QueryProcessor.validate(
-            _class("DB").as("db1").field("Table").as("tab").where((id("db1").field("createTime") + int(1) > int(0))
-                .and(id("db1").field("name").`=`(string("Reporting")))).select(id("db1").field("name").as("dbName"),
-                    id("tab").field("name").as("tabName"))
-        )
-        println(e)
-    }
-
-    @Test def testJoinAndSelect2: Unit = {
-        val e = QueryProcessor.validate(
-            _class("DB").as("db1").field("Table").as("tab").where((id("db1").field("createTime") + int(1) > int(0))
-                .or(id("db1").field("name").`=`(string("Reporting"))))
-                .select(id("db1").field("name").as("dbName"), id("tab").field("name").as("tabName"))
-        )
-        println(e)
-    }
-
-    @Test def testJoinAndSelect3: Unit = {
-        val e = QueryProcessor.validate(
-            _class("DB").as("db1").field("Table").as("tab").where((id("db1").field("createTime") + int(1) > int(0))
-                .and(id("db1").field("name").`=`(string("Reporting")))
-                .or(id("db1").hasField("owner")))
-                .select(id("db1").field("name").as("dbName"), id("tab").field("name").as("tabName"))
-        )
-        println(e)
-    }
-
-    @Test def testJoinAndSelect4: Unit = {
-        val e = QueryProcessor.validate(
-            _class("DB") as "db1" join "Table" as "tab" where (
-                id("db1").field("createTime") + int(1) > int(0) and
-                    (id("db1") `.` "name" `=` string("Reporting")) or
-                    (id("db1") hasField "owner")
-                ) select(
-                id("db1") `.` "name" as "dbName", id("tab") `.` "name" as "tabName"
-                )
-        )
-        println(e)
-    }
-
-    @Test def testLineageAll: Unit = {
-        val e = QueryProcessor.validate(_class("Table").loop(id("LoadProcess").field("outputTable")))
-        println(e)
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala b/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
deleted file mode 100755
index a948d16..0000000
--- a/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
+++ /dev/null
@@ -1,1068 +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.apache.atlas.query
-
-import org.apache.atlas.repository.graphdb.AtlasGraph
-import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
-import org.apache.atlas.query.Expressions._
-import org.apache.atlas.repository.graph.{AtlasGraphProvider, GraphBackedMetadataRepository}
-import org.apache.atlas.typesystem.types.TypeSystem
-import org.testng.annotations._
-import org.apache.atlas.repository.graph.AtlasGraphProvider
-import org.apache.atlas.{DBSandboxer, TestUtils}
-import org.apache.atlas.graph.GraphSandboxUtil
-
-class GremlinTest extends BaseGremlinTest {
-
-  var g: AtlasGraph[_,_] = null
-  var gp: GraphPersistenceStrategies = null;
-
-  @BeforeMethod
-  def resetRequestContext() {
-    TestUtils.resetRequestContext()
-  }
-
-  @BeforeClass
-  def beforeAll() {
-     TypeSystem.getInstance().reset()
-     var repo = new GraphBackedMetadataRepository(null, new AtlasGraphProvider().get())
-     TestUtils.setupGraphProvider(repo)
-    //force graph to be initialized first
-    AtlasGraphProvider.getGraphInstance()
-    
-    //create types and indices up front.  Without this, some of the property keys (particularly __traitNames and __superTypes)
-    //get ended up created implicitly with some graph backends with the wrong multiplicity.  This also makes the queries
-    //we execute perform better :-)    
-    QueryTestsUtils.setupTypesAndIndices()    
-
-    gp = new DefaultGraphPersistenceStrategy(repo)
-    g = QueryTestsUtils.setupTestGraph(repo)
-  }
-
-  @AfterClass
-  def afterAll() {
-    AtlasGraphProvider.cleanup()
-  }
-
-
-  @Test def testClass {
-    val r = QueryProcessor.evaluate(_class("DB"), g, gp)
-    validateJson(r, """{
-                      |    "query": "DB",
-                      |    "dataType": {
-                      |        "superTypes": [
-                      |
-                      |        ],
-                      |        "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
-                      |        "typeName": "DB",
-                      |        "attributeDefinitions": [
-                      |            {
-                      |                "name": "name",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "owner",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "createTime",
-                      |                "dataTypeName": "int",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                 },
-                      |                "isComposite": false,
-                      |               "isUnique": false,
-                      |               "isIndexable": false,
-                      |               "reverseAttributeName": null
-                      |
-                      |            },
-                      |            {
-                      |                "name": "clusterName",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |               "isComposite": false,
-                      |               "isUnique": false,
-                      |               "isIndexable": false,
-                      |               "reverseAttributeName": null
-                      |            }
-                      |            ]
-                      |        },
-                      |        "rows": [
-                      |            {
-                      |                "$typeName$": "DB",
-                      |                "$id$": {
-                      |                    "$typeName$": "DB",
-                      |                    "version": 0
-                      |                },
-                      |                "owner": "John ETL",
-                      |                "name": "Sales",
-                      |                "createTime": 1000,
-                      |                "clusterName": "test"
-                      |            },
-                      |            {
-                      |                "$typeName$": "DB",
-                      |                "$id$": {
-                      |                    "$typeName$": "DB",
-                      |                    "version": 0
-                      |                },
-                      |                "owner": "Jane BI",
-                      |                "name": "Reporting",
-                      |                "createTime": 1500,
-                      |                "clusterName": "test"
-                      |            }
-                      |        ]
-                      |    }""".stripMargin)
-  }
-
-  @Test def testName {
-    val r = QueryProcessor.evaluate(_class("DB").field("name"), g, gp)
-    validateJson(r, "{\n  \"query\":\"DB.name\",\n  \"dataType\":\"string\",\n  \"rows\":[\n    \"Sales\",\n    \"Reporting\"\n  ]\n}")
-  }
-
-  @Test def testFilter {
-    var r = QueryProcessor.evaluate(_class("DB").where(id("name").`=`(string("Reporting"))), g, gp)
-    validateJson(r, """{
-                      |    "query": "DB where (name = \"Reporting\")",
-                      |    "dataType": {
-                      |        "superTypes": [],
-                      |        "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
-                      |        "typeName": "DB",
-                      |        "attributeDefinitions": [
-                      |            {
-                      |                "name": "name",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "owner",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "createTime",
-                      |                "dataTypeName": "int",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "clusterName",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |               "isComposite": false,
-                      |               "isUnique": false,
-                      |               "isIndexable": false,
-                      |               "reverseAttributeName": null
-                      |            }
-                      |        ]
-                      |    },
-                      |    "rows": [
-                      |        {
-                      |            "$typeName$": "DB",
-                      |            "$id$": {
-                      |                "$typeName$": "DB",
-                      |                "version": 0
-                      |            },
-                      |            "owner": "Jane BI",
-                      |            "name": "Reporting",
-                      |            "createTime": 1500,
-                      |            "clusterName": "test"
-                      |        }
-                      |    ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testFilter2 {
-    var r = QueryProcessor.evaluate(_class("DB").where(id("DB").field("name").`=`(string("Reporting"))), g, gp)
-    validateJson(r, """{
-                      |    "query": "DB where (name = \"Reporting\")",
-                      |    "dataType": {
-                      |        "superTypes": [],
-                      |        "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
-                      |        "typeName": "DB",
-                      |        "attributeDefinitions": [
-                      |            {
-                      |                "name": "name",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "owner",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "createTime",
-                      |                "dataTypeName": "int",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "clusterName",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |               "isComposite": false,
-                      |               "isUnique": false,
-                      |               "isIndexable": false,
-                      |               "reverseAttributeName": null
-                      |            }
-                      |        ]
-                      |    },
-                      |    "rows": [
-                      |        {
-                      |            "$typeName$": "DB",
-                      |            "$id$": {
-                      |                "$typeName$": "DB",
-                      |                "version": 0
-                      |            },
-                      |            "owner": "Jane BI",
-                      |            "name": "Reporting",
-                      |            "createTime": 1500,
-                      |            "clusterName": "test"
-                      |        }
-                      |    ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testSelect {
-    val r = QueryProcessor.evaluate(_class("DB").where(id("name").`=`(string("Reporting"))).
-      select(id("name"), id("owner")), g, gp)
-    validateJson(r, """{
-                      |    "query": "DB where (name = \"Reporting\") as _src1 select _src1.name as _src1.name, _src1.owner as _src1.owner",
-                      |    "dataType": {
-                      |        "typeName": "__tempQueryResultStruct1",
-                      |        "attributeDefinitions": [
-                      |            {
-                      |                "name": "_src1.name",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "_src1.owner",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            }
-                      |        ]
-                      |    },
-                      |    "rows": [
-                      |        {
-                      |            "$typeName$": "__tempQueryResultStruct1",
-                      |            "_src1.owner": "Jane BI",
-                      |            "_src1.name": "Reporting"
-                      |        }
-                      |    ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testIsTrait {
-    val r = QueryProcessor.evaluate(_class("Table").where(isTrait("Dimension")), g, gp)
-    validateJson(r, """{
-                      |  "query":"Table where Table is Dimension",
-                      |  "dataType":{
-                      |    "superTypes":[
-                      |
-                      |    ],
-                      |    "hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.ClassType",
-                      |    "typeName":"Table",
-                      |    "attributeDefinitions":[
-                      |      {
-                      |        "name":"name",
-                      |        "dataTypeName":"string",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"db",
-                      |        "dataTypeName":"DB",
-                      |        "multiplicity":{
-                      |          "lower":1,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"sd",
-                      |        "dataTypeName":"StorageDescriptor",
-                      |        "multiplicity":{
-                      |          "lower":1,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"created",
-                      |        "dataTypeName":"date",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      }
-                      |    ]
-                      |  },
-                      |  "rows":[
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"product_dim",
-                      |      "$traits$":{
-                      |        "Dimension":{
-                      |          "$typeName$":"Dimension"
-                      |        }
-                      |      }
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"time_dim",
-                      |      "$traits$":{
-                      |        "Dimension":{
-                      |          "$typeName$":"Dimension"
-                      |        }
-                      |      }
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"customer_dim",
-                      |      "$traits$":{
-                      |        "Dimension":{
-                      |          "$typeName$":"Dimension"
-                      |        }
-                      |      }
-                      |    }
-                      |  ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testhasField {
-    val r = QueryProcessor.evaluate(_class("DB").where(hasField("name")), g, gp)
-    validateJson(r, """{
-                      |  "query":"DB where DB has name",
-                      |  "dataType":{
-                      |    "superTypes":[
-                      |
-                      |    ],
-                      |    "hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.ClassType",
-                      |    "typeName":"DB",
-                      |    "attributeDefinitions":[
-                      |      {
-                      |        "name":"name",
-                      |        "dataTypeName":"string",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"owner",
-                      |        "dataTypeName":"string",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"createTime",
-                      |        "dataTypeName":"int",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"clusterName",
-                      |        "dataTypeName":"string",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      }
-                      |    ]
-                      |  },
-                      |  "rows":[
-                      |    {
-                      |      "$typeName$":"DB",
-                      |      "$id$":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "owner":"John ETL",
-                      |      "name":"Sales",
-                      |      "createTime":1000,
-                      |      "clusterName":"test"
-                      |    },
-                      |    {
-                      |      "$typeName$":"DB",
-                      |      "$id$":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "owner":"Jane BI",
-                      |      "name":"Reporting",
-                      |      "createTime":1500,
-                      |      "clusterName":"test"
-                      |    }
-                      |  ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testFieldReference {
-    val r = QueryProcessor.evaluate(_class("DB").field("Table"), g, gp)
-    validateJson(r, """{
-                      |  "query":"DB Table",
-                      |  "dataType":{
-                      |    "superTypes":[      ],
-                      |    "hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.ClassType",
-                      |    "typeName":"Table",
-                      |    "attributeDefinitions":[
-                      |      {
-                      |        "name":"name",
-                      |        "dataTypeName":"string",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"db",
-                      |        "dataTypeName":"DB",
-                      |        "multiplicity":{
-                      |          "lower":1,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"sd",
-                      |        "dataTypeName":"StorageDescriptor",
-                      |        "multiplicity":{
-                      |          "lower":1,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"created",
-                      |        "dataTypeName":"date",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      }
-                      |    ]
-                      |  },
-                      |  "rows":[
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"sales_fact"
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"product_dim",
-                      |      "$traits$":{
-                      |        "Dimension":{
-                      |          "$typeName$":"Dimension"
-                      |        }
-                      |      }
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"time_dim",
-                      |      "$traits$":{
-                      |        "Dimension":{
-                      |          "$typeName$":"Dimension"
-                      |        }
-                      |      }
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"customer_dim",
-                      |      "$traits$":{
-                      |        "Dimension":{
-                      |          "$typeName$":"Dimension"
-                      |        }
-                      |      }
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"sales_fact_daily_mv"
-                      |    },
-                      |    {
-                      |      "$typeName$":"Table",
-                      |      "$id$":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      },
-                      |      "created":"2014-12-11T02:35:58.440Z",
-                      |      "sd":{
-                      |        "$typeName$":"StorageDescriptor",
-                      |        "version":0
-                      |      },
-                      |      "db":{
-                      |        "$typeName$":"DB",
-                      |        "version":0
-                      |      },
-                      |      "name":"sales_fact_monthly_mv"
-                      |    }
-                      |  ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testBackReference {
-    val r = QueryProcessor.evaluate(
-      _class("DB").as("db").field("Table").where(id("db").field("name").`=`(string("Reporting"))), g, gp)
-    validateJson(r, null)
-  }
-
-  @Test def testArith {
-    val r = QueryProcessor.evaluate(_class("DB").where(id("name").`=`(string("Reporting"))).
-      select(id("name"), id("createTime") + int(1)), g, gp)
-    validateJson(r, "{\n  \"query\":\"DB where (name = \\\"Reporting\\\") as _src1 select _src1.name as _src1.name, (_src1.createTime + 1) as (_src1.createTime + 1)\",\n  \"dataType\":{\n    \"typeName\":\"__tempQueryResultStruct3\",\n    \"attributeDefinitions\":[\n      {\n        \"name\":\"_src1.name\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      },\n      {\n        \"name\":\"(_src1.createTime + 1)\",\n        \"dataTypeName\":\"int\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      }\n    ]\n  },\n  \"rows\":[\n    {\n      
 \"$typeName$\":\"__tempQueryResultStruct3\",\n      \"(_src1.createTime + 1)\":1501,\n      \"_src1.name\":\"Reporting\"\n    }\n  ]\n}")
-  }
-
-  @Test def testComparisonLogical {
-    val r = QueryProcessor.evaluate(_class("DB").where(id("name").`=`(string("Reporting")).
-      and(id("createTime") > int(0))), g, gp)
-    validateJson(r, """{
-                      |    "query": "DB where (name = \"Reporting\") and (createTime > 0)",
-                      |    "dataType": {
-                      |        "superTypes": [
-                      |
-                      |        ],
-                      |        "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
-                      |        "typeName": "DB",
-                      |        "attributeDefinitions": [
-                      |            {
-                      |                "name": "name",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "owner",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "createTime",
-                      |                "dataTypeName": "int",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |                "isComposite": false,
-                      |                "isUnique": false,
-                      |                "isIndexable": false,
-                      |                "reverseAttributeName": null
-                      |            },
-                      |            {
-                      |                "name": "clusterName",
-                      |                "dataTypeName": "string",
-                      |                "multiplicity": {
-                      |                    "lower": 0,
-                      |                    "upper": 1,
-                      |                    "isUnique": false
-                      |                },
-                      |               "isComposite": false,
-                      |               "isUnique": false,
-                      |               "isIndexable": false,
-                      |               "reverseAttributeName": null
-                      |            }
-                      |        ]
-                      |    },
-                      |    "rows": [
-                      |        {
-                      |            "$typeName$": "DB",
-                      |            "$id$": {
-                      |                "$typeName$": "DB",
-                      |                "version": 0
-                      |            },
-                      |            "owner": "Jane BI",
-                      |            "name": "Reporting",
-                      |            "createTime": 1500,
-                      |            "clusterName": "test"
-                      |        }
-                      |    ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testJoinAndSelect1 {
-    val r = QueryProcessor.evaluate(
-      _class("DB").as("db1").where(id("name").`=`(string("Sales"))).field("Table").as("tab").
-        where(isTrait("Dimension")).
-        select(id("db1").field("name").as("dbName"), id("tab").field("name").as("tabName")), g, gp
-    )
-    validateJson(r, "{\n  \"query\":\"DB as db1 where (name = \\\"Sales\\\") Table as tab where DB as db1 where (name = \\\"Sales\\\") Table as tab is Dimension as _src1 select db1.name as dbName, tab.name as tabName\",\n  \"dataType\":{\n    \"typeName\":\"__tempQueryResultStruct5\",\n    \"attributeDefinitions\":[\n      {\n        \"name\":\"dbName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      },\n      {\n        \"name\":\"tabName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      }\n    
 ]\n  },\n  \"rows\":[\n    {\n      \"$typeName$\":\"__tempQueryResultStruct5\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"product_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct5\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"time_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct5\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"customer_dim\"\n    }\n  ]\n}")
-  }
-
-  @Test def testJoinAndSelect2 {
-    val r = QueryProcessor.evaluate(
-      _class("DB").as("db1").where((id("db1").field("createTime") > int(0))
-        .or(id("name").`=`(string("Reporting")))).field("Table").as("tab")
-        .select(id("db1").field("name").as("dbName"), id("tab").field("name").as("tabName")), g, gp
-    )
-    validateJson(r, "{\n  \"query\":\"DB as db1 where (createTime > 0) or (name = \\\"Reporting\\\") Table as tab select db1.name as dbName, tab.name as tabName\",\n  \"dataType\":{\n    \"typeName\":\"__tempQueryResultStruct6\",\n    \"attributeDefinitions\":[\n      {\n        \"name\":\"dbName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      },\n      {\n        \"name\":\"tabName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      }\n    ]\n  },\n  \"rows\":[\n    {\n      \"$typeName$\":\"__t
 empQueryResultStruct6\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"sales_fact\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct6\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"product_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct6\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"time_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct6\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"customer_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct6\",\n      \"dbName\":\"Reporting\",\n      \"tabName\":\"sales_fact_daily_mv\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct6\",\n      \"dbName\":\"Reporting\",\n      \"tabName\":\"sales_fact_monthly_mv\"\n    }\n  ]\n}")
-  }
-
-  @Test def testJoinAndSelect3 {
-    val r = QueryProcessor.evaluate(
-      _class("DB").as("db1").where((id("db1").field("createTime") > int(0))
-        .and(id("db1").field("name").`=`(string("Reporting")))
-        .or(id("db1").hasField("owner"))).field("Table").as("tab")
-        .select(id("db1").field("name").as("dbName"), id("tab").field("name").as("tabName")), g, gp
-    )
-    validateJson(r, "{\n  \"query\":\"DB as db1 where (createTime > 0) and (name = \\\"Reporting\\\") or db1 has owner Table as tab select db1.name as dbName, tab.name as tabName\",\n  \"dataType\":{\n    \"typeName\":\"__tempQueryResultStruct7\",\n    \"attributeDefinitions\":[\n      {\n        \"name\":\"dbName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      },\n      {\n        \"name\":\"tabName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      }\n    ]\n  },\n  \"rows\":[\n    {\n      \"
 $typeName$\":\"__tempQueryResultStruct7\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"sales_fact\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct7\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"product_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct7\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"time_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct7\",\n      \"dbName\":\"Sales\",\n      \"tabName\":\"customer_dim\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct7\",\n      \"dbName\":\"Reporting\",\n      \"tabName\":\"sales_fact_daily_mv\"\n    },\n    {\n      \"$typeName$\":\"__tempQueryResultStruct7\",\n      \"dbName\":\"Reporting\",\n      \"tabName\":\"sales_fact_monthly_mv\"\n    }\n  ]\n}")
-  }
-
-  @Test def testJoinAndSelect4 {
-    val r = QueryProcessor.evaluate(
-      _class("DB").as("db1").where(id("name").`=`(string("Sales"))).field("Table").as("tab").
-        where(isTrait("Dimension")).
-        select(id("db1").as("dbO"), id("tab").field("name").as("tabName")), g, gp
-    )
-    validateJson(r, "{\n  \"query\":\"DB as db1 where (name = \\\"Sales\\\") Table as tab where DB as db1 where (name = \\\"Sales\\\") Table as tab is Dimension as _src1 select db1 as dbO, tab.name as tabName\",\n  \"dataType\":{\n    \"typeName\":\"\",\n    \"attributeDefinitions\":[\n      {\n        \"name\":\"dbO\",\n        \"dataTypeName\":\"DB\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      },\n      {\n        \"name\":\"tabName\",\n        \"dataTypeName\":\"string\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":false,\n        \"reverseAttributeName\":null\n      }\n    ]\n  },\n  \"rows\":[\n    {\n      \"$
 typeName$\":\"\",\n      \"dbO\":{\n        \"$typeName$\":\"DB\",\n        \"version\":0\n      },\n      \"tabName\":\"product_dim\"\n    },\n    {\n      \"$typeName$\":\"\",\n      \"dbO\":{\n        \"$typeName$\":\"DB\",\n        \"version\":0\n      },\n      \"tabName\":\"time_dim\"\n    },\n    {\n      \"$typeName$\":\"\",\n      \"dbO\":{\n        \"$typeName$\":\"DB\",\n        \"version\":0\n      },\n      \"tabName\":\"customer_dim\"\n    }\n  ]\n}")
-  }
-
-  @Test def testArrayComparision {
-    val p = QueryParser
-    val e = p("Partition as p where values = ['2015-01-01']," +
-      " table where name = 'sales_fact_daily_mv'," +
-      " db where name = 'Reporting' and clusterName = 'test' select p").right.get
-    val r = QueryProcessor.evaluate(e, g, gp)
-    validateJson(r, """{
-                      |  "query":"Partition as p where (values = [\"2015-01-01\"]) table where (name = \"sales_fact_daily_mv\") db where (name = \"Reporting\") and (clusterName = \"test\") as _src1 select p as p",
-                      |  "dataType":{
-                      |    "typeName":"__tempQueryResultStruct2",
-                      |    "attributeDefinitions":[
-                      |      {
-                      |        "name":"p",
-                      |        "dataTypeName":"Partition",
-                      |        "multiplicity":{
-                      |          "lower":0,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      }
-                      |    ]
-                      |  },
-                      |  "rows":[
-                      |    {
-                      |      "$typeName$":"__tempQueryResultStruct2",
-                      |      "p":{
-                      |        "$typeName$":"Partition",
-                      |        "version":0
-                      |      }
-                      |    }
-                      |  ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testArrayComparisionWithSelectOnArray {
-    val p = QueryParser
-    val e = p("Partition as p where values = ['2015-01-01']," +
-      " table where name = 'sales_fact_daily_mv'," +
-      " db where name = 'Reporting' and clusterName = 'test' select p.values").right.get
-    val r = QueryProcessor.evaluate(e, g, gp)
-    validateJson(r,
-      """{
-        |  "query":"Partition as p where (values = [\"2015-01-01\"]) table where (name = \"sales_fact_daily_mv\") db where (name = \"Reporting\") and (clusterName = \"test\") as _src1 select p.values as p.values",
-        |  "dataType":{
-        |    "typeName":"__tempQueryResultStruct2",
-        |    "attributeDefinitions":[
-        |  {
-        |    "name":"p.values",
-        |    "dataTypeName":"array<string>",
-        |    "multiplicity":{
-        |    "lower":0,
-        |    "upper":1,
-        |    "isUnique":false
-        |  },
-        |    "isComposite":false,
-        |    "isUnique":false,
-        |    "isIndexable":false,
-        |    "reverseAttributeName":null
-        |  }
-        |    ]
-        |  },
-        |  "rows":[
-        |  {
-        |    "$typeName$":"__tempQueryResultStruct2",
-        |    "p.values":[
-        |    "2015-01-01"
-        |    ]
-        |  }
-        |  ]
-        |}
-      """.stripMargin)
-  }
-
-  @Test def testArrayInWhereClause {
-    val p = QueryParser
-    val e = p("Partition as p where values = ['2015-01-01']").right.get
-    val r = QueryProcessor.evaluate(e, g, gp)
-    validateJson(r, """{
-                      |  "query":"Partition as p where (values = [\"2015-01-01\"])",
-                      |  "dataType":{
-                      |    "superTypes":[
-                      |
-                      |    ],
-                      |    "hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.ClassType",
-                      |    "typeName":"Partition",
-                      |    "attributeDefinitions":[
-                      |      {
-                      |        "name":"values",
-                      |        "dataTypeName":"array<string>",
-                      |        "multiplicity":{
-                      |          "lower":1,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      },
-                      |      {
-                      |        "name":"table",
-                      |        "dataTypeName":"Table",
-                      |        "multiplicity":{
-                      |          "lower":1,
-                      |          "upper":1,
-                      |          "isUnique":false
-                      |        },
-                      |        "isComposite":false,
-                      |        "isUnique":false,
-                      |        "isIndexable":false,
-                      |        "reverseAttributeName":null
-                      |      }
-                      |    ]
-                      |  },
-                      |  "rows":[
-                      |    {
-                      |      "$typeName$":"Partition",
-                      |      "$id$":{
-                      |        "$typeName$":"Partition",
-                      |        "version":0
-                      |      },
-                      |      "values":[
-                      |        "2015-01-01"
-                      |      ],
-                      |      "table":{
-                      |        "$typeName$":"Table",
-                      |        "version":0
-                      |      }
-                      |    }
-                      |  ]
-                      |}""".stripMargin)
-  }
-
-  @Test def testArrayWithStruct {
-//    val p = new QueryParser
-//    val e = p("from LoadProcess select inputTables").right.get
-//    val r = QueryProcessor.evaluate(e, g)
-    val r = QueryProcessor.evaluate(_class("LoadProcess").field("inputTables"), g, gp)
-    validateJson(r)
-  }
-
-  @Test(expectedExceptions =  Array(classOf[ExpressionException]))
-  def testNegativeInvalidType {
-    val p = QueryParser
-    val e = p("from blah").right.get
-    QueryProcessor.evaluate(e, g, gp)
-  }
-
-  @Test def testJoinAndSelect5 {
-    val p = QueryParser
-    val e = p("Table as t where name = 'sales_fact' db where name = 'Sales' and owner = 'John ETL' select t").right.get
-    val r = QueryProcessor.evaluate(e, g, gp)
-    validateJson(r)
-  }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala b/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
deleted file mode 100755
index 880a0c6..0000000
--- a/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
+++ /dev/null
@@ -1,154 +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.apache.atlas.query
-
-import org.apache.atlas.{DBSandboxer, TestUtils}
-import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
-import org.apache.atlas.query.Expressions._class
-import org.apache.atlas.query.Expressions._trait
-import org.apache.atlas.query.Expressions.id
-import org.apache.atlas.repository.graph.GraphBackedMetadataRepository
-import org.apache.atlas.repository.graphdb.AtlasGraph
-import org.apache.atlas.typesystem.types.TypeSystem
-import org.testng.annotations._
-import org.apache.atlas.repository.graph.AtlasGraphProvider
-
-class GremlinTest2 extends BaseGremlinTest {
-
-  var g: AtlasGraph[_,_] = null
-  var gp:GraphPersistenceStrategies = null;
-
-  @BeforeMethod
-  def resetRequestContext() {
-       TestUtils.resetRequestContext();
-  }
-  
-  @BeforeClass
-  def beforeAll() {
-    TypeSystem.getInstance().reset()
-    QueryTestsUtils.setupTypes
-    var repo = new GraphBackedMetadataRepository(null, null);
-    gp = new DefaultGraphPersistenceStrategy(repo)
-    g = QueryTestsUtils.setupTestGraph(repo)
-  }
-
-  @AfterClass
-  def afterAll() {     
-    AtlasGraphProvider.cleanup();
-  }
-
-  @Test def testTraitSelect {
-    val r = QueryProcessor.evaluate(_class("Table").as("t").join("Dimension").as("dim").select(id("t"), id("dim")), g)
-    validateJson(r, "{\n  \"query\":\"Table as t.Dimension as dim select t as _col_0, dim as _col_1\",\n  \"dataType\":{\n    \"typeName\":\"\",\n    \"attributeDefinitions\":[\n      {\n        \"name\":\"_col_0\",\n        \"dataTypeName\":\"Table\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":true,\n        \"reverseAttributeName\":null\n      },\n      {\n        \"name\":\"_col_1\",\n        \"dataTypeName\":\"Dimension\",\n        \"multiplicity\":{\n          \"lower\":0,\n          \"upper\":1,\n          \"isUnique\":false\n        },\n        \"isComposite\":false,\n        \"isUnique\":false,\n        \"isIndexable\":true,\n        \"reverseAttributeName\":null\n      }\n    ]\n  },\n  \"rows\":[\n    {\n      \"$typeName$\":\"\",\n      \"_col_1\":{\n        \"$typeName$\":\"Dimension\"\n      },\n      \"_col_0\"
 :{\n        \"id\":\"3328\",\n        \"$typeName$\":\"Table\",\n        \"version\":0\n      }\n    },\n    {\n      \"$typeName$\":\"\",\n      \"_col_1\":{\n        \"$typeName$\":\"Dimension\"\n      },\n      \"_col_0\":{\n        \"id\":\"4864\",\n        \"$typeName$\":\"Table\",\n        \"version\":0\n      }\n    },\n    {\n      \"$typeName$\":\"\",\n      \"_col_1\":{\n        \"$typeName$\":\"Dimension\"\n      },\n      \"_col_0\":{\n        \"id\":\"6656\",\n        \"$typeName$\":\"Table\",\n        \"version\":0\n      }\n    }\n  ]\n}")
-  }
-
-  @Test def testTrait {
-    val r = QueryProcessor.evaluate(_trait("Dimension"), g)
-    validateJson(r)
-  }
-
-  @Test def testTraitInstance {
-    val r = QueryProcessor.evaluate(_trait("Dimension").traitInstance(), g)
-    validateJson(r)
-  }
-
-  @Test def testInstanceAddedToFilter {
-    val r = QueryProcessor.evaluate(_trait("Dimension").hasField("typeName"), g)
-    validateJson(r)
-  }
-
-  @Test def testInstanceFilter {
-    val r = QueryProcessor.evaluate(_trait("Dimension").traitInstance().hasField("name"), g)
-    validateJson(r)
-  }
-
-  @Test def testLineageWithPath {
-    val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable")).path(), g)
-    validateJson(r)
-  }
-
-  @Test def testLineageAllSelectWithPath {
-    val r = QueryProcessor.evaluate(_class("Table").as("src").loop(id("LoadProcess").field("outputTable")).as("dest").
-      select(id("src").field("name").as("srcTable"), id("dest").field("name").as("destTable")).path(), g)
-    validateJson(r)
-  }
-
-  @Test def testLineageAllSelectWithPathFromParser {
-    val p = QueryParser
-    val e = p("Table as src loop (LoadProcess outputTable) as dest " +
-      "select src.name as srcTable, dest.name as destTable withPath").right.get
-    //Table as src loop (LoadProcess where LoadProcess.outputTable) as dest select src.name as srcTable, dest.name as destTable withPath
-    val r = QueryProcessor.evaluate(e, g)
-    validateJson(r)
-  }
-
-  @Test def testLineageAllSelectWithPathFromParser2 {
-    val p = QueryParser
-
-    val e = p("Table as src loop (`LoadProcess->outputTable` inputTables) as dest " +
-      "select src.name as srcTable, dest.name as destTable withPath").right.get
-    val r = QueryProcessor.evaluate(e, g)
-    validateJson(r)
-  }
-
-  @Test def testHighLevelLineage {
-        val r = InputLineageClosureQuery("Table", "name", "sales_fact_monthly_mv",
-          "LoadProcess",
-          "inputTables",
-          "outputTable",
-        None, Some(List("name")), true, getPersistenceStrategy(g), g).evaluate()
-    validateJson(r)
-  }
-
-  @Test def testHighLevelLineageReturnGraph {
-    val q = InputLineageClosureQuery("Table", "name", "sales_fact_monthly_mv",
-      "LoadProcess",
-      "inputTables",
-      "outputTable",
-      None, Some(List("name")), true, getPersistenceStrategy(g), g);
-    val gr = q.evaluate();
-    val r = q.graph(gr);
-
-    println(r.toInstanceJson)
-    //validateJson(r)
-  }
-
-  @Test def testHighLevelWhereUsed {
-    val r = OutputLineageClosureQuery("Table", "name", "sales_fact",
-      "LoadProcess",
-      "inputTables",
-      "outputTable",
-      None, Some(List("name")), true, getPersistenceStrategy(g), g).evaluate()
-    validateJson(r)
-  }
-
-  @Test def testHighLevelWhereUsedReturnGraph {
-    val q = OutputLineageClosureQuery("Table", "name", "sales_fact",
-      "LoadProcess",
-      "inputTables",
-      "outputTable",
-      None, Some(List("name")), true, getPersistenceStrategy(g), g)
-    val gr = q.evaluate();
-    val r = q.graph(gr);
-    println(r.toInstanceJson)
-  }
-  
-  private def getPersistenceStrategy(g: AtlasGraph[_,_]) : GraphPersistenceStrategies = return GraphPersistenceStrategy1(g)
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/repository/src/test/scala/org/apache/atlas/query/HiveTitanSample.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/HiveTitanSample.scala b/repository/src/test/scala/org/apache/atlas/query/HiveTitanSample.scala
deleted file mode 100644
index fa0d341..0000000
--- a/repository/src/test/scala/org/apache/atlas/query/HiveTitanSample.scala
+++ /dev/null
@@ -1,243 +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.apache.atlas.query
-
-import scala.collection.JavaConversions._
-
-
-import org.apache.atlas.typesystem.ITypedReferenceableInstance
-import org.apache.atlas.typesystem.json.TypedReferenceableInstanceSerializer
-import org.apache.atlas.utils.HiveModel.Column
-import org.apache.atlas.utils.HiveModel.DB
-import org.apache.atlas.utils.HiveModel.HiveOrder
-import org.apache.atlas.utils.HiveModel.LoadProcess
-import org.apache.atlas.utils.HiveModel.Partition
-import org.apache.atlas.utils.HiveModel.StorageDescriptor
-import org.apache.atlas.utils.HiveModel.Table
-import org.apache.atlas.utils.HiveModel.View
-import scala.collection.mutable.Buffer
-
-
-
-object HiveTitanSample {
-       
-    val MetricTrait = "Metric"
-    val DimensionTrait = "Dimension"
-    val ETLTrait = "ETL"
-    val JdbcAccessTrait = "JdbcAccess"
-    
-    val salesDB = new DB("Sales", "John ETL", 1000, "test")
-
-    
-    
-    val salesFact = new Table("sales_fact",
-        salesDB,
-        new StorageDescriptor("TextInputFormat",
-            "TextOutputFormat", List(new HiveOrder("customer_id", 0))),
-            List(
-                new Column("time_id", "int"),
-                new Column("product_id", "int"),
-                new Column("customer_id", "int"),
-                new Column("created", "date"),
-                new Column("sales", "double").withTrait(MetricTrait)
-                )
-        );
-    
-    
-    val productDim = new Table("product_dim",
-        salesDB,
-        new StorageDescriptor("TextInputFormat",
-            "TextOutputFormat", List(new HiveOrder("product_id", 0))),
-        List(
-            new Column("product_id", "int"),
-            new Column("product_name", "string"),
-            new Column("brand_name", "string")
-        )
-    ).withTrait(DimensionTrait)
-
-    val timeDim = new Table("time_dim",
-        salesDB,
-        new StorageDescriptor("TextInputFormat",
-            "TextOutputFormat", List(new HiveOrder("time_id", 0))),
-        List(
-             new Column("time_id", "int"),
-             new Column("dayOfYear", "int"),
-             new Column("weekDay", "string")
-        )
-    ).withTrait(DimensionTrait)
-        
-    val customerDim = new Table("customer_dim",
-        salesDB,
-        new StorageDescriptor("TextInputFormat",
-            "TextOutputFormat", List(new HiveOrder("customer_id", 0))),
-        List(
-             new Column("customer_id", "int"),
-             new Column("name", "int"),
-             new Column("address", "string").withTrait("PII")
-        )
-    ).withTrait(DimensionTrait)
-
-
-    val reportingDB = new DB("Reporting", "Jane BI", 1500, "test")
-    val salesFactDaily = new Table("sales_fact_daily_mv",
-        reportingDB,
-        new StorageDescriptor("TextInputFormat",
-            "TextOutputFormat", List(new HiveOrder("customer_id", 0))),
-        List(
-             new Column("time_id", "int"),
-             new Column("product_id", "int"),
-             new Column("customer_id", "int"),
-             new Column("sales", "double").withTrait(MetricTrait)
-        )
-    )
-    
-    val loadSalesFactDaily = new LoadProcess(
-            "loadSalesDaily",
-            List(salesFact, timeDim), 
-            salesFactDaily
-    ).withTrait(ETLTrait)
-        
-
-
-    val productDimView = new View(
-        "product_dim_view", 
-        reportingDB,
-        List(productDim)
-    ).withTraits(List(DimensionTrait, JdbcAccessTrait))
-
-    val customerDimView = new View(
-        "customer_dim_view", 
-        reportingDB,
-        List(customerDim)
-        
-    ).withTraits(List(DimensionTrait, JdbcAccessTrait))
-
-    val salesFactMonthly = new Table("sales_fact_monthly_mv",
-        reportingDB,
-        new StorageDescriptor(
-                "TextInputFormat",
-                "TextOutputFormat", 
-                List(new HiveOrder("customer_id", 0))
-        ),
-        List(
-             new Column("time_id", "int"),
-             new Column("product_id", "int"),
-             new Column("customer_id", "int"),
-             new Column("sales", "double").withTrait(MetricTrait)
-        )
-    )
-    val loadSalesFactMonthly = new LoadProcess("loadSalesMonthly",
-        List(salesFactDaily), salesFactMonthly).withTraits(List(ETLTrait))
-
-    val salesDailyPartition = new Partition(List("2015-01-01"), salesFactDaily)
-   
-    import scala.collection.JavaConversions._
-   
-   def getEntitiesToCreate() : Buffer[ITypedReferenceableInstance] = {
-       var list = salesDB.getTypedReferencebles() ++
-          salesFact.getTypedReferencebles() ++
-          productDim.getTypedReferencebles() ++
-          timeDim.getTypedReferencebles() ++
-          customerDim.getTypedReferencebles() ++
-          reportingDB.getTypedReferencebles() ++
-          salesFactDaily.getTypedReferencebles() ++
-          loadSalesFactDaily.getTypedReferencebles() ++
-          productDimView.getTypedReferencebles() ++
-          customerDimView.getTypedReferencebles() ++
-          salesFactMonthly.getTypedReferencebles() ++
-          loadSalesFactMonthly.getTypedReferencebles() ++
-          salesDailyPartition.getTypedReferencebles();
-       return list;
-       
-   }
-
-   
-
-    val GremlinQueries = List(
-        // 1. List all DBs
-        """g.V.has("typeName", "DB")""",
-
-        // 2. List all DB nmes
-        """g.V.has("typeName", "DB").name""",
-
-        // 3. List all Tables in Reporting DB
-        """g.V.has("typeName", "DB").has("name", "Reporting").inE("Table.db").outV""",
-        """g.V.has("typeName", "DB").as("db").inE("Table.db").outV.and(_().back("db").has("name", "Reporting"))""",
-
-        // 4. List all Tables in Reporting DB, list as D.name, Tbl.name
-        """
-    g.V.has("typeName", "DB").has("name", "Reporting").as("db").inE("Table.db").outV.as("tbl").select{it.name}{it.name}
-        """.stripMargin,
-
-        // 5. List all tables that are Dimensions and have the TextInputFormat
-        """
-    g.V.as("v").and(_().outE("Table.Dimension"), _().out("Table.sd").has("inputFormat", "TextInputFormat")).name
-        """.stripMargin,
-
-        // 6. List all tables that are Dimensions or have the TextInputFormat
-        """
-    g.V.as("v").or(_().outE("Table.Dimension"), _().out("Table.sd").has("inputFormat", "TextInputFormat")).name
-        """.stripMargin,
-
-        // 7. List tables that have at least 1 PII column
-        """
-    g.V.has("typeName", "Table").as("tab").out("Table.sd").in("Column.sd").as("column"). \
-      out("Column.PII").select.groupBy{it.getColumn("tab")}{it.getColumn("column")}{[ "c" : it.size]}.cap.scatter.filter{it.value.c > 0}. \
-      transform{it.key}.name  """.stripMargin
-
-        // 7.a from Table as tab -> g.V.has("typeName", "Table").as("tab")
-        // 7.b sd.Column as column -> out("Table.sd").in("Column.sd").as("column")
-        // 7.c is PII -> out("Column.PII")
-        // 7.d select tab, column -> select{it}{it}
-        // 7.e groupBy tab compute count(column) as c
-        // 7.f where c > 0
-
-        // 7.a Alias(Type("Table"), "tab")
-        // 7b. Field("sd", Alias(Type("Table"), "tab"))
-        //     Alias(Field("Column", Field("sd", Alias(Type("Table"), "tab"))), "column")
-        // 7.c Filter(is("PII"), Alias(Field("Column", Field("sd", Alias(Type("Table"), "tab"))), "column"))
-        // 7.d
-    )
-}
-
-//object TestApp extends App with GraphUtils {
-//
-//    val g: TitanGraph = TitanGraphProvider.getGraphInstance
-//    val manager: ScriptEngineManager = new ScriptEngineManager
-//    val engine: ScriptEngine = manager.getEngineByName("gremlin-groovy")
-//    val bindings: Bindings = engine.createBindings
-//    bindings.put("g", g)
-//
-//    val hiveGraphFile = FileUtils.getTempDirectory().getPath + File.separator + System.nanoTime() + ".gson"
-//    HiveTitanSample.writeGson(hiveGraphFile)
-//    bindings.put("hiveGraphFile", hiveGraphFile)
-//
-//    try {
-//        engine.eval("g.loadGraphSON(hiveGraphFile)", bindings)
-//
-//        println(engine.eval("g.V.typeName.toList()", bindings))
-//
-//        HiveTitanSample.GremlinQueries.foreach { q =>
-//            println(q)
-//            println("Result: " + engine.eval(q + ".toList()", bindings))
-//        }
-//    } finally {
-//        g.shutdown()
-//    }
-//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/repository/src/test/scala/org/apache/atlas/query/LexerTest.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/LexerTest.scala b/repository/src/test/scala/org/apache/atlas/query/LexerTest.scala
deleted file mode 100755
index 10237a9..0000000
--- a/repository/src/test/scala/org/apache/atlas/query/LexerTest.scala
+++ /dev/null
@@ -1,49 +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.apache.atlas.query
-
-import org.apache.atlas.DBSandboxer
-import org.testng.Assert
-import org.testng.annotations.{Listeners, Test}
-
-import scala.util.parsing.input.CharArrayReader
-
-class LexerTest {
-
-    def scan(str: String): QueryParser.lexical.ParseResult[_] = {
-        val l = QueryParser.lexical
-        var s: l.Input = new CharArrayReader(str.toCharArray)
-        var r = (l.whitespace.? ~ l.token)(s)
-        s = r.next
-
-        while (r.successful && !s.atEnd) {
-            s = r.next
-            if (!s.atEnd) {
-                r = (l.whitespace.? ~ l.token)(s)
-            }
-        }
-        r.asInstanceOf[QueryParser.lexical.ParseResult[_]]
-    }
-
-    @Test def testSimple {
-        val r = scan("""DB where db1.name""")
-        Assert.assertTrue(r.successful)
-
-    }
-}