atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [44/50] [abbrv] incubator-atlas git commit: ATLAS-1098 Atlas allows creation of tag with name isa which causes exceptions during search (apoorvnaik via shwethags)
Date Fri, 23 Dec 2016 01:47:13 GMT
ATLAS-1098 Atlas allows creation of tag with name isa which causes exceptions during search
(apoorvnaik via shwethags)

(cherry picked from commit c1081a49da3553f55b33edecb416de99c90d10b4)


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

Branch: refs/heads/0.7-incubating
Commit: f0e58eda035a5f9b80e7447e84a592a17f1659df
Parents: a8307be
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Mon Sep 19 11:13:08 2016 +0530
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Thu Dec 22 15:33:43 2016 -0800

----------------------------------------------------------------------
 pom.xml                                         |  2 +-
 release-log.txt                                 |  1 +
 .../atlas/services/DefaultMetadataService.java  | 52 --------------------
 .../org/apache/atlas/query/QueryParser.scala    | 12 +++--
 .../org/apache/atlas/BaseRepositoryTest.java    |  5 +-
 .../GraphBackedDiscoveryServiceTest.java        |  3 ++
 6 files changed, 16 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f0e58eda/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e46d7e0..df4d6d2 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1782,7 +1782,7 @@
                         <exclude>**/users-credentials.properties</exclude>
                         <exclude>**/public/css/animate.min.css</exclude>
                         <exclude>**/public/css/bootstrap-sidebar.css</exclude>
-                        <exclude>**/public/js/require-handlebars-plugin/**</exclude>
+                        <exclude>**/public/js/external_lib/**</exclude>
                         <exclude>**/node_modules/**</exclude>
                         <!-- All the npm plugins are copied here, so exclude it -->
                         <exclude>**/public/js/libs/**</exclude>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f0e58eda/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 0419f19..079ced4 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -30,6 +30,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file
(dosset
 ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via
shwethags)
 
 ALL CHANGES:
+ATLAS-1098 Atlas allows creation of tag with name "isa" which causes exceptions during search
(apoorvnaik via shwethags)
 ATLAS-1142 Lineage UI Improvement (kevalbhatt via shwethags)
 ATLAS-712 Support getTrait() API (svimal2106 via shwethags)
 ATLAS-1173 Doc: Minor editorial bug in the example given for property atlas.server.ha.zookeeper.auth
(yhemanth via shwethags)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f0e58eda/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
index fdb749a..3550492 100755
--- a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
+++ b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
@@ -241,9 +241,6 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang
         typeDefinition = ParamChecker.notEmpty(typeDefinition, "type definition");
         TypesDef typesDef = validateTypeDefinition(typeDefinition);
 
-        // Also validate if the types being created are not keywords
-        validateIfNotKeyword(typesDef);
-
         try {
             final TypeSystem.TransientTypeSystem transientTypeSystem = typeSystem.createTransientTypeSystem(typesDef,
isUpdate);
             final Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded();
@@ -289,55 +286,6 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang
         }
     }
 
-    private void validateIfNotKeyword(TypesDef typesDef) throws AtlasException {
-        List<EnumTypeDefinition> enumDefs = typesDef.enumTypesAsJavaList();
-        List<StructTypeDefinition> structDefs = typesDef.structTypesAsJavaList();
-        List<HierarchicalTypeDefinition<ClassType>> classDefs = typesDef.classTypesAsJavaList();
-        List<HierarchicalTypeDefinition<TraitType>> traitDefs = typesDef.traitTypesAsJavaList();
-
-        // QueryParser has it's own set of keywords that should be avoided
-        Set<String> keywords = QueryParser.keywordCache().keySet();
-        boolean keywordCacheNotEmpty = null != keywords && !keywords.isEmpty();
-
-        if (keywordCacheNotEmpty) {
-            if (CollectionUtils.isNotEmpty(enumDefs)) {
-                // Check if any enum name is a keyword
-                for (EnumTypeDefinition enumDef : enumDefs) {
-                    if (keywords.contains(enumDef.name)) {
-                        throw new AtlasException("Enum definition name \"" + enumDef.name
+ "\" is a keyword");
-                    }
-                }
-            }
-
-            if (CollectionUtils.isNotEmpty(classDefs)){
-                // Check if any class name is a keyword
-                for (HierarchicalTypeDefinition<ClassType> classDef : classDefs) {
-                    if (keywords.contains(classDef.typeName)) {
-                        throw new AtlasException("Class definition name \"" + classDef.typeName
+ "\" is a keyword");
-                    }
-                }
-            }
-
-            if (CollectionUtils.isNotEmpty(structDefs)){
-                // Check if any struct name is a keyword
-                for (StructTypeDefinition structDef : structDefs) {
-                    if (keywords.contains(structDef.typeName)) {
-                        throw new AtlasException("StructType definition name \"" + structDef.typeName
+ "\" is a keyword");
-                    }
-                }
-            }
-
-            if (CollectionUtils.isNotEmpty(traitDefs)){
-                // Check if any trait name is a keyword
-                for (HierarchicalTypeDefinition<TraitType> traitDef : traitDefs) {
-                    if (keywords.contains(traitDef.typeName)) {
-                        throw new AtlasException("TraitType definition name \"" + traitDef.typeName
+ "\" is a keyword");
-                    }
-                }
-            }
-        }
-    }
-
     /**
      * Return the definition for the given type.
      *

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f0e58eda/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
----------------------------------------------------------------------
diff --git a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
index 4d2429e..7074d74 100755
--- a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
+++ b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
@@ -387,6 +387,7 @@ class QueryLexer(val keywords: Seq[String], val delims: Seq[String]) extends
Std
                 | floatConstant ^^ FloatLiteral
                 | dubConstant ^^ DoubleLiteral
                 | identifier ^^ processIdent
+                | quotedIdentifier ^^ Identifier
                 | string ^^ StringLit
                 | EofCh ^^^ EOF
                 | '\'' ~> failure("unclosed string literal")
@@ -398,10 +399,11 @@ class QueryLexer(val keywords: Seq[String], val delims: Seq[String])
extends Std
 
     override def identChar = letter | elem('_')
 
-    def identifier = identChar ~ (identChar | digit).* ^^ { case first ~ rest => (first
:: rest).mkString} |
-        '`' ~> chrExcept('`', '\n', EofCh).* <~ '`' ^^ {
-            _ mkString ""
-        }
+    def identifier = identChar ~ (identChar | digit).* ^^ { case first ~ rest => (first
:: rest).mkString}
+
+    def quotedIdentifier = '`' ~> chrExcept('`', '\n', EofCh).* <~ '`' ^^ {
+      _ mkString ""
+    }
 
     override def whitespace: Parser[Any] =
         (whitespaceChar
@@ -477,4 +479,4 @@ class QueryLexer(val keywords: Seq[String], val delims: Seq[String]) extends
Std
                 allCaseVersions(s.tail, prefix + s.head.toUpper)
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f0e58eda/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
index 01c4bfa..500a305 100644
--- a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
@@ -174,8 +174,11 @@ public class BaseRepositoryTest {
 
         HierarchicalTypeDefinition<TraitType> logTraitDef = TypesUtil.createTraitTypeDef("Log
Data", null);
 
+        HierarchicalTypeDefinition<TraitType> isaKeywordTraitDef = TypesUtil.createTraitTypeDef("isa",
null);
+
         return TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
-            ImmutableList.of(dimTraitDef, factTraitDef, piiTraitDef, metricTraitDef, etlTraitDef,
jdbcTraitDef, logTraitDef),
+            ImmutableList.of(dimTraitDef, factTraitDef, piiTraitDef, metricTraitDef, etlTraitDef,
jdbcTraitDef, logTraitDef,
+                    isaKeywordTraitDef),
             ImmutableList.of(dbClsDef, storageDescClsDef, columnClsDef, tblClsDef, loadProcessClsDef,
viewClsDef, partClsDef, datasetSubTypeClsDef));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f0e58eda/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
index 74438cd..7b7010c 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -368,6 +368,9 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest
{
                 {"Metric", 9},
                 {"PII", 8},
                 {"`Log Data`", 4},
+                // Not sure what the expected rows should be, but since we didn't assign
or do anything with the created
+                // I assume it'll be zero
+                {"`isa`", 0},
 
                 /* Lineage queries are fired through ClosureQuery and are tested through
HiveLineageJerseyResourceIt in webapp module.
                    Commenting out the below queries since DSL to Gremlin parsing/translation
fails with lineage queries when there are array types


Mime
View raw message