×
Community Blog MaxCompute Java SDK Development Guide

MaxCompute Java SDK Development Guide

In this article, we will introduce MaxCompute's Java SDK to help developers in their daily coding and development work.

By Sixiang

Background

This document is used to assist MaxCompute developers in daily coding using Java SDK.

1. MaxCompute Java SDK

This topic describes the commonly used core APIs of MaxCompute. For more information about the SDK, see SDK Java Doc.

1

1.1 ODPS

The entry-point for the MaxCompute SDK. You can use this class to obtain all object sets in the project, including:

Projects, tables, resources, functions, and instances.

You can pass this class into the AliyunAccount instance to construct a MaxCompute object. Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

odps.setDefaultProject("my_project");

for (Table t : odps.tables()) {

....

}

1.2 Projects

A set of projects in MaxCompute. The element in the set is project. Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps  odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

Project p = odps.projects().get("my_exists");

p.reload();

Map<String, String> properties = prj.getProperties();

...

1.3 SQL Task

SQL Task is the interface where the SDK calls MaxCompute SQL directly, you can easily run SQL and get its returned results.

As shown in the document, "SQLTask.getResult(i);" returns a list. You can iterate the list to obtain the complete SQL computing result. However, this method has a defect. See the "SetProject READ_TABLE_MAX_ROW" function mentioned here.

Currently, you can adjust the maximum number of data records that the SELECT statement returns to the client up to 10,000. If you run the SELECT statement on a client or use SQL Task, the query results are appended with Limit N. Limit N does not apply to the CREATE TABLE XX AS SELECT statement or in the case that the results are solidified in a specific table through INSERT INTO/OVERWRITE TABLE.

The following code is for running and processing SQL tasks. You can use "SQLTask.run" to run SQL tasks.

The "run" API returns instance which gets the SQL running status and results.

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String  odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

Instance instance = SQLTask.run(odps, "my_project", "select ...") ;

String id = instance.getId();

instance.waitforsuccess();

Set<String> taskNames = instance.getTaskNames();

for (String name : taskNames) {

TaskSummary summary = instance.getTaskSummary(name);

String s = summary.getSummaryText();

}

Map<String, String> results = instance.getTaskResults();

Map<String, TaskStatus> taskStatus = instance.getTaskStatus();

for (Entry<String, TaskStatus> status : taskStatus.entrySet()) {

String result = results.get(status.getKey());

}

Note: To create a table, you must use the SQLTask API instead of the Table API. You must pass the CREATE

TABLE statement into SQLTask.

1.4 Instances

A set of all instances in MaxCompute.

The element in the set is Instance. Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

odps.setDefaultProject("my_project");

for (Instance i : odps.instances ()) {

....

}

A description of instance. You can obtain a list of instances through "Instances".

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps (account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

Instance ins = odps.instances().get("instance id");

Date startTime = instance.getStartTime();

Date endTime = instance.getEndTime();

...

Status instanceStatus = instance.getStatus();

String instanceStatusStr = null;

if (instanceStatus == Status.TERMINATED) {

instanceStatusStr = TaskStatus.Status.SUCCESS.toString();

Map<String, TaskStatus> taskStatus = instance.getTaskStatus();

for (Entry<String, TaskStatus> status : taskStatus.entrySet()) {

if (status.getValue().getStatus() ! = TaskStatus.Status.SUCCESS) {

instanceStatusStr = status.getValue().getStatus().toString();

break;

}

}

} else {

instanceStatusStr = instanceStatus.toString();

}

...

TaskSummary summary = instance.getTaskSummary("instance name");

String s = summary.getSummaryText();

1.5 Tables

A set of all tables in MaxCompute. The element in the set is Table.

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

odps.setDefaultProject("my_project");

for (Table t : odps.tables()) {

....

}

A description of table information. You can obtain a list of tables through Tables.

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

Table t = odps.tables().get("table name");

t.reload();

Partition part = t.getPartition(new PartitionSpec(tableSpec[1]));

part.reload();

...

1.6 Resources

A set of all resources in MaxCompute. The element in the set is Resource.

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

odps.setDefaultProject("my_project");

for (Resource r : odps.resources()) {

....

}

A description of resource. You can obtain a list of resources through "Resources".

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

Resource r = odps.resources().get("resource name");

r.reload();

if (r.getType() == Resource.Type.TABLE) {

TableResource tr = new TableResource(r);

String tableSource = tr.getSourceTable().getProject() + "." + tr.

getSourceTable().getName();

if (tr.getSourceTablePartition() ! = null) {

tableSource += " partition(" + tr.getSourceTablePartition().toString() + ")";

}

....

}

The following sample code shows how to create a file resource:


String projectName = "my_porject";

String source = "my_local_file.txt";

File file = new File(source);

InputStream is = new FileInputStream(file);

FileResource resource = new FileResource();

String name = file.getName();

resource.setName(name);

odps.resources().create(projectName, resource, is);

The following sample code shows how to create a table resource:


TableResource resource = new TableResource(tableName, tablePrj,partitionSpec);

resource.setName("table_resource_name");

odps.resources().update(projectName, resource);

1.7 Functions

A set of all functions in MaxCompute. The element in the set is Function.

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

odps.setDefaultProject("my_project");

for (Function f : odps.functions()) {

....

}

A description of function. You can obtain a list of functions through "Functions".

Sample code:


Account account = new AliyunAccount("my_access_id", "my_access_key");

Odps odps = new Odps(account);

String odpsUrl = "<your odps endpoint>";

odps.setEndpoint(odpsUrl);

Function f = odps.functions().get("function name");

List<Resource> resources = f.getResources();

The following sample code shows how to create a function:


String resources = "xxx:xxx";

String classType = "com.aliyun.odps.mapred.open.example.WordCount";

ArrayList<String> resourceList = new ArrayList<String>();

for (String r : resources.split(":")) {

resourceList.add(r);

}

Function func = new Function();

func.setName(name);

func.setClassType(classType);

func.setResources(resourceList);

odps.functions().create(projectName, func);

1.8 Tunnel

If the query result to be exported is all the content of a table or a specific partition, you can use SDK Tunnel.

Sample code:


package daniel.sixiang;

import java.io.IOException;

import java.util.List;

import org.apache.commons.lang3. StringUtils;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import com.aliyun.odps.Column;

import com.aliyun.odps.Odps;

import com.aliyun.odps.PartitionSpec;

import com.aliyun.odps.TableSchema;

import com.aliyun.odps.account.Account;

import com.aliyun.odps.account.AliyunAccount;

import com.aliyun.odps.data.Record;

import com.aliyun.odps.data.RecordReader;

import com.aliyun.odps.tunnel.TableTunnel;

import com.aliyun.odps.tunnel.TableTunnel.DownloadSession;

import com.aliyun.odps.tunnel.TunnelException;

import com.google.common.collect.Lists;

public class ChimaeraCustomerODPSUtils {

private static Log logger = LogFactory.getLog(ChimaeraCustomerODPSUtils.class);

private String partition;

private static final String ACCESS_ID = "---";

private static final String ACCESS_KEY = "---";

private static final String project = "---";

private static final String table = "---";

private static final String FIELD_admin_mbr_seq = "---";

private static final String FIELD_state = "---";

private static final String FIELD_level = "---";

private static final String FIELD_org_level = "---";

private static final String FIELD_identity = "---";

private static String ODPS_URL = "---";

private static String TUNNEL_URL = "---";

public static void main(String[] args) {

ChimaeraCustomerODPSUtils customerODPSUtils = new ChimaeraCustomerODPSUtils("20190115");

System.out.println(customerODPSUtils.getCustomerFromODPS(1L, 10));

}

public ChimaeraCustomerODPSUtils(String dString) {

this.partition = "ds =" + dString;

}

public List<CustomerOdpsDTO> getCustomerFromODPS(Long start, int pageSize) {

List<CustomerOdpsDTO> custList = Lists.newArrayListWithExpectedSize(pageSize);

Account account = new AliyunAccount(ACCESS_ID, ACCESS_KEY);

Odps odps = new Odps(account);

odps.setEndpoint(ODPS_URL);

odps.setDefaultProject(project);

TableTunnel tunnel = new TableTunnel(odps);

tunnel.setEndpoint(TUNNEL_URL);

RecordReader recordReader = null;

try {

DownloadSession downloadSession;

PartitionSpec partitionSpec = new PartitionSpec(partition);

downloadSession = tunnel.createDownloadSession(project, table, partitionSpec);

long count = downloadSession.getRecordCount();

logger.warn("Session Status is : " + downloadSession.getStatus().toString());

if (count ! = 0) {

recordReader = downloadSession.openRecordReader(start, pageSize);

Record record;

while ((record = recordReader.read()) ! = null) {

CustomerOdpsDTO cust = buildCustomer(record, downloadSession.getSchema());

if (cust ! = null) {

custList.add(cust);

}

}

}

} catch (Exception e) {

logger.error("error ", e);

} finally {

if (recordReader ! = null) {

try {

recordReader.close();

} catch (IOException e) {

logger.error("odps_record_reader close error, e=", e);

}

}

}

return custList;

}

private CustomerOdpsDTO buildCustomer(Record record, TableSchema schema) {

CustomerOdpsDTO cust = new CustomerOdpsDTO();

for (int i = 0; i < schema.getColumns().size(); i++) {

Column column = schema.getColumn(i);

try {

if (StringUtils.equalsIgnoreCase(column.getName(), FIELD_admin_mbr_seq)) {

cust.setAliMemberId(record.getString(i));

} else if (StringUtils.equalsIgnoreCase(column.getName(), FIELD_state)) {

cust.setOper(record.getString(i));

} else if (StringUtils.equalsIgnoreCase(column.getName(), FIELD_level)) {

cust.setNewLevel(record.getString(i));

} else if (StringUtils.equalsIgnoreCase(column.getName(), FIELD_org_level)) {

cust.setOrgLevel(record.getString(i));

} else if (StringUtils.equalsIgnoreCase(column.getName(), FIELD_identity)) {

cust.setIdentity(record.getString(i));

}

} catch (Exception e) {

logger.error("read from column exception.", e);

return null;

}

}

return cust;

}

public Long getCustCountFromODPS() {

Account account = new AliyunAccount(ACCESS_ID, ACCESS_KEY);

Odps odps = new Odps(account);

odps.setEndpoint(ODPS_URL);

odps.setDefaultProject(project);

TableTunnel tunnel = new TableTunnel(odps);

tunnel.setEndpoint(TUNNEL_URL);

DownloadSession downloadSession;

try {

PartitionSpec partitionSpec = new PartitionSpec(partition);

downloadSession = tunnel.createDownloadSession(project, table, partitionSpec);

return downloadSession.getRecordCount();

} catch (TunnelException e) {

logger.error("TunnelException ,partition = " + partition, e);

return 0L;

} finally {

}

}

}

package daniel.sixiang;

import java.io.Serializable;

public class CustomerOdpsDTO implements Serializable {

private static final long serialVersionUID = -9075685189945269963L;

private String aliMemberId;

private String oper;

private String newLevel;

private String orgLevel;

private String identity;

public String getAliMemberId() {

return aliMemberId;

}

public void setAliMemberId(String aliMemberId) {

this.aliMemberId = aliMemberId;

}

public String getOper() {

return oper;

}

public void setOper(String oper) {

this.oper = oper;

}

public String getNewLevel() {

return newLevel;

}

public void setNewLevel(String newLevel) {

this.newLevel = newLevel;

}

public String getOrgLevel() {

return orgLevel;

}

public void setOrgLevel(String orgLevel) {

this.orgLevel = orgLevel;

}

public String getIdentity() {

return identity;

}

public void setIdentity(String identity) {

this.identity = identity;

}

@Override

public String toString() {

return "CustomerOdpsDTO [aliMemberId=" + aliMemberId + ", oper=" + oper + ", newLevel=" + newLevel

+ ", orgLevel=" + orgLevel + ", identity=" + identity + "]";

}

}

2. MaxCompute Java SDK Tips

2.1 How to use the SDK to run security-related commands

You may have used security-related commands in MaxCompute Console. The official documents contain detailed MaxCompute Security Guide, and provide Security Statement Summary.

In short, privilege management, column level access control, project security configuration, and cross-project resource sharing all belong to the scope of MaxCompute security commands.

More particularly, the commands starting with the following keywords are MaxCompute security-related commands:


GRANT/REVOKE ...

SHOW  GRANTS/ACL/PACKAGE/LABEL/ROLE/PRINCIPALS

SHOW  PRIV/PRIVILEGES

LIST/ADD/REOVE  USERS/ROLES/TRUSTEDPROJECTS

DROP/CREATE  ROLE

CLEAR EXPIRED  GRANTS

DESC/DESCRIBE  ROLE/PACKAGE

CREATE/DELETE/DROP  PACKAGE

ADD ... TO  PACKAGE

REMOVE ... FROM  PACKAGE

ALLOW/DISALLOW  PROJECT

INSTALL/UNINSTALL  PACKAGE

LIST/ADD/REMOVE  ACCOUNTPROVIDERS

SET  LABLE  ...

These commands can be executed on the MaxCompute console, but how can I use the MaxCompute Java SDK to execute these commands? Are they executed in the same way as SQL by creating instances?

The answer is No. These commands are not SQL statements and cannot be executed through SQL tasks.

You need to use the API "SecurityManager.runQuery()" to execute these commands. For detailed SDK Java Doc, see

The SecurityManager class is in odps-sdk-core. Therefore, add the dependency when using the class:


<dependency>

<groupId>com.aliyun.odps</groupId>

<artifactId>odps-sdk-core</artifactId>

<version>0.29.11-oversea-public</version>

</dependency>

The following example shows how to set the access level of the test_label column to 2 through MaxCompute Java SDK, that is, the command: SET LABEL 2 TO TABLE test_label(key, value);


import com.aliyun.odps.Column;

import com.aliyun.odps.Odps;

import com.aliyun.odps.OdpsException;

import com.aliyun.odps.OdpsType;

import com.aliyun.odps.TableSchema;

import com.aliyun.odps.account.Account;

import com.aliyun.odps.account.AliyunAccount;

import com.aliyun.odps.security.SecurityManager;

public class test {

public static void main(String [] args) throws OdpsException {

try {

// init odps

Account account = new AliyunAccount("<your_accessid>", "<your_accesskey>");

Odps odps = new Odps(account);

odps.setEndpoint("http://service-corp.odps.aliyun-inc.com/api");

odps.setDefaultProject("<your_project>");

// create test table

// if you already have a table, skip this

TableSchema schema = new TableSchema();

schema.addColumn(new Column("key", OdpsType.STRING));

schema.addColumn(new Column("value", OdpsType.BIGINT));

odps.tables().create("test_label", schema);

// set label 2 to table columns

SecurityManager securityManager = odps.projects().get().getSecurityManager();

String res = securityManager.runQuery("SET LABEL 2 TO TABLE test_label(key, value);", false);

System.out.println(res);

} catch (OdpsException e) {

e.printStackTrace();

}

}

}

Running result:

2

After the program ends, run the 'desc test_lable;' command on the MaxCompute Console. You can see that the set label has taken effect.

3

Other security-related commands can be executed through MaxCompute Java SDK in the same manner.

2.2 How to use the SDK to generate instance logview

Scenario

A: "Why is MaxCompute Java SDK unresponsive when running a task?"

Me: "Is there a logview? Let me see it."

A: "No, I'm using the SDK, and there is no logview."

User A's problem is that there is no logview of the instance, and the running process for the instance cannot be tracked.

Generally, after creating an instance, the user calls the "instance.waitForSuccess()" and waits for the task to finish. If the task takes a long time, the program will be suspended at this step. In this case, if there is a logview, the user can troubleshoot the cause of the task suspension.

How can I use MaxCompute Java SDK to generate the instance logview?

It is easy. The MaxCompute Java SDK provides the logview API. For more information, see SDK Java Doc


RunningJob rj = JobClient.runJob(job);

com.aliyun.odps.Instance instance = SessionState.get().getOdps().instances().get(rj.getInstanceID());

String logview = SessionState.get().getOdps().logview().generateLogView(instance, 7 * 24);

System.out.println(logview);

There are two parameters: instance object and logview token timeout (unit: hour)

Note: When using the SDK, please record the logview for each instance, so that any problems encountered can be quickly tracked.

If it is difficult to change the code, the you can also get the logview by using the "wait" command in the MaxCompute Console.

2.3 How to use the SDK to output error logs

Scenario

B: "Why is MaxCompute Java SDK unresponsive when it is used to access a table?"

Me: "Which line is it stuck on?"

B: "RestClient retry."

The user B's problem with user B is that RestClient of the SDK has a retry mechanism. That is why it seems unresponsive.

If an error is output for each retry, you can quickly locate the problem. I have encountered several public cloud users experiencing unresponsiveness for a few minutes due to lack of packages before exceptions are thrown. This seriously impacts work efficiency.

Is it possible to output the error for each retry?

Of course. MaxCompute Java SDK provides the abstract class RetryLogger. For details, see SDK Java Doc.


public static abstract class RetryLogger {

/**

* The callback function before RestClent retries

*

* @param e

* Error

* @param retryCount

* Retry count

* @param retrySleepTime

* Retry sleep time

*/

public abstract void onRetryLog(Throwable e, long retryCount, long retrySleepTime);

}

You only need to implement a RetryLogger subclass, and output the log through "odps.getRestClient().setRetryLogger(new UserRetryLogger());" when initializing the ODPS object.

A typical implementation is as follows:


// init odps

odps.getRestClient().setRetryLogger(new UserRetryLogger());

// your retry logger

public class UserRetryLogger extends RetryLogger {

@Override

public void onRetryLog(Throwable e, long retryCount, long sleepTime) {

if (e ! = null && e instanceof OdpsException) {

String requestId = ((OdpsException) e).getRequestId();

if (requestId ! = null) {

System.err.println(String.format(

"Warning: ODPS request failed, requestID:%s, retryCount:%d, will retry in %d seconds.",

requestId, retryCount, sleepTime));

return;

}

}

System.err.println(String.format(

"Warning: ODPS request failed:%s, retryCount:%d, will retry in %d seconds.", e.getMessage(),retryCount,

sleepTime));

}

}

2.4 How to set SQL parameters

When submitting SQL statements using DataWorks or MaxCompute Console, you often need to set some flags, for example:


set odps.sql.type.system.odps2=true;

So how do you set flags when submitting SQL statements using SDK?

Note that when you submit an SQL statement using SDK, placing "set" directly in the SQL query statement will not take effect and an error will occurs.

Take Java SDK as an example:


// Construct a SQLTask object

SQLTask task = new SQLTask();

task.setName("foobar");

task.setQuery("select ...") ;

// Set flags

Map<String, String> settings = new HashMap<>();

settings.put("odps.sql.type.system.odps2", "true");

...  // set other flags

task.setProperty("settings", new JSONObject(settings).toString());  // This is a key step: set the JSON strings corresponding to the settings properties

// Execute

Instance instance = odps.instances().create(task);

2.5 How to submit multiple SQL statements using SDK

As we know, a node in DataWorks can contain multiple SQL statements, while the MaxCompute Console can also submit a file containing multiple statements through "odpscmd -f". In fact, all these methods preprocess and split the file into multiple statements by semicolons and then execute them one by one.

This splitting process is performed by the MaxCompute Console. If you submit a task through the SDK, you need to manually split statements.

One SQL statement is submitted at one time. If multiple SQL statements are submitted at one time, an error will occur.

Does MaxCompute support submitting multiple SQL statements at one time? Yes, because we provide script mode.

In script mode, all SQL statements are submitted executed at one time. Note that in script mode, different statements are related and are executed as a whole. This is completely different from that in MaxCompute Console. Some restrictions will also be introduced. For example, there can be only one "create table as" statement, and "settings" and "ddl" must be placed at the beginning. If this condition cannot be met, you still need to split statements and submit.

In script mode, normal scripts often involve association between multiple statements (for example, the definition and reference of table variables are in different SQL statements ). In this case, you cannot split SQL statements for execution, because the statement defining a variable is executed first, and has a different context from that of the statement referencing the variable. An error "Variable XX cannot be resolved" will be reported. At this time, if you submit the query using another client, you also need to submit it in script mode.

  1. The query submitted through the "-f" parameter on the MaxCompute Console splits the script into statements. If you want to submit the query in script mode, you need to use the "-s" parameter, for example, "odpscmd -s foo.sql". Note: Currently, a query of script mode cannot be submitted in interactive mode of MaxCompute Console.
  2. In DataWorks, tasks submitted using the "ODPS SQL" node are executed one statement after another. In script mode, select the "ODPS Script" type when creating a node.
  3. MaxCompute Studio has powerful support for script mode and is strongly recommended.

2.6 How to export massive data using SQLTask and Tunnel

SQLTask cannot process more than 10 thousand records, while Tunnel can. You can use them in combination to export massive data.

The following code is an example:


private static final String accessId = "userAccessId";

private static final String accessKey = "userAccessKey";

private static final String endPoint = "http://service.odps.aliyun.com/api";

private static final String project = "userProject";

private static final String sql = "userSQL";

private static final String table = "Tmp_"+UUID.randomUUID().toString().replace("-", "_");// A random string is used as the name of the temporary table

private static final Odps odps = getOdps();

public static void main(String[] args) {

System.out.println(table);

runSql();

tunnel();

}

/*

* Download the results returned by SQL Task.

* */

private static void tunnel() {

TableTunnel tunnel = new TableTunnel(odps);

try {

DownloadSession downloadSession = tunnel.createDownloadSession(

project, table);

System.out.println("Session Status is : "

+ downloadSession.getStatus().toString());

long count = downloadSession.getRecordCount();

System.out.println("RecordCount is: " + count);

RecordReader recordReader = downloadSession.openRecordReader(0,

count);

Record record;

while ((record = recordReader.read()) ! = null) {

consumeRecord(record, downloadSession.getSchema());

}

recordReader.close();

} catch (TunnelException e) {

e.printStackTrace();

} catch (IOException e1) {

e1.printStackTrace();

}

}

/*

* Save the data record.

* If the data volume is small, you can print and copy the data directly.  In practice, you can use Java.io to write the data to a local file or a remote data storage.

* */

private static void consumeRecord(Record record, TableSchema schema) {

System.out.println(record.getString("username")+","+record.getBigint("cnt"));

}

/*

* Run an SQL statement to save the query results to a temporary table. The saved results can be downloaded using Tunnel.

* The lifecycle of the saved data is 1 day. The data does not occupy much storage space even when an error occurs while you delete the data.

* */

private static void runSql() {

Instance i;

StringBuilder sb = new StringBuilder("Create Table ").append(table)

.append(" lifecycle 1 as ").append(sql);

try {

System.out.println(sb.toString());

i = SQLTask.run(getOdps(), sb.toString());

i.waitForSuccess();

} catch (OdpsException e) {

e.printStackTrace();

}

}

/*

* Initialize MaxCompute connection information

* */

private static Odps getOdps() {

Account account = new AliyunAccount(accessId, accessKey);

Odps odps = new Odps(account);

odps.setEndpoint(endPoint);

odps.setDefaultProject(project);

return odps;
0 0 0
Share on

Alibaba Cloud MaxCompute

137 posts | 20 followers

You may also like

Comments

Alibaba Cloud MaxCompute

137 posts | 20 followers

Related Products