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/07/15 17:49:28 UTC

[1/2] incubator-atlas git commit: ATLAS-971 UI not displaying results for this query - Eg: "hive_table as t where qualifiedName = 'default.input@cl1' select t" (kevalbhatt18 via shwethags)

Repository: incubator-atlas
Updated Branches:
  refs/heads/master b28ab21ee -> e895819fe


ATLAS-971 UI not displaying results for this query - Eg: "hive_table as t where qualifiedName = 'default.input@cl1' select t" (kevalbhatt18 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/1b1f9d2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1b1f9d2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1b1f9d2a

Branch: refs/heads/master
Commit: 1b1f9d2aa945cdbc3a58da67090a67add1d2dae4
Parents: b28ab21
Author: Shwetha GS <ss...@hortonworks.com>
Authored: Fri Jul 15 19:44:39 2016 +0530
Committer: Shwetha GS <ss...@hortonworks.com>
Committed: Fri Jul 15 19:44:39 2016 +0530

----------------------------------------------------------------------
 dashboardv2/public/css/scss/main.scss           |  10 +-
 dashboardv2/public/css/scss/tag.scss            |   6 +
 .../public/js/utils/CommonViewFunction.js       | 137 +++++++--
 dashboardv2/public/js/utils/Utils.js            |  26 +-
 .../views/entity/EntityDetailTableLayoutView.js |   2 +-
 .../js/views/search/SearchResultLayoutView.js   | 303 ++++++++++---------
 release-log.txt                                 |   1 +
 7 files changed, 300 insertions(+), 185 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/dashboardv2/public/css/scss/main.scss
----------------------------------------------------------------------
diff --git a/dashboardv2/public/css/scss/main.scss b/dashboardv2/public/css/scss/main.scss
index 1b566d4..82dbfc2 100644
--- a/dashboardv2/public/css/scss/main.scss
+++ b/dashboardv2/public/css/scss/main.scss
@@ -276,16 +276,24 @@ ul {
     }
     span {
         &.inputTag[data-id="tagClick"] {
+            span {
+                display: block;
+                padding: 3px 5px 3px 5px;
+            }
             i.fa-close[data-id="deleteTag"] {
                 display: none;
             }
         }
     }
     a {
-        &.inputTag[data-id="addTag"] {
+        &.inputTagAdd[data-id="addTag"] {
             display: none;
         }
         &.inputTag[data-id="tagClick"] {
+            span {
+                display: block;
+                padding: 3px 5px 3px 5px;
+            }
             i.fa-times[data-id="delete"] {
                 display: none;
             }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/dashboardv2/public/css/scss/tag.scss
----------------------------------------------------------------------
diff --git a/dashboardv2/public/css/scss/tag.scss b/dashboardv2/public/css/scss/tag.scss
index 0271daa..d291cd3 100644
--- a/dashboardv2/public/css/scss/tag.scss
+++ b/dashboardv2/public/css/scss/tag.scss
@@ -173,10 +173,16 @@
     border: 1px $color_jungle_green_approx solid;
     background-color: $white;
     color: $color_jungle_green_approx;
+    padding-left: 5px;
     &:hover {
         color: $white;
         background-color: $color_jungle_green_approx;
     }
+    i.fa {
+        &:hover {
+            background-color: $color_jungle_green_approx;
+        }
+    }
 }
 
 .addTagBase {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/dashboardv2/public/js/utils/CommonViewFunction.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index 495d6b8..997060f 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -79,11 +79,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
             }
         });
     };
-    CommonViewFunction.propertyTable = function(valueObject, scope) {
+    CommonViewFunction.propertyTable = function(valueObject, scope, searchTable) {
         var table = "",
             fetchInputOutputValue = function(id) {
                 var that = this;
-                scope.model.getEntity(id, {
+                if (searchTable) {
+                    ++scope.fetchList
+                }
+                scope.entityModel.getEntity(id, {
                     success: function(data) {
                         var value = "",
                             deleteButton = "";
@@ -116,7 +119,12 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                         }
                     },
                     error: function(error, data, status) {},
-                    complete: function() {}
+                    complete: function() {
+                        if (searchTable) {
+                            --scope.fetchList;
+                            scope.checkTableFetch();
+                        }
+                    }
                 });
             }
         _.keys(valueObject).map(function(key) {
@@ -129,6 +137,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                         id = undefined,
                         tempLink = "",
                         readOnly = false;
+                    if (inputOutputField['$id$']) {
+                        inputOutputField.id = inputOutputField['$id$'];
+                    }
                     if (inputOutputField) {
                         if (_.isObject(inputOutputField.id)) {
                             id = inputOutputField.id.id;
@@ -138,14 +149,18 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                         } else if (inputOutputField.id) {
                             id = inputOutputField.id;
                         } else if (_.isString(inputOutputField) || _.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
-                            valueOfArray.push('<span>' + inputOutputField + '</span>');
+                            if (inputOutputField.indexOf("$") == -1) {
+                                valueOfArray.push('<span>' + inputOutputField + '</span>');
+                            }
                         } else if (_.isObject(inputOutputField)) {
                             _.each(inputOutputField, function(objValue, objKey) {
                                 var value = objValue;
-                                if (_.isObject(value)) {
-                                    value = JSON.stringify(value);
+                                if (objKey.indexOf("$") == -1) {
+                                    if (_.isObject(value)) {
+                                        value = JSON.stringify(value);
+                                    }
+                                    valueOfArray.push('<span>' + objKey + ':' + value + '</span>');
                                 }
-                                valueOfArray.push('<span>' + objKey + ':' + value + '</span>');
                             });
                         }
                     }
@@ -161,14 +176,25 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                             } else {
                                 tempLink += '<a href="#!/detailPage/' + id + '">' + id + '</a>'
                             }
+                        } else if (inputOutputField.name) {
+                            tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.name + '</a>';
+                        } else if (inputOutputField.qualifiedName) {
+                            tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.qualifiedName + '</a>'
                         } else {
+                            var fetch = true;
                             fetchInputOutputValue(id);
                             tempLink += '<div data-id="' + id + '"></div>';
                         }
                     }
                     if (readOnly) {
-                        tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
-                        subLink += '<div class="block readOnlyLink">' + tempLink + '</div>';
+                        if (!fetch) {
+                            tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
+                            subLink += '<div class="block readOnlyLink">' + tempLink + '</div>';
+                        } else {
+                            fetch = false;
+                            subLink += tempLink;
+                        }
+
                     } else {
                         if (tempLink.search('href') != -1) {
                             subLink += '<div>' + tempLink + '</div>'
@@ -180,11 +206,18 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                 if (valueOfArray.length) {
                     subLink = valueOfArray.join(', ');
                 }
-                table += '<tr><td>' + key + '</td><td>' + subLink + '</td></tr>';
+                if (searchTable) {
+                    table = subLink;
+                } else {
+                    table += '<tr><td>' + key + '</td><td>' + subLink + '</td></tr>';
+                }
             } else if (_.isObject(keyValue)) {
                 var id = undefined,
                     tempLink = "",
                     readOnly = false;
+                if (keyValue['$id$']) {
+                    keyValue.id = keyValue['$id$'];
+                }
                 if (_.isObject(keyValue.id)) {
                     id = keyValue.id.id;
                     if (Globals.entityStateReadOnly[keyValue.id.state]) {
@@ -204,15 +237,39 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                         } else {
                             tempLink += '<a href="#!/detailPage/' + id + '">' + id + '</a>';
                         }
+                    } else if (keyValue.name) {
+                        tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.name + '</a>';
+                    } else if (keyValue.qualifiedName) {
+                        tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.qualifiedName + '</a>'
                     } else {
+                        var fetch = true;
                         fetchInputOutputValue(id);
                         tempLink += '<div data-id="' + id + '"></div>';
                     }
                     if (readOnly) {
-                        tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
-                        table += '<tr><td>' + key + '</td><td><div class="block readOnlyLink">' + tempLink + '</div></td></tr>';
+                        if (!fetch) {
+                            tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
+                        }
+
+                        if (searchTable) {
+                            if (!fetch) {
+                                table = '<div class="block readOnlyLink">' + tempLink + '</div>';
+                            } else {
+                                table = tempLink;
+                            }
+                        } else {
+                            if (!fetch) {
+                                table += '<tr><td>' + key + '</td><td><div class="block readOnlyLink">' + tempLink + '</div></td></tr>';
+                            } else {
+                                table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
+                            }
+                        }
                     } else {
-                        table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
+                        if (searchTable) {
+                            table = tempLink;
+                        } else {
+                            table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
+                        }
                     }
                 } else {
                     var stringArr = [];
@@ -232,18 +289,38 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                     }
                     if (readOnly) {
                         tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
-                        table += '<tr><td>' + key + '</td><td><div class="block readOnlyLink">' + tempLink + '</div></td></tr>';
+                        if (searchTable) {
+                            table = '<div class="block readOnlyLink">' + tempLink + '</div>';
+                        } else {
+                            table += '<tr><td>' + key + '</td><td><div class="block readOnlyLink">' + tempLink + '</div></td></tr>';
+                        }
+
                     } else {
-                        table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
+                        if (searchTable) {
+                            table = tempLink;
+                        } else {
+                            table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
+                        }
                     }
                 }
             } else {
-                if (key == "createTime" || key == "lastAccessTime" || key == "retention") {
-                    table += '<tr><td>' + key + '</td><td>' + new Date(valueObject[key]) + '</td></tr>';
+                if (key.indexOf("Time") !== -1 || key == "retention") {
+                    if (searchTable) {
+                        table = new Date(valueObject[key]);
+                    } else {
+                        table += '<tr><td>' + key + '</td><td>' + new Date(valueObject[key]) + '</td></tr>';
+                    }
                 } else {
-                    table += '<tr><td>' + key + '</td><td>' + valueObject[key] + '</td></tr>';
+                    if (searchTable) {
+                        if (_.isBoolean(valueObject[key])) {
+                            table = valueObject[key].toString();
+                        } else {
+                            table = valueObject[key];
+                        }
+                    } else {
+                        table += '<tr><td>' + key + '</td><td>' + valueObject[key] + '</td></tr>';
+                    }
                 }
-
             }
         });
         return table;
@@ -328,11 +405,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
             id = model.get('$id$').id,
             terms = [];
         _.keys(traits).map(function(key) {
-            var tagName = Utils.checkTagOrTerm(traits[key].$typeName$);
+            if (traits[key].$typeName$) {
+                var tagName = Utils.checkTagOrTerm(traits[key].$typeName$);
+            } else {
+                var tagName = Utils.checkTagOrTerm(traits[key].typeName);
+            }
             if (tagName.term) {
                 terms.push({
-                    deleteHtml: '<a class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-assetname="' + model.get("name") + '" data-name="' + traits[key].$typeName$ + '" data-guid="' + model.get('$id$').id + '" ></i></a>',
-                    url: traits[key].$typeName$.split(".").join("/"),
+                    deleteHtml: '<a class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-assetname="' + model.get("name") + '" data-name="' + tagName.fullName+ '" data-guid="' + model.get('$id$').id + '" ></i></a>',
+                    url: tagName.fullName.split(".").join("/"),
                     name: tagName.fullName
                 });
             }
@@ -366,13 +447,17 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
             popTag = "",
             count = 0;
         _.keys(model.get('$traits$')).map(function(key) {
-            var tagName = Utils.checkTagOrTerm(traits[key].$typeName$),
-                className = "inputTag";
+            if (traits[key].$typeName$) {
+                var tagName = Utils.checkTagOrTerm(traits[key].$typeName$);
+            } else {
+                var tagName = Utils.checkTagOrTerm(traits[key].typeName);
+            }
+            var className = "inputTag";
             if (!tagName.term) {
                 if (count >= 1) {
-                    popTag += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + traits[key].$typeName$ + '</span><i class="fa fa-times" data-id="delete"  data-assetname="' + model.get("name") + '"data-name="' + tagName.name + '" data-guid="' + model.get('$id$').id + '" ></i></a>';
+                    popTag += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + tagName.name + '</span><i class="fa fa-times" data-id="delete"  data-assetname="' + model.get("name") + '"data-name="' + tagName.name + '" data-guid="' + model.get('$id$').id + '" ></i></a>';
                 } else {
-                    atags += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + traits[key].$typeName$ + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + model.get("name") + '" data-name="' + tagName.name + '" data-guid="' + model.get('$id$').id + '" ></i></a>';
+                    atags += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + tagName.name + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + model.get("name") + '" data-name="' + tagName.name + '" data-guid="' + model.get('$id$').id + '" ></i></a>';
                 }
                 ++count;
             }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/dashboardv2/public/js/utils/Utils.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js
index 01e5c30..7ddae5b 100644
--- a/dashboardv2/public/js/utils/Utils.js
+++ b/dashboardv2/public/js/utils/Utils.js
@@ -234,18 +234,20 @@ define(['require', 'utils/Globals'], function(require, Globals) {
         }
     }
     Utils.checkTagOrTerm = function(value) {
-        var name = value.split('.');
-        if (name.length > 1) {
-            return {
-                term: true,
-                name: name[name.length - 1],
-                fullName: value
-            }
-        } else {
-            return {
-                term: false,
-                name: name[name.length - 1],
-                fullName: value
+        if (value && _.isString(value)) {
+            var name = value.split('.');
+            if (name.length > 1) {
+                return {
+                    term: true,
+                    name: name[name.length - 1],
+                    fullName: value
+                }
+            } else {
+                return {
+                    term: false,
+                    name: name[name.length - 1],
+                    fullName: value
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js
index e65343e..cc67d01 100644
--- a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js
+++ b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js
@@ -49,7 +49,7 @@ define(['require',
             initialize: function(options) {
                 _.extend(this, _.pick(options, 'globalVent', 'collection'));
                 this.collectionObject = this.collection.toJSON();
-                this.model = new this.collection.model();
+                this.entityModel = new this.collection.model();
             },
             bindEvents: function() {},
             onRender: function() {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 7bc37c0..eb63420 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -24,9 +24,10 @@ define(['require',
     'utils/Utils',
     'utils/Globals',
     'collection/VSearchList',
+    'models/VCommon',
     'utils/CommonViewFunction',
     'utils/Messages'
-], function(require, Backbone, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, CommonViewFunction, Messages) {
+], function(require, Backbone, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages) {
     'use strict';
 
     var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend(
@@ -75,7 +76,6 @@ define(['require',
                                 trigger: true
                             });
                         }
-
                     }
                 };
                 events["click " + this.ui.addTag] = 'addTagModalView';
@@ -207,7 +207,7 @@ define(['require',
                         }
                         that.renderTableLayoutView();
                         var resultData = that.searchCollection.fullCollection.length + ' results for <b>' + that.searchCollection.queryParams.query + '</b>'
-                        var multiAssignData = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o">' + " " + 'Assign Term</i></a>'
+                        var multiAssignData = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a>'
                         that.$('.searchResult').html(resultData + multiAssignData);
                     },
                     silent: true
@@ -273,111 +273,166 @@ define(['require',
                 if (this.searchCollection.responseData) {
                     if (responseData.dataType) {
                         if (responseData.dataType.attributeDefinitions.length == 2 && responseData.dataType.attributeDefinitions[1].name == "instanceInfo") {
-                            return this.getFixedColumn();
+                            return this.getFixedFullTextColumn();
                         } else {
-                            if (Globals.taxonomy) {
-                                col['Check'] = {
-                                    name: "selected",
-                                    label: "",
-                                    cell: "select-row",
-                                    headerCell: "select-all",
-                                    position: 1
-                                };
-                            }
-                            var modelJSON = this.searchCollection.toJSON()[0];
-                            _.keys(modelJSON).map(function(key) {
-                                if (key.indexOf("$") == -1 && typeof modelJSON[key] != "object") {
-                                    if (typeof modelJSON[key] == "string" || typeof modelJSON[key] == "number") {
-                                        if (typeof modelJSON[key] == "number" && key != "createTime") {
-                                            return;
+                            if (responseData.dataType.typeName.indexOf('_temp') == -1) {
+                                return this.getFixedDslColumn();
+                            } else {
+                                var idFound = false;
+                                _.each(this.searchCollection.models, function(model) {
+                                    var modelJSON = model.toJSON();
+                                    var guid = "";
+                                    _.each(modelJSON, function(val, key) {
+                                        if (_.isObject(val) && val.id) {
+                                            model.set('id', val.id);
+                                            guid = val.id;
+                                        } else if (key === "id") {
+                                            model.set('id', val);
+                                            guid = val;
                                         }
-                                        if (key == "name" || key == "owner" || key == "description") {
-                                            col[key] = {
-                                                cell: (key == "name") ? ("Html") : ("String"),
-                                                editable: false,
-                                                sortable: false,
-                                                orderable: true,
-                                                formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                                                    fromRaw: function(rawValue, model) {
-                                                        if (rawValue == null) {
-                                                            return null;
-                                                        }
-                                                        if (model.get('createTime') == rawValue) {
-                                                            return new Date(rawValue);
-                                                        }
-                                                        if (model.get('name') == rawValue) {
-                                                            var nameHtml = "";
-                                                            if (model.get('$id$')) {
-                                                                nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>';
-                                                            } else {
-                                                                nameHtml = '<a>' + rawValue + '</a>';
-                                                            }
-                                                            if (Globals.entityStateReadOnly[model.get('$id$').state]) {
-                                                                nameHtml += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
-                                                                return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
-                                                            } else {
-                                                                return nameHtml;
-                                                            }
-                                                        } else {
-                                                            return rawValue;
-                                                        }
+                                    });
+                                    if (guid.length) {
+                                        idFound = true;
+                                        model.getEntity(guid, {
+                                            async: false,
+                                            success: function(data) {
+                                                if (data.definition) {
+                                                    if (data.definition.id && data.definition.values) {
+                                                        that.searchCollection.get(data.definition.id).set(data.definition.values);
+                                                        that.searchCollection.get(data.definition.id).set('$id$', data.definition.id);
+                                                        that.searchCollection.get(data.definition.id).set('$traits$', data.definition.traits);
                                                     }
-                                                })
-                                            };
-                                        }
+                                                }
+                                            },
+                                            error: function(error, data, status) {},
+                                            complete: function() {}
+                                        });
                                     }
+                                });
+                                if (idFound) {
+                                    return this.getFixedDslColumn();
+                                } else {
+                                    return this.getDaynamicColumn();
                                 }
-                            });
-                            col['tag'] = {
-                                label: "Tags",
-                                cell: "Html",
-                                editable: false,
-                                sortable: false,
-                                orderable: true,
-                                className: 'searchTag',
-                                formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                                    fromRaw: function(rawValue, model) {
-                                        if (Globals.entityStateReadOnly[model.get('$id$').state]) {
-                                            return '<div class="readOnly">' + CommonViewFunction.tagForTable(model); + '</div>';
-                                        } else {
-                                            return CommonViewFunction.tagForTable(model);
-                                        }
-
-                                    }
-                                })
-                            };
-                            if (Globals.taxonomy) {
-                                col['terms'] = {
-                                    label: "Terms",
-                                    cell: "Html",
-                                    editable: false,
-                                    sortable: false,
-                                    orderable: true,
-                                    className: 'searchTerm',
-                                    formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                                        fromRaw: function(rawValue, model) {
-                                            var returnObject = CommonViewFunction.termTableBreadcrumbMaker(model);
-                                            if (returnObject.object) {
-                                                that.bradCrumbList.push(returnObject.object);
-                                            }
-                                            if (Globals.entityStateReadOnly[model.get('$id$').state]) {
-                                                return '<div class="readOnly">' + returnObject.html + '</div>';
-                                            } else {
-                                                return returnObject.html;
-                                            }
-                                        }
-                                    })
-                                };
                             }
-                            that.checkTableFetch();
-                            return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
                         }
                     } else {
-                        return this.getFixedColumn();
+                        return this.getFixedFullTextColumn();
                     }
                 }
             },
-            getFixedColumn: function() {
+            getDaynamicColumn: function() {
+                var that = this,
+                    modelJSON = "",
+                    col = {};
+                modelJSON = this.searchCollection.toJSON()[0];
+                _.keys(modelJSON).map(function(key) {
+                    if (key.indexOf("$") == -1) {
+                        col[key] = {
+                            cell: 'Html',
+                            editable: false,
+                            sortable: false,
+                            orderable: true,
+                            formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                                fromRaw: function(rawValue, model) {
+                                    return CommonViewFunction.propertyTable({ 'notUsedKey': rawValue }, that, true);
+                                }
+                            })
+                        };
+                    }
+                });
+                that.checkTableFetch();
+                return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
+            },
+            getFixedDslColumn: function() {
+                var that = this,
+                    col = {};
+                col['name'] = {
+                    label: "Name",
+                    cell: "html",
+                    editable: false,
+                    sortable: false,
+                    formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                        fromRaw: function(rawValue, model) {
+                            var nameHtml = "";
+                            if (model.get('$id$')) {
+                                nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>';
+                            } else {
+                                nameHtml = '<a>' + rawValue + '</a>';
+                            }
+                            if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) {
+                                nameHtml += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
+                                return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
+                            } else {
+                                return nameHtml;
+                            }
+                        }
+                    })
+                }
+                col['description'] = {
+                    label: "Description",
+                    cell: "String",
+                    editable: false,
+                    sortable: false
+                }
+                col['owner'] = {
+                    label: "Owner",
+                    cell: "String",
+                    editable: false,
+                    sortable: false
+                }
+                col['tag'] = {
+                    label: "Tags",
+                    cell: "Html",
+                    editable: false,
+                    sortable: false,
+                    orderable: true,
+                    className: 'searchTag',
+                    formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                        fromRaw: function(rawValue, model) {
+                            if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) {
+                                return '<div class="readOnly">' + CommonViewFunction.tagForTable(model); + '</div>';
+                            } else {
+                                return CommonViewFunction.tagForTable(model);
+                            }
+
+                        }
+                    })
+                };
+                if (Globals.taxonomy) {
+                    col['Check'] = {
+                        name: "selected",
+                        label: "",
+                        cell: "select-row",
+                        headerCell: "select-all",
+                        position: 1
+                    };
+                    col['terms'] = {
+                        label: "Terms",
+                        cell: "Html",
+                        editable: false,
+                        sortable: false,
+                        orderable: true,
+                        className: 'searchTerm',
+                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                            fromRaw: function(rawValue, model) {
+                                var returnObject = CommonViewFunction.termTableBreadcrumbMaker(model);
+                                if (returnObject.object) {
+                                    that.bradCrumbList.push(returnObject.object);
+                                }
+                                if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) {
+                                    return '<div class="readOnly">' + returnObject.html + '</div>';
+                                } else {
+                                    return returnObject.html;
+                                }
+                            }
+                        })
+                    };
+                }
+                that.checkTableFetch();
+                return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
+            },
+            getFixedFullTextColumn: function() {
                 var that = this;
                 return this.searchCollection.constructor.getTableCols({
                     instanceInfo: {
@@ -406,56 +461,14 @@ define(['require',
                                 var modelObject = model.toJSON();
                                 if (modelObject.$typeName$ && modelObject.instanceInfo) {
                                     var guid = model.toJSON().instanceInfo.guid;
-                                    ++that.fetchList;
-                                    model.getEntity(guid, {
-                                        success: function(data) {
-                                            if (data.definition) {
-                                                if (data.definition.id && data.definition.id.state) {
-                                                    if (Globals.entityStateReadOnly[data.definition.id.state]) {
-                                                        that.$('td a[data-id="' + guid + '"]').parent().addClass('readOnly readOnlyLink');
-                                                        that.$('td a[data-id="' + guid + '"]').parent().append('<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>');
-                                                    }
-                                                }
-                                                if (data.definition.values && data.definition.values.name) {
-                                                    return that.$('td a[data-id="' + guid + '"]').html(data.definition.values.name);
-                                                } else {
-                                                    return that.$('td a[data-id="' + guid + '"]').html(data.definition.id.id);
-                                                }
-                                            }
-                                        },
-                                        error: function(error, data, status) {},
-                                        complete: function() {
-                                            --that.fetchList;
-                                            that.checkTableFetch();
-                                        }
-                                    });
-                                    return '<div><a href="#!/detailPage/' + guid + '" data-id="' + guid + '"></a></div>';
+                                    var json = model.toJSON();
+                                    json['id'] = guid;
+                                    return CommonViewFunction.propertyTable({ 'notUsedKey': json }, that, true);
                                 } else if (!modelObject.$typeName$) {
                                     var guid = model.toJSON().guid;
-                                    ++that.fetchList;
-                                    model.getEntity(guid, {
-                                        success: function(data) {
-                                            if (data.definition) {
-                                                if (data.definition.id && data.definition.id.state) {
-                                                    if (Globals.entityStateReadOnly[data.definition.id.state]) {
-                                                        that.$('td a[data-id="' + guid + '"]').parent().addClass('readOnly readOnlyLink');
-                                                        that.$('td a[data-id="' + guid + '"]').parent().append('<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>');
-                                                    }
-                                                }
-                                                if (data.definition.values && data.definition.values.name) {
-                                                    return that.$('td a[data-id="' + guid + '"]').html(data.definition.values.name);
-                                                } else {
-                                                    return that.$('td a[data-id="' + guid + '"]').html(data.definition.id.id);
-                                                }
-                                            }
-                                        },
-                                        error: function(error, data, status) {},
-                                        complete: function() {
-                                            --that.fetchList;
-                                            that.checkTableFetch();
-                                        }
-                                    });
-                                    return '<div><a href="#!/detailPage/' + guid + '" data-id="' + guid + '"></a></div>';
+                                    var json = model.toJSON();
+                                    json['id'] = guid;
+                                    return CommonViewFunction.propertyTable({ 'notUsedKey': json }, that, true);
                                 }
                             }
                         })

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1b1f9d2a/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 51c8bd6..ecdc8a9 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
 
 
 ALL CHANGES:
+ATLAS-971 UI not displaying results for this query - Eg: "hive_table as t where qualifiedName = 'default.input@cl1' select t" (kevalbhatt18 via shwethags) 
 ATLAS-1010 Atlas allows recreation of tags with same name (shwethags)
 ATLAS-990 Hive Import metadata script fails with auth exception (nixonrodrigues via shwethags)
 ATLAS-998 determine HA mode from property atlas.server.ids, instead of atlas.server.ha.enabled (madhan.neethiraj via shwethags)



[2/2] incubator-atlas git commit: ATLAS-996 DSL queries with comparsions of many primitive types fail (jnhagelb via shwethags)

Posted by sh...@apache.org.
ATLAS-996 DSL queries with comparsions of many primitive types fail (jnhagelb 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/e895819f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/e895819f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/e895819f

Branch: refs/heads/master
Commit: e895819fec853d86ed5f8a4ee7fb7a7f1bd5aa1a
Parents: 1b1f9d2
Author: Shwetha GS <ss...@hortonworks.com>
Authored: Fri Jul 15 19:45:05 2016 +0530
Committer: Shwetha GS <ss...@hortonworks.com>
Committed: Fri Jul 15 19:45:05 2016 +0530

----------------------------------------------------------------------
 release-log.txt                                 |   1 +
 .../graph/GraphBackedSearchIndexer.java         |   1 +
 .../org/apache/atlas/query/Expressions.scala    |  14 +-
 .../org/apache/atlas/query/GremlinQuery.scala   |  76 ++++++----
 .../test/java/org/apache/atlas/TestUtils.java   |  43 +++++-
 .../GraphBackedDiscoveryServiceTest.java        | 142 +++++++++++++++----
 6 files changed, 218 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e895819f/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index ecdc8a9..a18b9b1 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
 
 
 ALL CHANGES:
+ATLAS-996 DSL queries with comparsions of many primitive types fail (jnhagelb via shwethags)
 ATLAS-971 UI not displaying results for this query - Eg: "hive_table as t where qualifiedName = 'default.input@cl1' select t" (kevalbhatt18 via shwethags) 
 ATLAS-1010 Atlas allows recreation of tags with same name (shwethags)
 ATLAS-990 Hive Import metadata script fails with auth exception (nixonrodrigues via shwethags)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e895819f/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 1a35d50..8c8134f 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -90,6 +90,7 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
         try {
             if (management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)) {
                 LOG.info("Global indexes already exist for graph");
+                management.commit();
                 return;
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e895819f/repository/src/main/scala/org/apache/atlas/query/Expressions.scala
----------------------------------------------------------------------
diff --git a/repository/src/main/scala/org/apache/atlas/query/Expressions.scala b/repository/src/main/scala/org/apache/atlas/query/Expressions.scala
index 2405750..ab7e81c 100755
--- a/repository/src/main/scala/org/apache/atlas/query/Expressions.scala
+++ b/repository/src/main/scala/org/apache/atlas/query/Expressions.scala
@@ -330,9 +330,9 @@ object Expressions {
         def instance() = new InstanceExpression(this)
 
         def path() = new PathExpression(this)
-        
+
         def limit(lmt: Literal[Integer], offset : Literal[Integer]) = new LimitExpression(this, lmt, offset)
-        
+
         def order(odr: String, asc: Boolean) = new OrderExpression(this, odr, asc)
     }
 
@@ -635,7 +635,11 @@ object Expressions {
                 left.dataType;
             } else if(left.dataType == DataTypes.DATE_TYPE) {
                 DataTypes.DATE_TYPE
-            } else if (left.dataType != DataTypes.STRING_TYPE || right.dataType != DataTypes.STRING_TYPE) {
+            }
+            else if(left.dataType == DataTypes.BOOLEAN_TYPE) {
+                DataTypes.BOOLEAN_TYPE;
+            }
+            else if (left.dataType != DataTypes.STRING_TYPE || right.dataType != DataTypes.STRING_TYPE) {
                 TypeUtils.combinedType(left.dataType, right.dataType)
             }
             DataTypes.BOOLEAN_TYPE
@@ -783,8 +787,8 @@ object Expressions {
             child.dataType
     }
   }
-  
-  case class OrderExpression(child: Expression, odr: String, asc: Boolean) extends Expression with UnaryNode { 
+
+  case class OrderExpression(child: Expression, odr: String, asc: Boolean) extends Expression with UnaryNode {
 
     override def toString = s"$child  order $odr asc $asc"
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e895819f/repository/src/main/scala/org/apache/atlas/query/GremlinQuery.scala
----------------------------------------------------------------------
diff --git a/repository/src/main/scala/org/apache/atlas/query/GremlinQuery.scala b/repository/src/main/scala/org/apache/atlas/query/GremlinQuery.scala
index 14c42b0..8add6c8 100755
--- a/repository/src/main/scala/org/apache/atlas/query/GremlinQuery.scala
+++ b/repository/src/main/scala/org/apache/atlas/query/GremlinQuery.scala
@@ -18,6 +18,7 @@
 
 package org.apache.atlas.query
 
+import org.apache.atlas.query.TypeUtils.FieldInfo;
 import org.apache.atlas.query.Expressions._
 import org.apache.atlas.typesystem.types.{TypeSystem, DataTypes}
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory
@@ -25,6 +26,7 @@ import org.joda.time.format.ISODateTimeFormat
 
 import scala.collection.mutable
 import scala.collection.mutable.ArrayBuffer
+import org.apache.atlas.typesystem.types.IDataType
 
 trait IntSequence {
     def next: Int
@@ -237,30 +239,9 @@ class GremlinTranslator(expr: Expression,
             }
         }
         case c@ComparisonExpression(symb, f@FieldExpression(fieldName, fInfo, ch), l) => {
-          val QUOTE = "\"";
-          val fieldGremlinExpr = s"${gPersistenceBehavior.fieldNameInVertex(fInfo.dataType, fInfo.attrInfo)}"
-            ch match {
-                case Some(child) => {
-                  s"""${genQuery(child, inSelect)}.has("$fieldGremlinExpr", ${gPersistenceBehavior.gremlinCompOp(c)}, $l)"""
-                }
-                case None => {
-                    if (fInfo.attrInfo.dataType == DataTypes.DATE_TYPE) {
-                        try {
-                            //Accepts both date, datetime formats
-                            val dateStr = l.toString.stripPrefix(QUOTE).stripSuffix(QUOTE)
-                            val dateVal = ISODateTimeFormat.dateOptionalTimeParser().parseDateTime(dateStr).getMillis
-                            s"""has("$fieldGremlinExpr", ${gPersistenceBehavior.gremlinCompOp(c)},${dateVal})"""
-                        } catch {
-                            case pe: java.text.ParseException =>
-                                throw new GremlinTranslationException(c,
-                                    "Date format " + l + " not supported. Should be of the format " + TypeSystem.getInstance().getDateFormat.toPattern);
-
-                        }
-                    }
-                    else
-                        s"""has("$fieldGremlinExpr", ${gPersistenceBehavior.gremlinCompOp(c)}, $l)"""
-                }
-            }
+           val qualifiedPropertyName = s"${gPersistenceBehavior.fieldNameInVertex(fInfo.dataType, fInfo.attrInfo)}";
+           val persistentExprValue = translateValueToPersistentForm(fInfo, l);
+           return generateAndPrependExpr(ch, inSelect, s"""has("${qualifiedPropertyName}", ${gPersistenceBehavior.gremlinCompOp(c)}, $persistentExprValue)""");
         }
         case fil@FilterExpression(child, condExpr) => {
             s"${genQuery(child, inSelect)}.${genQuery(condExpr, inSelect)}"
@@ -344,6 +325,53 @@ class GremlinTranslator(expr: Expression,
         case x => throw new GremlinTranslationException(x, "expression not yet supported")
     }
 
+
+    def translateValueToPersistentForm(fInfo: FieldInfo, l: Expression): Any =  {
+
+        val dataType = fInfo.attrInfo.dataType;
+
+         if (dataType == DataTypes.DATE_TYPE) {
+              val QUOTE = "\"";
+              try {
+                  //Accepts both date, datetime formats
+                  val dateStr = l.toString.stripPrefix(QUOTE).stripSuffix(QUOTE)
+                  val dateVal = ISODateTimeFormat.dateOptionalTimeParser().parseDateTime(dateStr).getMillis
+                  return dateVal
+               } catch {
+                     case pe: java.text.ParseException =>
+                          throw new GremlinTranslationException(l,
+                                      "Date format " + l + " not supported. Should be of the format " +
+                                      TypeSystem.getInstance().getDateFormat.toPattern);
+               }
+         }
+         else if(dataType == DataTypes.BYTE_TYPE) {
+             //cast needed, otherwise get class cast exception when trying to compare, since the
+             //persist value is assumed to be an Integer
+             return s"""(byte)$l"""
+         }
+         else if(dataType == DataTypes.SHORT_TYPE) {
+             return s"""(short)$l"""
+         }
+         else if(dataType == DataTypes.LONG_TYPE) {
+             return s"""${l}L"""
+         }
+         else if(dataType == DataTypes.FLOAT_TYPE) {
+             return s"""${l}f"""
+         }
+         else if(dataType == DataTypes.DOUBLE_TYPE) {
+             return s"""${l}d"""
+         }
+         else {
+             return l
+         }
+    }
+
+    def generateAndPrependExpr(e1: Option[Expression], inSelect: Boolean, e2: String) : String = e1 match {
+
+        case Some(x) => s"""${genQuery(x, inSelect)}.$e2"""
+        case None => e2
+    }
+
     def genFullQuery(expr: Expression): String = {
         var q = genQuery(expr, false)
         if(gPersistenceBehavior.addGraphVertexPrefix(preStatements)) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e895819f/repository/src/test/java/org/apache/atlas/TestUtils.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/TestUtils.java b/repository/src/test/java/org/apache/atlas/TestUtils.java
index 1eeffb4..bd9df62 100755
--- a/repository/src/test/java/org/apache/atlas/TestUtils.java
+++ b/repository/src/test/java/org/apache/atlas/TestUtils.java
@@ -46,6 +46,8 @@ import org.codehaus.jettison.json.JSONArray;
 import org.testng.Assert;
 
 import java.io.File;
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -113,7 +115,18 @@ public final class TestUtils {
                 createOptionalAttrDef("address", "Address"),
                 new AttributeDefinition("department", "Department", Multiplicity.REQUIRED, false, "employees"),
                 new AttributeDefinition("manager", "Manager", Multiplicity.OPTIONAL, false, "subordinates"),
-                new AttributeDefinition("mentor", "Person", Multiplicity.OPTIONAL, false, null));
+                new AttributeDefinition("mentor", "Person", Multiplicity.OPTIONAL, false, null),
+                createOptionalAttrDef("birthday", DataTypes.DATE_TYPE),
+                createOptionalAttrDef("hasPets", DataTypes.BOOLEAN_TYPE),
+                createOptionalAttrDef("numberOfCars", DataTypes.BYTE_TYPE),
+                createOptionalAttrDef("houseNumber", DataTypes.SHORT_TYPE),
+                createOptionalAttrDef("carMileage", DataTypes.INT_TYPE),
+                createOptionalAttrDef("shares", DataTypes.LONG_TYPE),
+                createOptionalAttrDef("salary", DataTypes.DOUBLE_TYPE),
+                createOptionalAttrDef("age", DataTypes.FLOAT_TYPE),
+                createOptionalAttrDef("numberOfStarsEstimate", DataTypes.BIGINTEGER_TYPE),
+                createOptionalAttrDef("approximationOfPi", DataTypes.BIGDECIMAL_TYPE)
+                );
 
         HierarchicalTypeDefinition<ClassType> managerTypeDef = createClassTypeDef("Manager", "Manager"+_description, ImmutableSet.of("Person"),
                 new AttributeDefinition("subordinates", String.format("array<%s>", "Person"), Multiplicity.COLLECTION,
@@ -142,7 +155,7 @@ public final class TestUtils {
         Referenceable juliusAddr = new Referenceable("Address");
         Referenceable max = new Referenceable("Person");
         Referenceable maxAddr = new Referenceable("Address");
-        
+
         hrDept.set("name", "hr");
         john.set("name", "John");
         john.set("department", hrDept);
@@ -150,11 +163,23 @@ public final class TestUtils {
         johnAddr.set("city", "Sunnyvale");
         john.set("address", johnAddr);
 
+        john.set("birthday",new Date(1950, 5, 15));
+        john.set("hasPets", true);
+        john.set("numberOfCars", 1);
+        john.set("houseNumber", 153);
+        john.set("carMileage", 13364);
+        john.set("shares", 15000);
+        john.set("salary", 123345.678);
+        john.set("age", 50);
+        john.set("numberOfStarsEstimate", new BigInteger("1000000000000000000000"));
+        john.set("approximationOfPi", new BigDecimal("3.141592653589793238462643383279502884197169399375105820974944592307816406286"));
+
         jane.set("name", "Jane");
         jane.set("department", hrDept);
         janeAddr.set("street", "Great America Parkway");
         janeAddr.set("city", "Santa Clara");
         jane.set("address", janeAddr);
+        janeAddr.set("street", "Great America Parkway");
 
         julius.set("name", "Julius");
         julius.set("department", hrDept);
@@ -162,7 +187,7 @@ public final class TestUtils {
         juliusAddr.set("city", "Newtonville");
         julius.set("address", juliusAddr);
         julius.set("subordinates", ImmutableList.<Referenceable>of());
-        
+
         max.set("name", "Max");
         max.set("department", hrDept);
         maxAddr.set("street", "Ripley St");
@@ -170,7 +195,17 @@ public final class TestUtils {
         max.set("address", maxAddr);
         max.set("manager", jane);
         max.set("mentor", julius);
-        
+        max.set("birthday",new Date(1979, 3, 15));
+        max.set("hasPets", true);
+        max.set("age", 36);
+        max.set("numberOfCars", 2);
+        max.set("houseNumber", 17);
+        max.set("carMileage", 13);
+        max.set("shares", Long.MAX_VALUE);
+        max.set("salary", Double.MAX_VALUE);
+        max.set("numberOfStarsEstimate", new BigInteger("1000000000000000000000000000000"));
+        max.set("approximationOfPi", new BigDecimal("3.1415926535897932"));
+
         john.set("manager", jane);
         john.set("mentor", max);
         hrDept.set("employees", ImmutableList.of(john, jane, julius, max));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e895819f/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 a911c49..c27894e 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -19,7 +19,7 @@
 package org.apache.atlas.discovery;
 
 import com.google.common.collect.ImmutableSet;
-
+import org.apache.atlas.AtlasException;
 import org.apache.atlas.BaseRepositoryTest;
 import org.apache.atlas.RepositoryMetadataModule;
 import org.apache.atlas.RequestContext;
@@ -27,12 +27,15 @@ import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.MetadataRepository;
+import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
+import org.apache.atlas.repository.graph.TitanGraphProvider;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.types.ClassType;
 import org.apache.atlas.typesystem.types.DataTypes;
 import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
+import org.apache.atlas.typesystem.types.IDataType;
 import org.apache.atlas.typesystem.types.Multiplicity;
 import org.apache.atlas.typesystem.types.TypeSystem;
 import org.codehaus.jettison.json.JSONArray;
@@ -46,12 +49,14 @@ import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import javax.inject.Inject;
-
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
@@ -71,20 +76,48 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
     @BeforeClass
     public void setUp() throws Exception {
         super.setUp();
-        TypeSystem typeSystem = TypeSystem.getInstance();
+
+        final TypeSystem typeSystem = TypeSystem.getInstance();
+        Collection<String> oldTypeNames = new HashSet<String>();
+        oldTypeNames.addAll(typeSystem.getTypeNames());
+
         TestUtils.defineDeptEmployeeTypes(typeSystem);
 
+        addIndexesForNewTypes(oldTypeNames, typeSystem);
+
         ITypedReferenceableInstance hrDept = TestUtils.createDeptEg1(typeSystem);
         repositoryService.createEntities(hrDept);
-        
+
         ITypedReferenceableInstance jane = repositoryService.getEntityDefinition("Manager", "name", "Jane");
         Id janeGuid = jane.getId();
         ClassType personType = typeSystem.getDataType(ClassType.class, "Person");
         ITypedReferenceableInstance instance = personType.createInstance(janeGuid);
         instance.set("orgLevel", "L1");
-        repositoryService.updateEntities(instance);
+        repositoryService.updatePartial(instance);
     }
 
+    private void addIndexesForNewTypes(Collection<String> oldTypeNames, final TypeSystem typeSystem) throws AtlasException {
+        Set<String> newTypeNames = new HashSet<>();
+        newTypeNames.addAll(typeSystem.getTypeNames());
+        newTypeNames.removeAll(oldTypeNames);
+
+        Collection<IDataType> newTypes = new ArrayList<IDataType>();
+        for(String name : newTypeNames) {
+            try {
+                newTypes.add(typeSystem.getDataType(IDataType.class, name));
+            } catch (AtlasException e) {
+                e.printStackTrace();
+            }
+
+        }
+        TitanGraphProvider provider = new TitanGraphProvider();
+        //We need to commit the transaction before creating the indices to release the locks held by the transaction.
+        //otherwise, the index commit will fail while waiting for the those locks to be released.
+        provider.get().commit();
+        GraphBackedSearchIndexer idx = new GraphBackedSearchIndexer(provider);
+        idx.onAdd(newTypes);
+	}
+
     @BeforeMethod
     public void setupContext() {
         RequestContext.createContext();
@@ -207,6 +240,73 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
         }
     }
 
+    @DataProvider(name = "comparisonQueriesProvider")
+    private Object[][] createComparisonQueries() {
+        //create queries the exercise the comparison logic for
+        //all of the different supported data types
+        return new Object[][] {
+            {"Person where (birthday < \"1950-01-01T02:35:58.440Z\" )", 0},
+            {"Person where (birthday > \"1975-01-01T02:35:58.440Z\" )", 2},
+            {"Person where (birthday >= \"1975-01-01T02:35:58.440Z\" )", 2},
+            {"Person where (birthday <= \"1950-01-01T02:35:58.440Z\" )", 0},
+            {"Person where (birthday = \"1975-01-01T02:35:58.440Z\" )", 0},
+            {"Person where (birthday != \"1975-01-01T02:35:58.440Z\" )", 4},
+
+            {"Person where (hasPets = true)", 2},
+            {"Person where (hasPets = false)", 2},
+            {"Person where (hasPets != false)", 2},
+            {"Person where (hasPets != true)", 2},
+
+            {"Person where (numberOfCars > 0)", 2},
+            {"Person where (numberOfCars > 1)", 1},
+            {"Person where (numberOfCars >= 1)", 2},
+            {"Person where (numberOfCars < 2)", 3},
+            {"Person where (numberOfCars <= 2)", 4},
+            {"Person where (numberOfCars = 2)", 1},
+            {"Person where (numberOfCars != 2)", 3},
+
+            {"Person where (houseNumber > 0)", 2},
+            {"Person where (houseNumber > 17)", 1},
+            {"Person where (houseNumber >= 17)", 2},
+            {"Person where (houseNumber < 153)", 3},
+            {"Person where (houseNumber <= 153)", 4},
+            {"Person where (houseNumber =  17)", 1},
+            {"Person where (houseNumber != 17)", 3},
+
+            {"Person where (carMileage > 0)", 2},
+            {"Person where (carMileage > 13)", 1},
+            {"Person where (carMileage >= 13)", 2},
+            {"Person where (carMileage < 13364)", 3},
+            {"Person where (carMileage <= 13364)", 4},
+            {"Person where (carMileage =  13)", 1},
+            {"Person where (carMileage != 13)", 3},
+
+            {"Person where (shares > 0)", 2},
+            {"Person where (shares > 13)", 2},
+            {"Person where (shares >= 16000)", 1},
+            {"Person where (shares < 13364)", 2},
+            {"Person where (shares <= 15000)", 3},
+            {"Person where (shares =  15000)", 1},
+            {"Person where (shares != 1)", 4},
+
+            {"Person where (salary > 0)", 2},
+            {"Person where (salary > 100000)", 2},
+            {"Person where (salary >= 200000)", 1},
+            {"Person where (salary < 13364)", 2},
+            {"Person where (salary <= 150000)", 3},
+            {"Person where (salary =  12334)", 0},
+            {"Person where (salary != 12344)", 4},
+
+            {"Person where (age > 36)", 1},
+            {"Person where (age > 49)", 1},
+            {"Person where (age >= 49)", 1},
+            {"Person where (age < 50)", 3},
+            {"Person where (age <= 35)", 2},
+            {"Person where (age =  35)", 0},
+            {"Person where (age != 35)", 4}
+        };
+    }
+
     @DataProvider(name = "dslQueriesProvider")
     private Object[][] createDSLQueries() {
         return new Object[][]{
@@ -577,6 +677,15 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
     
     @Test(dataProvider = "dslQueriesProvider")
     public void  testSearchByDSLQueries(String dslQuery, Integer expectedNumRows) throws Exception {
+        runQuery(dslQuery, expectedNumRows);
+    }
+
+    @Test(dataProvider = "comparisonQueriesProvider")
+    public void testDataTypeComparisonQueries(String dslQuery, Integer expectedNumRows) throws Exception {
+        runQuery(dslQuery, expectedNumRows);
+    }
+
+    public void runQuery(String dslQuery, Integer expectedNumRows) throws Exception {
         System.out.println("Executing dslQuery = " + dslQuery);
         String jsonResults = discoveryService.searchByDSL(dslQuery);
         assertNotNull(jsonResults);
@@ -595,32 +704,13 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
 
         JSONArray rows = results.getJSONArray("rows");
         assertNotNull(rows);
-        assertEquals(rows.length(), expectedNumRows.intValue()); // some queries may not have any results
+        assertEquals( rows.length(), expectedNumRows.intValue(), "query [" + dslQuery + "] returned [" + rows.length() + "] rows.  Expected " + expectedNumRows.intValue() + " rows."); // some queries may not have any results
         System.out.println("query [" + dslQuery + "] returned [" + rows.length() + "] rows");
     }
 
     @Test(dataProvider = "dslLimitQueriesProvider")
     public void  testSearchByDSLQueriesWithLimit(String dslQuery, Integer expectedNumRows) throws Exception {
-        System.out.println("Executing dslQuery = " + dslQuery);
-        String jsonResults = discoveryService.searchByDSL(dslQuery);
-        assertNotNull(jsonResults);
-
-        JSONObject results = new JSONObject(jsonResults);
-        assertEquals(results.length(), 3);
-        System.out.println("results = " + results);
-
-        Object query = results.get("query");
-        assertNotNull(query);
-
-        JSONObject dataType = results.getJSONObject("dataType");
-        assertNotNull(dataType);
-        String typeName = dataType.getString("typeName");
-        assertNotNull(typeName);
-
-        JSONArray rows = results.getJSONArray("rows");
-        assertNotNull(rows);
-        assertEquals(rows.length(), expectedNumRows.intValue()); // some queries may not have any results
-        System.out.println("query [" + dslQuery + "] returned [" + rows.length() + "] rows");
+        runQuery(dslQuery, expectedNumRows);
     }
     
     @DataProvider(name = "invalidDslQueriesProvider")