ATLAS-772 Ordering of columns is not maintained in schema query response, where as hive table entity response maintains the ordering ([email protected] via kevalbhatt)
(cherry picked from commit e817b214387525def94930a7375b297157037155) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/049e56ba Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/049e56ba Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/049e56ba Branch: refs/heads/0.7-incubating Commit: 049e56bada7fdc1d33a0d6e2d3735c9120ed9a13 Parents: 9f5027b Author: Keval Bhatt <[email protected]> Authored: Thu Sep 1 12:36:30 2016 +0530 Committer: Madhan Neethiraj <[email protected]> Committed: Thu Dec 22 15:26:31 2016 -0800 ---------------------------------------------------------------------- .../java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java | 4 +++- .../java/org/apache/atlas/hive/model/HiveDataModelGenerator.java | 4 +++- release-log.txt | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/049e56ba/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java ---------------------------------------------------------------------- diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java index 1f13d74..ad7a4a5 100755 --- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java +++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java @@ -576,7 +576,7 @@ public class HiveMetaStoreBridge { public List<Referenceable> getColumns(List<FieldSchema> schemaList, Referenceable tableReference) throws Exception { List<Referenceable> colList = new ArrayList<>(); - + int columnPosition = 0; for (FieldSchema fs : schemaList) { LOG.debug("Processing field " + fs); Referenceable colReferenceable = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName()); @@ -585,9 +585,11 @@ public class HiveMetaStoreBridge { colReferenceable.set(AtlasClient.NAME, fs.getName()); colReferenceable.set(AtlasClient.OWNER, tableReference.get(AtlasClient.OWNER)); colReferenceable.set("type", fs.getType()); + colReferenceable.set(HiveDataModelGenerator.POSITION, columnPosition++); colReferenceable.set(HiveDataModelGenerator.COMMENT, fs.getComment()); colReferenceable.set(HiveDataModelGenerator.TABLE, tableReference.getId()); + colList.add(colReferenceable); } return colList; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/049e56ba/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java ---------------------------------------------------------------------- diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java index b308cc9..45f0bc9 100755 --- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java +++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java @@ -64,6 +64,7 @@ public class HiveDataModelGenerator { public static final String COMMENT = "comment"; public static final String PARAMETERS = "parameters"; public static final String COLUMNS = "columns"; + public static final String POSITION = "position"; public static final String PART_COLS = "partitionKeys"; public static final String TABLE_ALIAS_LIST = "aliases"; @@ -224,7 +225,8 @@ public class HiveDataModelGenerator { new AttributeDefinition(COMMENT, DataTypes.STRING_TYPE.getName(), Multiplicity.OPTIONAL, false, null), //Making this optional since this is an incompatible change //Reverse attribute to 'columns' in Table - new AttributeDefinition(TABLE, HiveDataTypes.HIVE_TABLE.getName(), Multiplicity.OPTIONAL, false, COLUMNS),}; + new AttributeDefinition(TABLE, HiveDataTypes.HIVE_TABLE.getName(), Multiplicity.OPTIONAL, false, COLUMNS), + new AttributeDefinition(POSITION, DataTypes.INT_TYPE.getName(), Multiplicity.OPTIONAL, false, false, false, null)}; HierarchicalTypeDefinition<ClassType> definition = new HierarchicalTypeDefinition<>(ClassType.class, HiveDataTypes.HIVE_COLUMN.getName(), null, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/049e56ba/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index bf94411..c5a27c5 100644 --- a/release-log.txt +++ b/release-log.txt @@ -31,6 +31,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-772 Ordering of columns is not maintained in schema query response, where as hive table entity response maintains the ordering ([email protected] via kevalbhatt) ATLAS-1140 All the tag's attributes are not seen while applying a tag to entity (kevalbhatt) ATLAS-1141 UI-Issue - Tag with spaces, when searched, then it is wrongly set in search textbox. (Kalyanikashikar via kevalbhatt) ATLAS-1129 Remove notification failed logs on retry and add sleep between retries (svimal2106 via sumasai)
