【 MaxCompute FAQ】 MaxCompute Spark

【 MaxCompute FAQ】 Java SDK

【 MaxCompute FAQ】 Java SDKHow to use Logview to troubleshoot errors on the MaxCompute Java SDK ? MaxCompute Java SDK provides Logview interface i = SQLTask.run ( odps , sql ); String logview = odps.logview ( ). generateLogView ( i , 7 * 24);
Java SDK

【 MaxCompute FAQ】 Java SDKCommon usage problems of Java connection to MaxCompute

1. 【 MaxCompute FAQ】 Java SDKHow to use the MaxCompute Java SDK to set the SQL Flag?
using DataWorks or MaxCompute Console, you usually need to set the SQL Flag. If you need to use a new MaxCompute data type and enable it at the session level, you need to add a Set Flag statement before the SQL involving the new data type: set odps.sql.type.system.odps2=true;. When using the SDK to submit SQL, you cannot simply put the Set Flag statement directly into the SQL Query for execution. Taking the Java SDK as an example, the correct way to set Flag is as follows.

// Construct the SQLTask object. SQLTask task = new
SQLTask();task.setName("foobar");task.setQuery("select ...");
// 设置 flag。Map settings = new
HashMap<>();settings.put("odps.sql.type.system.odps2", "true");...
// 设置其它 flags。task.setProperty("settings", new
JSONObject(settings).toString());
// Here is the key: set the json string corresponding to flags to the settings property. Instance instance = o dps.instances ().create(task); // Execute.

2. 【 MaxCompute FAQ】 Java SDKIn MaxCompute , can a task be invoked in Java business code to start execution?
MaxCompute Java sdk in the business code to execute SQL tasks. Refer to the official documentation .

3. 【 MaxCompute FAQ】 Java SDKHow to use Logview to troubleshoot errors on the MaxCompute Java SDK ?
MaxCompute Java SDK provides Logview interface i = SQLTask.run ( odps , sql ) ;
String logview = odps.logview (). generateLogView ( i , 7 * 24);

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00