MaxCompute V2.0 allows you to use external tables to access Object Storage Service (OSS) and Tablestore. MaxCompute Studio provides code templates to help you query unstructured data. This topic describes how to use MaxCompute Studio to query unstructured data.
Write a StorageHandler, Extractor, or Outputer program
- In the Project tool window, expand your MaxCompute Java module and choose . Then, right-click java and choose .
- Specify Name, select Extractor, StorageHandler, or Outputer, and then press Enter.
- Name: the name of the MaxCompute Java class that you want to create. If no package is created, enter packagename.classname. The system automatically creates a package.
- Select Extractor, StorageHandler, or Outputer as the class type.
- After the class is created, develop a Java program in the editor. The Java template is automatically filled with framework code. You need only to compile the logic code based on your requirements.
Debug the Extractor or Outputer program
Package and upload the program
After you debug the program, compress the program into a JAR package and upload the package to the MaxCompute server as a resource. For more information, see Package, upload, and register.
Query unstructured data
- In the Project tool window, right-click scripts under your MaxCompute project and choose .
- Enter the name of an SQL script in the Script Name field, select a MaxCompute project from the MaxCompute Project drop-down list, and then click OK.
- In the editor, enter the SQL statement that is used to create an external table and click the icon.
- Create a MaxCompute SQL script, enter the following query statement, and then click
the icon to query data.