This topic describes how to develop a Java program by using MaxCompute Studio and describes related directories.
Procedure
-
Develop a Java program based on one of the following development paths:
-
Package the Java program, upload the JAR package, and register a function.
Module directory
MaxCompute Studio automatically creates a module directory when you create a MaxCompute Java module. The directory contains three subdirectories:
-
examples: Sample code for unit testing. Reference this code when writing test scripts.
-
src/main/java: Source code for Java program development.
-
warehouse: Schemas and data for MaxCompute project tables and resources.
Warehouse directory
The warehouse directory stores the schemas and data of tables and resources for MaxCompute projects. These tables and resources are used when executing user-defined functions (UDFs) or MapReduce tasks.
Directory structure
The warehouse directory has three levels:
-
Level 1: Named by project name.
-
Level 2: Contains two subdirectories —
_resources_and_tables_. -
Level 3 (under
_tables_): Named by table name. Each table directory contains a_schema_file and one or more data files.
Schema file
In a schema file, configure the project name, table name, and the name and data type of each column. Separate each column name and data type with a colon (:).
If the table is partitioned, specify the partition key columns. In the example shown above, wc_in1 is a non-partitioned table and wc_in2 is a partitioned table.
Data file
Data files use CSV format with UTF-8 encoding. The column delimiter is a comma (,) and the row delimiter is \n or \r\n.
Only three special characters are supported: commas (,), double quotation marks ("), and line breaks (\n or \r\n). Use the following escaping rules:
| Value contains | Write as | Example |
|---|---|---|
Comma (,) |
Enclose the value in double quotation marks | 3,No → "3,No" |
Double quotation mark (") |
Escape each " with a pair of double quotation marks |
a"b"c → "a""b""c" |
| NULL value | \N |
— |
| NULL value in a STRING column | """\N""" |
— |