> On May 2, 2019, 5:59 a.m., Madhan Neethiraj wrote:
> > intg/src/main/java/org/apache/atlas/entitytransform/HiveTableEntityHandler.java
> > Lines 68 (patched)
> > <https://reviews.apache.org/r/70574/diff/2/?file=2142280#file2142280line68>
> >
> > Should rename of table automatically update the qualifiedName? Or
> > should the qualifiedName continue to use 'tableNameFromQualifiedName'?
> >
> > Table rename will be performed by a transformer with a call to
> > setAttribute(HIVE_TABLE_NAME_ATTRIBUTE, newName).
> >
> > Also, how does this impact the 'tableName' in other entity-type's
> > qualifiedName - like hive_column, hive_storagedesc?
>
> Ashutosh Mestry wrote:
> The case is that name and qualifiedName are different. In my test case,
> this is all hive generated. Also, there can be a case where from REST calls,
> user can set name and qualifiedName to be different.
>
> The patch handles this case.
>From AtlasHiveHookContext, this method is more complicated than simple concat
>operation. It explains the format I was seeing in my tests. In short, this
>makes it apparent that qualifiedName will not always be as straightforward as
>we expect it to be.
public String getQualifiedName(Table table) {
String tableName = table.getTableName();
if (table.isTemporary()) {
if (SessionState.get() != null && SessionState.get().getSessionId()
!= null) {
tableName = tableName + TEMP_TABLE_PREFIX +
SessionState.get().getSessionId();
} else {
tableName = tableName + TEMP_TABLE_PREFIX +
RandomStringUtils.random(10);
}
}
return (table.getDbName() + QNAME_SEP_ENTITY_NAME + tableName +
QNAME_SEP_CLUSTER_NAME).toLowerCase() + getClusterName();
}
- Ashutosh
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/70574/#review214993
-----------------------------------------------------------
On May 2, 2019, 5:36 a.m., Ashutosh Mestry wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70574/
> -----------------------------------------------------------
>
> (Updated May 2, 2019, 5:36 a.m.)
>
>
> Review request for atlas, Kapildeo Nayak, Madhan Neethiraj, Nikhil Bonte, and
> Sarath Subramanian.
>
>
> Bugs: ATLAS-3182
> https://issues.apache.org/jira/browse/ATLAS-3182
>
>
> Repository: atlas
>
>
> Description
> -------
>
> Simple string manipulation.
>
> **Transforms**
>
> import-options.json
> ```
> {
> "options": {
> "transformers": "[{\"conditions\":{\"hive_db.clusterName\":\"EQUALS:
> mycluster0\"},\"action\":{\"hive_db.clusterName\":\"SET:
> mycluster1\"}},{\"conditions\":{\"hive_db.name\":\"EQUALS:
> test_partition_bootstrap\"},\"action\":{\"hive_db.name\":\"SET:
> test_partition_bootstrap_target\"}}]"
> }
> }
> ```
> **Import Zip**
> (Attached)
>
> **CURL**
>
> curl -X POST -u admin:admin123 -H "Content-Type: multipart/form-data" -H
> "Cache-Control: no-cache" -F data=@./test_partition_bootstrap.zip -F
> request=@./import-options.json http://localhost:21000/api/atlas/admin/import
>
>
> Diffs
> -----
>
>
> intg/src/main/java/org/apache/atlas/entitytransform/HiveTableEntityHandler.java
> 9eb44d782
>
> intg/src/test/java/org/apache/atlas/entitytransform/TransformationHandlerTest.java
> d6b0ede2b
> intg/src/test/resources/json/entity1.json PRE-CREATION
> intg/src/test/resources/json/transform1.json PRE-CREATION
>
>
> Diff: https://reviews.apache.org/r/70574/diff/2/
>
>
> Testing
> -------
>
> **Unit tests**
> Additional test.
>
> **Functional test**
> Existing Import flow using test data.
>
>
> File Attachments
> ----------------
>
> Zip to Import
>
> https://reviews.apache.org/media/uploaded/files/2019/04/30/44469b66-884c-4bde-8200-e41306a19b3b__test_partition_bootstrap.zip
>
>
> Thanks,
>
> Ashutosh Mestry
>
>