在外部选择几列 table

Choosing few columns in external table

我有一个场景,其中我有一个包含 30 列的文件(驻留在 ADLS 中),但是当我创建外部 table.. 我只想选择 5 列。

我的问题是:在创建外部 table.

时是否可以 select 主动选择列

现在创建外部 table 工作..但是当我在那个分机 table 之上做 select 查询时..它抛出一个异常

HadoopExecutionException: 行中的列太多

提前致谢。

很遗憾,根据CREATE EXTERNAL TABLE (Transact-SQL),不支持创建外部表时的列选择:

The column definitions, including the data types and number of columns, must match the data in the external files. If there is a mismatch, the file rows will be rejected when querying the actual data.

希望对您有所帮助!

创建包含 5 列而不是 30 列的视图。此视图可用作外部表的源。