Managing a Source Data Schema
A source data schema is a user's JSON or CSV data sample used to describe the JSON or CSV data format. For example, DIS can generate an Avro schema based on the JSON data sample and convert the JSON data uploaded to a stream to the Parquet or CarbonData format.
Three entrances are available for creating a source data schema:
- Enable Schema when creating a stream. For details, see Figure 1.
- Keep Schema disabled when creating a stream. After the stream is created, choose Stream Management in the navigation tree and click the created stream. Click Create Source Data Schema next to Source Data Type. For details, see Figure 2.
- Keep Schema disabled when creating a stream. After the stream is created, choose Stream Management in the navigation tree and click the created stream. On the Dump Management tab page, click Create Dump Task. On the displayed page, create a source data schema. For details, see Figure 3.
Creating a Schema for Source Data by Importing Files
Use the following method to create a source data schema:
- When configuring Source Data Schema, click Import File.
- In the left text box, enter a JSON or CSV source data sample or click
to import a source data sample.
When importing source data samples, you can import only .txt, .json, .csv, and .java files.
- To delete the source data sample, click
. - In the left text box, click
to generate an Avro schema in the right text box according to the source data sample. - In the right text box, click
to modify the Avro schema. - To format the parsed data, click Format and Unformat.
Creating a Schema for Source Data by Creating a Schema Tree
Use the following method to create a source data schema:
- When configuring Source Data Schema, click Create Schema Tree.
- After configuring an attribute name and data type, click Add to add a root node, as shown in Figure 4.
- Select the created root node and configure an attribute name and data type in the same way to add subnodes. Figure 5 Creating a subnode
- To delete a node, select the check box of the node and click Delete.
- To edit the attributes of a node, select the check box of the node and click Edit.
- To delete all nodes, click Reset.
- Click Submit.
Modifying a Source Data Schema
Do not modify the source data schema of a stream if the stream has dump tasks.
- Use the account to log in to the DIS console.
- Click
in the upper left corner of the page to select a region. - In the navigation tree on the left, choose Ingestion Management > Stream Management.
- Click a stream name. The Stream Management page is displayed.
- Click View Existing Source Data Schema next to Source Data Type.
- In the Source Data Schema text box, click
to modify the source data schema. Figure 6 Modifying the source data schema
If a stream has dump tasks, modifying the source data schema of the stream will cause some data unable to be successfully dumped.
- After the modification is complete, click Submit. Click Cancel to give up modifying the source data schema.
Last Article: Changing a Source Data Type
Next Article: Managing Stream Tags




Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.