Browse Source

HUE-5992 [metastore] Kudu manual table creation with comment fails

Romain Rigaux 8 năm trước cách đây
mục cha
commit
ae3b92d929

+ 2 - 1
desktop/libs/indexer/src/indexer/api3.py

@@ -340,7 +340,7 @@ def _create_table_from_a_file(request, source, destination):
       }
     else:
       columns_list = ['*']
-    sql += '''\n\nCREATE TABLE `%(database)s`.`%(final_table_name)s`
+    sql += '''\n\nCREATE TABLE `%(database)s`.`%(final_table_name)s`%(comment)s
       %(extra_create_properties)s
       AS SELECT %(columns_list)s
       FROM `%(database)s`.`%(table_name)s`;''' % {
@@ -349,6 +349,7 @@ def _create_table_from_a_file(request, source, destination):
         'table_name': table_name,
         'extra_create_properties': extra_create_properties,
         'columns_list': ', '.join(columns_list),
+        'comment': ' COMMENT "%s"' % comment if comment else ''
     }
     sql += '\n\nDROP TABLE IF EXISTS `%(database)s`.`%(table_name)s`;\n' % {
         'database': database,

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/libs/indexer/src/indexer/create_table_tests.py


+ 3 - 3
desktop/libs/indexer/src/indexer/templates/gen/create_table_statement.mako

@@ -84,15 +84,15 @@ EXTERNAL \
 % endif
 TABLE ${ '`%s`.`%s`' % (database, table["name"]) | n }
 ${ column_list(table, columns) | n } \
-% if table["comment"]:
-COMMENT "${table["comment"] | n }"
-% endif
 % if partition_columns and table.get('file_format') != 'kudu':
 PARTITIONED BY ${ column_list(table, partition_columns) | n }
 % endif
 % if kudu_partition_columns  and table.get('file_format') == 'kudu':
 PARTITION BY ${ ', '.join([kudu_partition(partition) for partition in kudu_partition_columns]) | n }
 % endif
+% if table["comment"]:
+COMMENT "${table["comment"] | n }"
+% endif
 ## TODO: CLUSTERED BY here
 ## TODO: SORTED BY...INTO...BUCKETS here
 % if table.get('row_format'):

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác