KUDU-1763. Fix Impala CREATE EXTERNAL TABLE statement As of IMPALA-3719, the CREATE EXTERNAL TABLE statement in Impala is substantially simpler. Impala now reads the schema information from Kudu, so we just need to specify the table name and master addresses, and no longer need to list the columns.
Change-Id: I0fa2e7738a2f0a8f4eefeffed189a0330b41fe1f Reviewed-on: http://gerrit.cloudera.org:8080/5249 Reviewed-by: Dan Burkert <[email protected]> Tested-by: Kudu Jenkins Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/e177ae8f Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/e177ae8f Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/e177ae8f Branch: refs/heads/master Commit: e177ae8fc7ff3aacc5993a660479a0a706a4e840 Parents: ac3cf12 Author: Todd Lipcon <[email protected]> Authored: Mon Nov 28 13:00:06 2016 -0800 Committer: Todd Lipcon <[email protected]> Committed: Mon Nov 28 23:03:36 2016 +0000 ---------------------------------------------------------------------- src/kudu/server/webui_util.cc | 64 ++------------------------------------ 1 file changed, 2 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/e177ae8f/src/kudu/server/webui_util.cc ---------------------------------------------------------------------- diff --git a/src/kudu/server/webui_util.cc b/src/kudu/server/webui_util.cc index 6e3ca4f..01b7f92 100644 --- a/src/kudu/server/webui_util.cc +++ b/src/kudu/server/webui_util.cc @@ -74,72 +74,12 @@ void HtmlOutputImpalaSchema(const std::string& table_name, // Escape table and column names with ` to avoid conflicts with Impala reserved words. *output << "CREATE EXTERNAL TABLE " << EscapeForHtmlToString("`" + table_name + "`") - << " (\n"; - - vector<string> key_columns; - - for (int i = 0; i < schema.num_columns(); i++) { - const ColumnSchema& col = schema.column(i); - - *output << EscapeForHtmlToString("`" + col.name() + "`") << " "; - switch (col.type_info()->type()) { - case STRING: - *output << "STRING"; - break; - case BINARY: - *output << "BINARY"; - break; - case UINT8: - case INT8: - *output << "TINYINT"; - break; - case UINT16: - case INT16: - *output << "SMALLINT"; - break; - case UINT32: - case INT32: - *output << "INT"; - break; - case UINT64: - case INT64: - *output << "BIGINT"; - break; - case UNIXTIME_MICROS: - *output << "INT64"; - break; - case FLOAT: - *output << "FLOAT"; - break; - case DOUBLE: - *output << "DOUBLE"; - break; - case BOOL: - *output << "BOOLEAN"; - break; - default: - *output << "[unsupported type " << col.type_info()->name() << "!]"; - break; - } - if (i < schema.num_columns() - 1) { - *output << ","; - } - *output << "\n"; - - if (schema.is_key_column(i)) { - key_columns.push_back(col.name()); - } - } - *output << ")\n"; - + << " STORED AS KUDU\n"; *output << "TBLPROPERTIES(\n"; - *output << " 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',\n"; *output << " 'kudu.table_name' = '"; *output << EscapeForHtmlToString(table_name) << "',\n"; *output << " 'kudu.master_addresses' = '"; - *output << EscapeForHtmlToString(master_addresses) << "',\n"; - *output << " 'kudu.key_columns' = '"; - *output << EscapeForHtmlToString(JoinElements(key_columns, ", ")) << "'\n"; + *output << EscapeForHtmlToString(master_addresses) << "'"; *output << ");\n"; *output << "</code></pre>\n"; }
