# 配置输入数据

tFileInputDelimited 组件配置为将数据从 DBFS 加载到作业中。

## 开始之前

* 源文件 movies.csv 和 directors.txt 已如 [将文件上传到 DBFS (Databricks 文件系统)](https://help.qlik.com/talend/en-US/studio-getting-started-guide-data-fabric/7.3/uploading-files-to-dbfs-databricks-file-system) 中所述上传到 DBFS。

* movie.csv 文件的元数据已在 Repository (存储库) 中 File delimited (分隔文件) 节点下设置。

  如果尚未执行此操作，请参阅[准备影片元数据](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-data-fabric/7.3/preparing-movies-metadata)以创建元数据。

## 步骤

1. 展开 Repository (存储库) 中 Metadata (元数据) 节点下的 File delimited (分隔文件)，然后展开 movies (影片) 文件连接节点及其子节点，以显示 movies (影片) schema 元数据节点。
2. 双击该 schema 元数据节点，打开其向导。

   ![](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-big-data-platform/Resources/images/getting_started-export_schema.png)
3. 单击 ![](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-big-data-platform/Resources/images/export.png) 按钮，将 schema 导出到本地目录。
4. 双击 movie (影片) tFileInputDelimited 组件打开其 Component (组件) 视图。

   ![](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-big-data-platform/Resources/images/getting_started-read_from_dbfs.png)
5. 确保清除 Define a storage configuration component (定义存储配置组件) 复选框。这让该组件可以直接从 Spark 集群的文件系统 (稍后在 Spark configuration (Spark 配置) 选项卡中进行定义) 读取数据，；在此场景中，此文件系统是 DBFS。
6. 单击 Edit schema (编辑 schema) 以打开 schema 编辑器，然后单击 ![](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-big-data-platform/Resources/images/import.png) 按钮以导入之前从 Repository (存储库) 的 File delimited (分隔文件) 元数据中导出的影片 schema。
7. 在 Folder/File (文件夹/文件) 字段中，输入指向存储在 DBFS 中的影片数据的路径。
8. 在 Header (文件头) 字段中，输入 1，不带引号。这让组件可以将数据的第一行识别为数据头。
9. 双击 director (导演) tFileInputDelimited 组件打开其 Component (组件) 视图。

   ![](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-big-data-platform/Resources/images/getting_started-read_director_from_dbfs.png)
10. 出于与之前步骤中所述相同的原因，确保清除 Define a storage configuration component (定义存储配置组件) 复选框。
11. 单击 Edit schema (编辑 schema) 旁边的 [...] 按钮打开 schema 编辑器。
12. 单击 [+] 按钮两次添加两行，并在 Column (列) 列中，将其分别重命名为 ID 和 Name (名称)。

    ![](https://help.qlik.com/talend/zh-CN/studio-getting-started-guide-big-data-platform/Resources/images/gs-bd-use_case-pig_job-tpigload_director_schema.png)
13. 在弹出对话框单击 OK (确定) 以确认这些更改并接受此Schema向后续组件的传播。
14. 在 Folder/File (文件夹/文件) 字段中，输入导演数据存储目录。如[将文件上传到 DBFS (Databricks 文件系统)](https://help.qlik.com/talend/en-US/studio-getting-started-guide-data-fabric/7.3/uploading-files-to-dbfs-databricks-file-system)中所述，这些数据已经写入到 /FileStore/ychen/movie\_library/directors.txt。
15. 在 Field separator (字段分隔符) 字段中，输入逗号 (,)，因为这是导演数据使用的分隔符。

## 结果

输入组件现在即会配置为将影片数据和导演数据加载到作业。