ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject ambari git commit: AMBARI-20901. Improvement needed for creating ACID tables. (dipayanb)
Date Mon, 01 May 2017 09:08:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 6ce938366 -> e04896d1b


AMBARI-20901. Improvement needed for creating ACID tables. (dipayanb)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e04896d1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e04896d1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e04896d1

Branch: refs/heads/branch-2.5
Commit: e04896d1b2cfdaaf398d530486dd939587b4c152
Parents: 6ce9383
Author: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Authored: Mon May 1 14:37:45 2017 +0530
Committer: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Committed: Mon May 1 14:37:45 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/components/create-table.js | 32 +++++++++++++++-----
 .../app/templates/components/create-table.hbs   |  4 +--
 .../ui/app/templates/components/edit-table.hbs  |  5 ---
 3 files changed, 26 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e04896d1/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js b/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js
index 322aab5..1e8e673 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js
@@ -66,7 +66,8 @@ export default Ember.Component.extend({
     }
     if (!(this.checkColumnsExists() &&
       this.checkColumnUniqueness() &&
-      this.validateColumns())) {
+      this.validateColumns() &&
+      this.checkClusteringIfTransactional())) {
       this.selectTab("create.table.columns");
       return false;
     }
@@ -96,11 +97,11 @@ export default Ember.Component.extend({
   },
 
   checkColumnsExists() {
-    this.set('hasEmptyColumnsError');
-    this.set('emptyColumnsErrorText');
+    this.set('hasTableConfigurationError');
+    this.set('tableConfigurationErrorText');
     if (this.get('columns.length') === 0) {
-      this.set('hasEmptyColumnsError', true);
-      this.set('emptyColumnsErrorText', 'No columns configured. Add some column definitions.');
+      this.set('hasTableConfigurationError', true);
+      this.set('tableConfigurationErrorText', 'No columns configured. Add some column definitions.');
       return false;
     }
     return true;
@@ -132,6 +133,16 @@ export default Ember.Component.extend({
     return true;
   },
 
+  checkClusteringIfTransactional() {
+    let clusteredColumns = this.get('columns').filterBy('isClustered', true);
+    if (this.get('settings.transactional') && clusteredColumns.get('length') ===
0) {
+      this.set('hasTableConfigurationError', true);
+      this.set('tableConfigurationErrorText', 'Table is marked as transactional but no clustered
column defined. Add some clustered column definitions.');
+      return false;
+    }
+    return true;
+  },
+
   validateTableProperties() {
     for (let i = 0; i < this.get('properties.length'); i++) {
       let property = this.get('properties').objectAt(i);
@@ -144,9 +155,14 @@ export default Ember.Component.extend({
 
   validateNumBuckets() {
     let clusteredColumns = this.get('columns').filterBy('isClustered', true);
-    if(clusteredColumns.get('length') > 0 &&
-      (Ember.isEmpty(this.get('settings.numBuckets')) ||
-      !Helper.isInteger(this.get('settings.numBuckets')))) {
+
+
+    function isNumBucketsPresentAndIsAnInteger(context) {
+      return (Ember.isEmpty(context.get('settings.numBuckets')) ||
+      !Helper.isInteger(context.get('settings.numBuckets')));
+    }
+
+    if(clusteredColumns.get('length') > 0 && isNumBucketsPresentAndIsAnInteger(this))
{
       this.get('settingErrors').pushObject({type: 'numBuckets', error: "Some columns are
clustered, Number of buckets are required."});
       return false;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e04896d1/contrib/views/hive20/src/main/resources/ui/app/templates/components/create-table.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/create-table.hbs
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/create-table.hbs
index 2ffbd2a..80e05de 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/create-table.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/create-table.hbs
@@ -39,9 +39,9 @@
     {{#each tabs as |tab|}}
       {{#if tab.active}}
         {{#if (eq tab.link "create.table.columns")}}
-          {{#if hasEmptyColumnsError}}
+          {{#if hasTableConfigurationError}}
             <div class="alert alert-danger create-table-error">
-              {{emptyColumnsErrorText}}
+              {{tableConfigurationErrorText}}
             </div>
           {{/if}}
           {{table-columns columns=columns shouldAddBuckets=shouldAddBuckets options=options}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e04896d1/contrib/views/hive20/src/main/resources/ui/app/templates/components/edit-table.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/edit-table.hbs
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/edit-table.hbs
index 7a02d3a..25048e7 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/edit-table.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/edit-table.hbs
@@ -26,11 +26,6 @@
       {{#each tabs as |tab|}}
         {{#if tab.active}}
           {{#if (eq tab.link "edit.table.columns")}}
-            {{#if hasEmptyColumnsError}}
-              <div class="alert alert-danger create-table-error">
-                {{emptyColumnsErrorText}}
-              </div>
-            {{/if}}
             {{table-columns columns=columns shouldAddBuckets=shouldAddBuckets editMode=true}}
           {{/if}}
           {{#if (eq tab.link "edit.table.properties")}}


Mime
View raw message