You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sh...@apache.org on 2016/09/19 06:27:10 UTC
[7/8] incubator-atlas git commit: ATLAS-1098 Atlas allows creation of
tag with name isa which causes exceptions during search (apoorvnaik via
shwethags)
ATLAS-1098 Atlas allows creation of tag with name isa which causes exceptions during search (apoorvnaik via shwethags)
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/c1081a49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/c1081a49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/c1081a49
Branch: refs/heads/master
Commit: c1081a49da3553f55b33edecb416de99c90d10b4
Parents: 7bb2709
Author: Shwetha GS <ss...@hortonworks.com>
Authored: Mon Sep 19 11:13:08 2016 +0530
Committer: Shwetha GS <ss...@hortonworks.com>
Committed: Mon Sep 19 11:13:08 2016 +0530
----------------------------------------------------------------------
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/c1081a49/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 17660b5..ac5b042 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1737,7 +1737,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/c1081a49/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index d53a866..f1ac7a7 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
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/c1081a49/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/c1081a49/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/c1081a49/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/c1081a49/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 8a40110..40dc861 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -393,6 +393,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