This topic describes how to develop a Java program by using MaxCompute Studio and describes related directories.
Follow these steps to develop a Java program in MaxCompute Studio:
Local module directory
MaxCompute Studio automatically creates a Maven module after you create a MaxCompute Java module. The Maven module directory includes:
- examples: stores sample code. You can reference the sample code to develop a script for unit testing.
- src/main/java: stores source code for Java program development.
- warehouse: stores the schemas and data of tables that are required to run local tasks. For more information, see Local warehouse directory.
Local warehouse directory
The local warehouse directory in MaxCompute Studio stores the schemas and data of tables and resources for MaxCompute projects. These tables and resources are used to run user-defined functions (UDFs) or MapReduce tasks. The following figure shows the warehouse directory.
- The warehouse directory contains three levels of subdirectories. Level-1 subdirectories are named by project name. Level-2 subdirectories include _resources_ and _tables_. Each level-3 subdirectory under _tables_ is named by a table name and contains the _schema_ and data files.
- In a _schema_ file, configure the project name, table name, and names and data types of columns. Separate each pair of column name and data type with a colon (;). If a partitioned table is used, you must specify partition key columns. In the preceding figure, wc_in1 is a non-partitioned table, and wc_in2 is a partitioned table.
- In a data file, table data is stored in the CSV format based on the following rules:
- Special characters include commas (,), double quotation marks ("), and line breaks
- A comma (,) is used as a column delimiter.
\r\nis used as a row delimiter.
- If a value in a column contains special characters, enclose the value in a pair of
double quotation marks ("). For example, write
- If a value in a column contains double quotation marks ("), use a pair of double quotation
marks to escape each double quotation mark ("). For example, write
\Nindicates a NULL value. For a column of the STRING data type, write
- Characters are encoded in UTF-8.
- Special characters include commas (,), double quotation marks ("), and line breaks (