This topic describes how to create an E-MapReduce table.
- An E-MapReduce engine is bound to the required workspace. The E-MapReduce service is displayed in the workspace only after you add the E-MapReduce engine on the Workspace Management page. For more information, see Configure a workspace.
- E-MapReduce metadata is collected in the DataMap service so that you can select the required E-MapReduce database when you create a table. For more information, see Collect metadata from an E-MapReduce data store.
- Go to the DataStudio page.
- Log on to the DataWorks console.
- In the left-side navigation pane, click Workspaces.
- In the top navigation bar, select the region where your workspace resides, find the workspace, and then click Data Analytics in the Actions column.
- Move the pointer over the icon and choose
. Alternatively, you can find the required workflow, right-click EMR, and then choose .
- In the Create Table dialog box, set the parameters as required.
Parameter Description Please select an Engine type The default value is EMR, which cannot be modified. Table Name The name of the E-MapReduce table. Engine Instance Select a required engine instance from the drop-down list. Database Select the database where the engine instance resides from the drop-down list.Note You must collect metadata before you can select a database.
- Click Commit. The table configuration tab appears.
The upper part of the tab shows the configurations that you specified in the Create Table dialog box. You can modify the database where the E-MapReduce engine instance resides. To create a database, click New Database. In the New Database dialog box, set the parameters as required and click OK.
- In the General section, set the parameters as required.
Name Description Level 1 Folder The name of the level-1 folder where the table resides.Note Level-1 and level-2 folders show the table locations in DataWorks for you to manage tables more conveniently. Level 2 Folder The name of the level-2 folder where the table resides. Create Folder Click Create Folder to go to the Folder Management tab. On this tab, you can create level-1 and level-2 folders. Refresh After you create a folder, click Refresh. Description The description of the table.
- In the Physical Model section, set the parameters as required.
Parameter Description Table Level Select the appropriate level and category from the drop-down list. To add levels and categories, contact the workspace administrator to click Create Level to go to the Level Management tab. After you create levels and categories, click Refresh. Categories Partitioning Valid values: Partitioned Table and Non-Partitioned Table. Table Type Valid values: Internal Table and External Table.
- In the Schema section, set the parameters as required.
Parameter Description Create Field To add a field, click Create Field, configure the field information, and then click the Save icon. Move Up Adjusts the field sequence of a table that has not been created. If you adjust the sequence of fields in an existing table, you are required to delete the table and create another table with the same name. These operations are forbidden in the production environment. Move Down Field Name The name of the field, which can contain letters, digits, and underscores (_). Data Type The E-MapReduce table supports the following data types: TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DECIMAL, VARCHAR, CHAR, STRING, BINARY, DATETIME, DATE, TIMESTAMP, BOOLEAN, ARRAY, MAP, and STRUCT. Definition or Maximum Value Length You must set this parameter if the data type that you specify for the field has a length limit. Description The description of the field. Primary Key Field Specifies whether the field serves as the primary key. The primary key is a business concept and ensures that a record is unique for your business. DataWorks does not impose a limit on the primary key. Edit After you save the field, you can click Edit to edit the field and then click Save. Delete Deletes a created field.Note If you delete a field from an existing table and then commit the table, you are required to delete the table and create another table with the same name. These operations are forbidden in the production environment. Add If you set the Partitioning parameter to Partitioned Table in the Physical Model section, you must configure a partition for the table.
You can add a partition to the current table. If you add a partition to an existing table, you are required to delete the table and create another table with the same name. These operations are forbidden in the production environment.
- Click the icon in the toolbar to commit the E-MapReduce table to the production environment.
If you are using a workspace in standard mode, commit the table to the development environment and the production environment in sequence.Notice You cannot create an E-MapReduce table in data definition language (DDL) mode.