Skip to content

Commit

Permalink
fix: conditioned call to getColumnTags to columns fields (open-me…
Browse files Browse the repository at this point in the history
  • Loading branch information
TeddyCr authored Oct 20, 2023
1 parent 096a08c commit feb5264
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def patch_column_tags(
Updated Entity
"""
instance: Optional[Table] = self._fetch_entity_if_exists(
entity=Table, entity_id=table.id, fields=["tags"]
entity=Table, entity_id=table.id, fields=["tags", "columns"]
)

if not instance:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
public class TableRepository extends EntityRepository<Table> {

// Table fields that can be patched in a PATCH request
static final String PATCH_FIELDS = "tableConstraints,tablePartition";
static final String PATCH_FIELDS = "tableConstraints,tablePartition,columns";
// Table fields that can be updated in a PUT request
static final String UPDATE_FIELDS = "tableConstraints,tablePartition,dataModel,sourceUrl";
static final String UPDATE_FIELDS = "tableConstraints,tablePartition,dataModel,sourceUrl,columns";

public static final String FIELD_RELATION_COLUMN_TYPE = "table.columns.column";
public static final String FIELD_RELATION_TABLE_TYPE = "table";
Expand Down Expand Up @@ -126,7 +126,10 @@ public Table setFields(Table table, Fields fields) {
? EntityUtil.getLatestUsage(daoCollection.usageDAO(), table.getId())
: table.getUsageSummary());
}
getColumnTags(fields.contains(FIELD_TAGS), table.getColumns());
if (fields.contains(COLUMN_FIELD)) {
// We'll get column tags only if we are getting the column fields
getColumnTags(fields.contains(FIELD_TAGS), table.getColumns());
}
table.setJoins(fields.contains("joins") ? getJoins(table) : table.getJoins());
table.setTableProfilerConfig(
fields.contains(TABLE_PROFILER_CONFIG) ? getTableProfilerConfig(table) : table.getTableProfilerConfig());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
public class TableResource extends EntityResource<Table, TableRepository> {
public static final String COLLECTION_PATH = "v1/tables/";
static final String FIELDS =
"tableConstraints,tablePartition,usageSummary,owner,customMetrics,"
"tableConstraints,tablePartition,usageSummary,owner,customMetrics,columns,"
+ "tags,followers,joins,viewDefinition,dataModel,extension,testSuite,domain,dataProducts,lifeCycle";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static ResultList<TestCase> getTestCases(
MessageParser.EntityLink testCaseLink = MessageParser.EntityLink.parse(testCase.getEntityLink());
Table table =
Entity.getEntityByName(
Entity.TABLE, testCaseLink.getEntityFQN(), "owner,tags", Include.NON_DELETED);
Entity.TABLE, testCaseLink.getEntityFQN(), "owner,tags,columns", Include.NON_DELETED);

// Ignore table tests
if (testCaseLink.getFieldName() == null) return testCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ void put_resolveTask_tags_200() throws IOException {
// Task can be resolved by the User2 to whom the task is assigned
resolveTask(taskId, resolveTask, USER2_AUTH_HEADERS);

Table table = TABLE_RESOURCE_TEST.getEntity(TABLE.getId(), "tags", USER_AUTH_HEADERS);
Table table = TABLE_RESOURCE_TEST.getEntity(TABLE.getId(), "tags,columns", USER_AUTH_HEADERS);
List<TagLabel> tags = EntityUtil.getColumn(table, C1).getTags();
assertEquals(USER_ADDRESS_TAG_LABEL.getTagFQN(), tags.get(0).getTagFQN());

Expand Down

0 comments on commit feb5264

Please sign in to comment.