diff --git a/addons/models/0000-Area0/0010-base_model.json b/addons/models/0000-Area0/0010-base_model.json index 3f1dc7f77f..b3886f4818 100644 --- a/addons/models/0000-Area0/0010-base_model.json +++ b/addons/models/0000-Area0/0010-base_model.json @@ -879,7 +879,7 @@ ], "description": "Atlan Type representing parent model for Persona, Purpose", "serviceType": "atlan", - "typeVersion": "1.1", + "typeVersion": "1.2", "attributeDefs": [ { "name": "isAccessControlEnabled", @@ -914,6 +914,16 @@ "skipScrubbing": true, "includeInNotification": false }, + { + "name": "denyAssetFilters", + "typeName": "array", + "cardinality": "SET", + "isIndexable": false, + "isOptional": true, + "isUnique": false, + "skipScrubbing": true, + "includeInNotification": false + }, { "name": "channelLink", "typeName": "string", diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java index cd40af9677..7f5521e527 100644 --- a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java +++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java @@ -69,8 +69,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Collectors; import static org.apache.atlas.AtlasErrorCode.BAD_REQUEST; import static org.apache.atlas.AtlasErrorCode.DEPRECATED_API; @@ -93,6 +91,10 @@ public class EntityREST { public static final String PREFIX_ATTR_ = "attr_"; public static final String QUALIFIED_NAME = "qualifiedName"; private static final int HUNDRED_THOUSAND = 100000; + private static final int TWO_MILLION = HUNDRED_THOUSAND * 10 * 2; + private static final Set ATTRS_WITH_TWO_MILLION_LIMIT = new HashSet() {{ + add("rawQueryText"); + }}; private final AtlasTypeRegistry typeRegistry; @@ -899,15 +901,25 @@ public EntityMutationResponse createOrUpdate(AtlasEntitiesWithExtInfo entities, } public static void validateAttributeLength(final List entities) throws AtlasBaseException { - //Predicate to check attribute value exceeding length - Predicate> predicateOfAttributeLengthExceedingLimit = attribute -> - attribute.getValue() instanceof String && ((String) attribute.getValue()).length() > HUNDRED_THOUSAND; + List errorMessages = new ArrayList<>(); for (final AtlasEntity atlasEntity : entities) { - Set attributeKeys = org.apache.commons.collections4.MapUtils.emptyIfNull(atlasEntity.getAttributes()) - .entrySet().stream().filter(predicateOfAttributeLengthExceedingLimit).map(Map.Entry::getKey).collect(Collectors.toSet()); - if (!attributeKeys.isEmpty()) { - throw new AtlasBaseException("Attribute(s) " + String.join(",", attributeKeys) + " exceeds limit of "+HUNDRED_THOUSAND+" characters"); + for (Map.Entry attribute : atlasEntity.getAttributes().entrySet()) { + + if (attribute.getValue() instanceof String && ((String) attribute.getValue()).length() > HUNDRED_THOUSAND) { + + if (ATTRS_WITH_TWO_MILLION_LIMIT.contains(attribute.getKey())) { + if (((String) attribute.getValue()).length() > TWO_MILLION) { + errorMessages.add("Attribute " + attribute.getKey() + " exceeds limit of " + TWO_MILLION + " characters"); + } + } else { + errorMessages.add("Attribute " + attribute.getKey() + " exceeds limit of " + HUNDRED_THOUSAND + " characters"); + } + } + } + + if (errorMessages.size() > 0) { + throw new AtlasBaseException(AtlasType.toJson(errorMessages)); } } }