# 表格是

對於 Excel、XML、Parquet 或 JSON 檔案，您可以在表格格式規範中指定正在從中載入資料的表格。

語法：

Table is table name

引數：

引數

| 引數 | 描述 |
| --- | --- |
| table name | 指定表格名稱。值取決於表格格式：<br><br><ul> <li> <p>Excel：工作表名稱。</p> </li> <li> <p>XML：指定要載入的部分 XML 的路徑。</p> </li> <li> <p>Parquet：指定表格的路徑，具有格式 <span>&lt;node&gt;.&lt;node&gt;.&lt;node&gt;</span>。 </p> <p>在巢狀結構內指定表格時使用 <span>Table  is</span>。</p> <p>例如，您有下列結構描述的 Parquet 資料：</p> <pre><code>Schema:Field(name: "Name", datatype: String),Field(name: "Age", datatype: Float),Field(name: "Phone", datatype: List(	Field(name: "Item", datatype: Struct[    	Field(name: "Number", datatype: String)</code></pre> <p>您可以使用引數 <code>Table is [Schema:Phone.Item]</code> 載入電話及其巢狀欄位作為表格。這將會透過表格產生索引鍵欄位 <span>%Key_Phone</span>。</p> </li> <li> <p>JSON：在有陣列的 JSON 檔案中，子表格迭代器的路徑。</p> <p>您可以指定<span>所有表格</span>而不是<span>表格是</span>，以載入所有表格。例如︰</p> <pre><code>LOAD&nbsp;*&nbsp;FROM&nbsp;[lib://DataFiles/Sales.json] (json, all tables);</code></pre> <p>如果您的資料包含多個內容相同的陣列，請在子表格 LOAD 陳述式中使用關鍵字 <span>DISTINCT</span>。例如︰</p> <pre><code>LOAD&nbsp;DISTINCT&nbsp;*&nbsp;FROM [lib://DataFiles/Sales.json] (json, all tables);</code></pre> </li> </ul> |

範例： Excel

LOAD "Item Number", "Product Group", "Product Line", "Product Sub Group", "Product Type" FROM [lib://AttachedFiles/Item master.xlsx] (ooxml, embedded labels, table is [Item master]);

範例： XML

LOAD city%Table, %Key\_row\_7FAC1F878EC01ECB FROM [lib://AttachedFiles/cities.xml] (XmlSimple, table is [root/row/country/city]);

範例： Parquet

檔案 company.parquet 包含下列結構描述：

company (String) contact (String) company:salesrep (List) salesrep (Group) salesrep (String) company:headquarter (List) headquarter (Group) country (String) city (String) city:region (List) region (Group) region (String)

以下會將內容從檔案載入到表格中。第一個 LOAD 陳述式載入根群組。第二個 LOAD 陳述式載入 salesrep 群組的內容作為表格。第三個載入 headquarter 群組作為表格。第四個載入 region 群組作為表格。

LOAD \* FROM […] (parquet); LOAD \* FROM […] (parquet, table is [company:salesrep.salesrep]); LOAD \* FROM […] (parquet, table is [company:headquarter.headquarter] LOAD \* FROM […] (parquet, table is [company:headquarter.headquarter.city:region.region]

範例： JSON

LOAD customers.customerid, customers.companyname, customers.contactname, customers.contacttitle, customers.address, customers.city, customers.postalcode, customers.country, customers.phone, customers.fax, %Key\_customers, customers.region FROM [lib://DataFiles/example.json] (json, table is [/\*/customers]);

限制：

Table is 規範只與 Excel、XML、Parquet、JSON 檔案有關。