Browse Source

HUE-8208 [importer] Kudu tables do not always require a partition

Romain Rigaux 7 years ago
parent
commit
752631562c

+ 2 - 1
desktop/libs/indexer/src/indexer/indexers/envelope.py

@@ -112,6 +112,7 @@ class EnvelopeIndexer(object):
       path = example-input.json
       format = json
       """ % properties
+      # header = false
       
     if properties['ouputFormat'] == 'file':
       # parquet, 
@@ -165,4 +166,4 @@ steps {
     }
 }
 
-""" % {'input': input, 'output': output}
+""" % {'input': input, 'output': output, 'app_name': properties['app_name']}

+ 22 - 9
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -360,7 +360,7 @@ ${ assist.assistPanel() }
                 </label>
   
                 <label class="control-label"><div>${ _('Password') }</div>
-                  <input type="text" class="input-xxlarge" data-bind="value: createWizard.source.publicStreamsPassword">
+                  <input type="password" class="input-xxlarge" data-bind="value: createWizard.source.publicStreamsPassword">
                 </label>
   
                 <label class="control-label"><div>${ _('Token') }</div>
@@ -375,6 +375,12 @@ ${ assist.assistPanel() }
                   <input type="text" class="input-xxlarge" data-bind="value: createWizard.source.publicStreamsObject">
                 </label>
               </div>
+
+              <div class="control-group">
+                <button class="btn" data-bind="click: createWizard.source.publicStreamsCheckConnection">
+                  ${_('Test')}
+                </button>
+              </div>
             <!-- /ko -->
           <!-- /ko -->
 
@@ -1499,10 +1505,10 @@ ${ assist.assistPanel() }
         $.post("${ url('indexer:get_db_component') }", {
           "source": ko.mapping.toJSON(self)
         }, function (resp) {
-          if(resp.status == 0 && resp.data) {
+          if (resp.status == 0 && resp.data) {
             self.rdbmsDbIsValid(true);
             self.rdbmsDatabaseNames(resp.data);
-          } else if(resp.status == 1) {
+          } else if (resp.status == 1) {
             $(document).trigger("error", "${ _('Connection Failed: ') }" + resp.message);
             self.rdbmsDbIsValid(false);
           }
@@ -1560,6 +1566,18 @@ ${ assist.assistPanel() }
       self.publicStreamsToken = ko.observable('');
       self.publicStreamsEndpointUrl = ko.observable('');
       self.publicStreamsObject = ko.observable('');
+      self.publicStreamsCheckConnection = function() {
+        $.post("${ url('indexer:get_db_component') }", {
+          "source": ko.mapping.toJSON(self)
+        }, function (resp) {
+          if (resp.status == 0 && resp.data) {
+            huePubSub.publish('notebook.task.submitted', resp.history_uuid);
+          } else if (resp.status == 1) {
+            $(document).trigger("error", "${ _('Connection Failed: ') }" + resp.message);
+            self.rdbmsDbIsValid(false);
+          }
+        });
+      };
 
 
       self.format = ko.observable();
@@ -1826,11 +1844,6 @@ ${ assist.assistPanel() }
         return self.outputFormat() == 'table' && self.name().indexOf('.') > 0 ? self.name().split('.', 2)[0] : (self.name() !== '' ? self.name() : 'default');
       });
       self.tableFormat = ko.observable('text');
-      self.tableFormat.subscribe(function(newVal) {
-        if (newVal == 'kudu' && self.kuduPartitionColumns().length == 0) {
-          self.kuduPartitionColumns.push(ko.mapping.fromJS(self.KUDU_DEFAULT_PARTITION_COLUMN));
-        }
-      });
       self.KUDU_DEFAULT_RANGE_PARTITION_COLUMN = {values: [{value: ''}], name: 'VALUES', lower_val: 0, include_lower_val: '<=', upper_val: 1, include_upper_val: '<='};
       self.KUDU_DEFAULT_PARTITION_COLUMN = {columns: [], range_partitions: [self.KUDU_DEFAULT_RANGE_PARTITION_COLUMN], name: 'HASH', int_val: 16};
 
@@ -1981,7 +1994,7 @@ ${ assist.assistPanel() }
         );
         var isTargetAlreadyExisting = ! self.destination.isTargetExisting() || self.destination.outputFormat() == 'index';
         var isValidTable = self.destination.outputFormat() != 'table' || (
-          self.destination.tableFormat() != 'kudu' || (self.destination.kuduPartitionColumns().length > 0 &&
+          self.destination.tableFormat() != 'kudu' || (
               $.grep(self.destination.kuduPartitionColumns(), function(partition) { return partition.columns().length > 0 }).length == self.destination.kuduPartitionColumns().length && self.destination.primaryKeys().length > 0)
         );
         var validIndexFields = self.destination.outputFormat() != 'index' || ($.grep(self.destination.columns(), function(column) {