| 程序包 | 说明 |
|---|---|
| com.aliyun.odps |
提供操作ODPS基本资源的类
ODPS基本资源包括: Table, Resource, Function等
Examples:
Account account = new AliyunAccount("accessId", "accessKey");
Odps odps = new Odps(account);
odps.setDefaultProject("my_project");
for (Table t : odps.tables()) {
System.out.print(t.getName() + "\t" + t.getOwner());
}
|
| com.aliyun.odps.task |
提供ODPS支持的Task定义
|
| com.aliyun.odps.tunnel |
ODPS Tunnel服务用于上传、下载数据到ODPS
Examples:
Account account = new AliyunAccount("accessId", "accessKey");
Odps odps = new Odps(account);
odps.setDefaultProject("my_project");
DataTunnel tunnel = new DataTunnel(odps);
UploadSession session = tunnel.createUploadSession("my_project", "my_table");
.... |
| 限定符和类型 | 类和说明 |
|---|---|
class |
NoSuchObjectException
ODPS对象不存在
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
OdpsHooks.after(Instance instance,
Odps odps)
调用 Hook 的 after
|
abstract void |
OdpsHook.after(Instance instance,
Odps odps)
instance 结束后,框架会将 Instance 和 odps 对象传入 hook
|
void |
OdpsHooks.before(Job job,
Odps odps)
调用 Hook 的 before
|
abstract void |
OdpsHook.before(Job job,
Odps odps)
提交代码前,框架会将 Job 和 Odps 对象传入 Hook
|
void |
Resources.create(FileResource r,
InputStream in)
创建文件资源
|
void |
Functions.create(Function func)
创建函数
|
Instance |
Instances.create(Job job)
|
void |
Resources.create(String projectName,
FileResource r,
InputStream in)
创建文件资源
|
void |
Functions.create(String projectName,
Function func)
创建函数
|
void |
Topologies.create(String topologyName,
String description)
创建Topology
|
void |
Volumes.create(String volumeName,
String comment)
创建Volume
|
String |
StreamJobs.create(String streamJobName,
String sql,
Map<String,String> hints)
创建StreamJob
|
void |
Topologies.create(String projectName,
String topologyName,
String description)
创建Topology
|
void |
Volumes.create(String projectName,
String volumeName,
String comment)
创建Volume
|
String |
StreamJobs.create(String projectName,
String streamJobName,
String sql,
Map<String,String> hints)
创建StreamJob
|
void |
Tables.create(String projectName,
String tableName,
TableSchema schema)
创建表
|
void |
Tables.create(String projectName,
String tableName,
TableSchema schema,
boolean ifNotExists)
创建表
|
void |
Tables.create(String projectName,
String tableName,
TableSchema schema,
boolean ifNotExists,
Long shardNum,
Long hubLifecycle)
创建表
|
void |
Tables.create(String projectName,
String tableName,
TableSchema schema,
String comment,
boolean ifNotExists)
创建表
|
void |
Tables.create(String projectName,
String tableName,
TableSchema schema,
String comment,
boolean ifNotExists,
Long shardNum,
Long hubLifecycle)
创建表
|
void |
Resources.create(String projectName,
TableResource r)
创建表资源
|
void |
Tables.create(String tableName,
TableSchema schema)
创建表
|
void |
Tables.create(String tableName,
TableSchema schema,
boolean ifNotExists)
创建表
|
Instance |
Instances.create(String projectName,
Task task)
为给定的
Task创建Instance |
Instance |
Instances.create(String projectName,
Task task,
int priority)
为给定的
Task创建Instance |
Instance |
Instances.create(String projectName,
Task task,
Integer priority,
String runningCluster) |
Instance |
Instances.create(String projectName,
Task task,
int priority,
String runningCluster)
为给定的
Task创建Instance |
void |
Resources.create(String projectName,
VolumeResource r)
创建 Volume 资源
|
void |
Resources.create(TableResource r)
创建表资源
|
Instance |
Instances.create(Task task)
|
Instance |
Instances.create(Task task,
int priority)
为给定的
Task创建Instance |
Instance |
Instances.create(Task task,
int priority,
String runningCluster)
为给定的
Task创建Instance |
void |
Resources.create(VolumeResource r)
创建 Volume 资源
|
void |
Table.createPartition(PartitionSpec spec)
增加分区
|
void |
Table.createPartition(PartitionSpec spec,
boolean ifNotExists)
增加分区
|
void |
Table.createShards(long shardCount)
在Table上创建Shards
|
FileResource |
Resources.createTempResource(String fileName)
上传临时文件资源
|
FileResource |
Resources.createTempResource(String projectName,
String fileName)
上传临时文件资源
|
FileResource |
Resources.createTempResource(String projectName,
String fileName,
Resource.Type type) |
void |
Tables.delete(String tableName)
删除表
|
void |
Functions.delete(String name)
删除函数
|
String |
StreamJobs.delete(String streamJobName)
删除StreamJob
|
void |
Topologies.delete(String topologyName)
删除Topology
|
void |
Resources.delete(String name)
删除资源
|
void |
Volumes.delete(String volumeName)
删除Volume
|
void |
Tables.delete(String tableName,
boolean ifExists)
删除表
|
void |
Tables.delete(String projectName,
String tableName)
删除表
|
void |
Functions.delete(String projectName,
String name)
删除函数
|
String |
StreamJobs.delete(String projectName,
String streamJobName)
删除StreamJob
|
void |
Topologies.delete(String projectName,
String topologyName)
删除Topology
|
void |
Resources.delete(String projectName,
String name)
删除资源
|
void |
Volumes.delete(String projectName,
String volumeName)
删除Volume
|
void |
Tables.delete(String projectName,
String tableName,
boolean ifExists)
删除表
|
void |
Table.deletePartition(PartitionSpec spec)
删除指定分区
|
void |
Table.deletePartition(PartitionSpec spec,
boolean ifExists)
删除指定分区
|
void |
Volume.deleteVolumePartition(String partitionName)
删除指定分区
|
boolean |
Projects.exists(String projectName)
检查
Project是否存在 |
boolean |
Tables.exists(String tableName)
判断指定表是否存在
|
boolean |
Functions.exists(String functionName)
判断 Function 是否存在
|
boolean |
Instances.exists(String id)
判断指定 Instance 是否存在
|
boolean |
Resources.exists(String resourceName)
判断指定资源是否存在
|
boolean |
Volumes.exists(String volumeName)
判断指定Volume是否存在
|
boolean |
Tables.exists(String projectName,
String tableName)
判断指定表是否存在
|
boolean |
Functions.exists(String projectName,
String functionName)
判断 Function 是否存在
|
boolean |
Instances.exists(String projectName,
String id)
判断指定 Instance 是否存在
|
boolean |
Resources.exists(String projectName,
String resourceName)
判断指定资源是否存在
|
boolean |
Volumes.exists(String projectName,
String volumeName)
判断指定Volume是否存在
|
String |
LogView.generateLogView(Instance instance,
long hours) |
Project |
Projects.get()
获得默认
Project对象 |
Project |
Projects.get(String projectName)
获取指定
Project |
Function |
Functions.get(String functionName)
获取 Function 对象
|
Map<String,String> |
Project.getExtendedProperties()
获取 Project 扩展配置信息
|
String |
Instance.getLog(String workerId,
LogType logType,
int size)
获取Worker运行的LOG内容
|
int |
Instance.getPriority()
获取 Instance 的优先级
|
InputStream |
Resources.getResourceAsStream(String name)
获得资源文件的字节流
|
InputStream |
Resources.getResourceAsStream(String projectName,
String name)
获得资源文件的字节流
|
String |
StreamJobs.getStatus(String streamJobName)
获取StreamJob的状态
|
String |
StreamJobs.getStatus(String projectName,
String streamJobName)
获取StreamJob的状态
|
String |
Instance.getTaskDetailJson(String taskName) |
String |
Instance.getTaskDetailJson2(String taskName) |
Set<String> |
Instance.getTaskNames()
获得Instance所包含的所有
Task的名称 |
List<Instance.StageProgress> |
Instance.getTaskProgress(String taskName)
查询指定Task的Stage进度
|
Map<String,String> |
Instance.getTaskResults()
获得Instance中Task的运行结果
|
Map<String,Instance.Result> |
Instance.getTaskResultsWithFormat()
获得Instance中
Task的运行结果 |
List<Task> |
Instance.getTasks()
返回与作业运行实例相关的作业
Task实例。 |
Map<String,Instance.TaskStatus> |
Instance.getTaskStatus()
查询Instance中所有
Task的执行状态 |
Instance.TaskSummary |
Instance.getTaskSummary(String taskName)
获得Instance中Task的运行汇总信息 当 Server 端返回信息,但是信息格式错误时,返回 null
|
boolean |
Table.hasPartition(PartitionSpec spec)
判断指定分区是否存在
|
boolean |
Table.isPartitioned()
判断是否 Partition 表
|
boolean |
Instance.isSuccessful()
检查
Instance是否执行成功
成功的含义为Instance执行结束,并且所有Task的状态为成功
|
String |
StreamJobs.pause(String streamJobName)
暂停StreamJob
|
String |
StreamJobs.pause(String projectName,
String streamJobName)
暂停StreamJob
|
RecordReader |
Table.read(int limit)
读取表内的数据
|
RecordReader |
Table.read(PartitionSpec partition,
List<String> columns,
int limit)
读取表内的数据
读取数据时,最多返回 1W 条记录,若超过,数据将被截断。 |
String |
StreamJobs.rebalance(String streamJobName,
Map<String,String> hints)
Rebalance StreamJob
|
String |
StreamJobs.rebalance(String projectName,
String streamJobName,
Map<String,String> hints)
Rebalance StreamJob
|
void |
StreamJob.reload() |
void |
Table.reload() |
void |
VolumePartition.reload() |
void |
Resource.reload() |
abstract void |
LazyLoad.reload()
重新加载属性值
|
void |
Volume.reload() |
void |
Partition.reload() |
void |
Project.reload() |
void |
Instance.reload() |
void |
Function.reload() |
void |
Topology.reload() |
String |
StreamJobs.resume(String streamJobName,
Map<String,String> hints)
恢复StreamJob
|
String |
StreamJobs.resume(String projectName,
String streamJobName,
Map<String,String> hints)
恢复StreamJob
|
void |
Instance.stop()
停止正在执行的Instance
|
String |
Job.toXmlString() |
void |
Table.truncate()
删除表数据
|
void |
Resources.update(FileResource r,
InputStream in)
更新文件资源
|
void |
Functions.update(Function func)
更新 Function
|
void |
Resources.update(String projectName,
FileResource r,
InputStream in)
更新文件资源
|
void |
Functions.update(String projectName,
Function func)
更新 Function
|
void |
Resources.update(String projectName,
TableResource r)
更新表资源
|
void |
Resources.update(String projectName,
VolumeResource r)
更新 Volume 资源
|
void |
Resources.update(TableResource r)
更新表资源
|
void |
Resources.update(VolumeResource r)
更新 Volume 资源
|
void |
Instance.waitForSuccess()
阻塞当前线程, 直到Instance结束
|
void |
Instance.waitForSuccess(long interval)
阻塞当前线程, 直到Instance结束
|
| 限定符和类型 | 方法和说明 |
|---|---|
static List<Record> |
SQLTask.getResult(Instance instance)
Columns of each record in result are ALL OdpsType.STIRNG, ignore their real type in odps
Return value is valid only when SQL query is select, otherwise, result will be empty. |
static List<Record> |
SQLTask.getResult(Instance instance,
String taskName)
Columns of each record in result are ALL OdpsType.STIRNG, ignore their real type in odps
Return value is valid only when SQL query is select, otherwise, result will be empty. |
static Instance |
SQLCostTask.run(Odps odps,
String sql)
通过匿名Instance运行SQLCostTask
|
static Instance |
SQLTask.run(Odps odps,
String sql)
运行 SQL.
|
static Instance |
LOTTask.run(Odps odps,
String input,
boolean runSQL)
通过匿名Instance运行LOTTask
|
static Instance |
GraphTask.run(Odps odps,
String project,
GraphTask graphTask) |
static Instance |
GraphTask.run(Odps odps,
String project,
GraphTask graphTask,
int priority) |
static Instance |
LOTTask.run(Odps odps,
String project,
String input,
boolean runSQL,
Map<String,String> hints,
Map<String,String> aliases)
通过匿名Instance运行LOTTask
|
static Instance |
LOTTask.run(Odps odps,
String project,
String input,
boolean runSQL,
String taskName,
Map<String,String> hints,
Map<String,String> aliases)
运行LOTTask
|
static Instance |
MoyeTask.run(Odps odps,
String project,
String plan,
Map<String,String> hints) |
static Instance |
SQLCostTask.run(Odps odps,
String project,
String sql,
Map<String,String> hints)
通过匿名Instance运行SQLCostTask
|
static Instance |
MoyeTask.run(Odps odps,
String project,
String plan,
Map<String,String> hints,
int priority) |
static Instance |
SQLTask.run(Odps odps,
String project,
String sql,
Map<String,String> hints,
Map<String,String> aliases)
运行SQL
|
static Instance |
SQLCostTask.run(Odps odps,
String project,
String sql,
String taskName,
Map<String,String> hints)
运行SQLCostTask
|
static Instance |
SQLTask.run(Odps odps,
String project,
String sql,
String taskName,
Map<String,String> hints,
Map<String,String> aliases) |
static Instance |
SQLTask.run(Odps odps,
String project,
String sql,
String taskName,
Map<String,String> hints,
Map<String,String> aliases,
int priority) |
| 限定符和类型 | 类和说明 |
|---|---|
class |
InvalidColumnTypeException
该异常在Schema的中列类型不被支持时抛出
|
class |
InvalidRecordSchema
该异常在Schema的格式不正确的时候抛出
|
class |
TunnelException
该异常在DataTunnel服务访问失败时抛出。
|
Copyright © 2015 Alibaba Cloud Computing. All rights reserved.