| 程序包 | 说明 |
|---|---|
| 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.commons | |
| com.aliyun.odps.datahub |
ODPS Datahub服务用于上传、下载数据到ODPS
Examples:
Account account = new AliyunAccount("accessId", "accessKey");
Odps odps = new Odps(account);
odps.setDefaultProject("my_project");
DatahubClient client = new DatahubClient(odps);
DatahubReader reader = client.openDatahubReader("shardId");
DatahubWriter writer = client.openDatahubWriter("shardId");
.... |
| 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对象不存在
|
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
OdpsHook.after(Instance instance,
Odps odps)
instance 结束后,框架会将 Instance 和 odps 对象传入 hook
|
void |
OdpsHooks.after(Instance instance,
Odps odps)
调用 Hook 的 after
|
abstract void |
OdpsHook.before(Job job,
Odps odps)
提交代码前,框架会将 Job 和 Odps 对象传入 Hook
|
void |
OdpsHooks.before(Job job,
Odps odps)
调用 Hook 的 before
|
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)
已过时。
call #create(String, String, Volume.TYPE) instead.
|
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)
已过时。
call #create(String, String, String, Volume.TYPE) instead.
|
String |
StreamJobs.create(String projectName,
String streamJobName,
String sql,
Map<String,String> hints)
创建StreamJob
|
void |
Volumes.create(String projectName,
String volumeName,
String comment,
Volume.Type type)
创建Volume
|
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 |
Volumes.create(String volumeName,
String comment,
Volume.Type type)
创建Volume
|
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 |
Topologies.delete(String topologyName)
删除Topology
|
void |
Tables.delete(String tableName)
删除表
|
void |
Volumes.delete(String volumeName)
删除Volume
|
void |
Resources.delete(String name)
删除资源
|
void |
Functions.delete(String name)
删除函数
|
String |
StreamJobs.delete(String streamJobName)
删除StreamJob
|
void |
Tables.delete(String tableName,
boolean ifExists)
删除表
|
void |
Topologies.delete(String projectName,
String topologyName)
删除Topology
|
void |
Tables.delete(String projectName,
String tableName)
删除表
|
void |
Volumes.delete(String projectName,
String volumeName)
删除Volume
|
void |
Resources.delete(String projectName,
String name)
删除资源
|
void |
Functions.delete(String projectName,
String name)
删除函数
|
String |
StreamJobs.delete(String projectName,
String streamJobName)
删除StreamJob
|
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 |
Instances.exists(String id)
判断指定 Instance 是否存在
|
boolean |
Tables.exists(String tableName)
判断指定表是否存在
|
boolean |
Projects.exists(String projectName)
检查
Project是否存在 |
boolean |
Volumes.exists(String volumeName)
判断指定Volume是否存在
|
boolean |
Resources.exists(String resourceName)
判断指定资源是否存在
|
boolean |
Functions.exists(String functionName)
判断 Function 是否存在
|
boolean |
Instances.exists(String projectName,
String id)
判断指定 Instance 是否存在
|
boolean |
Tables.exists(String projectName,
String tableName)
判断指定表是否存在
|
boolean |
Volumes.exists(String projectName,
String volumeName)
判断指定Volume是否存在
|
boolean |
Resources.exists(String projectName,
String resourceName)
判断指定资源是否存在
|
boolean |
Functions.exists(String projectName,
String functionName)
判断 Function 是否存在
|
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的状态为成功
|
void |
OdpsHook.onInstanceCreated(Instance instance,
Odps odps)
向远程提交 job 并产生 instance 时,将 Instance 和 Odps 对象传入 Hook
|
void |
OdpsHooks.onInstanceCreated(Instance instance,
Odps odps)
调用 Hook 的 ready
|
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 |
Partition.reload() |
abstract void |
LazyLoad.reload()
重新加载属性值
|
void |
VolumePartition.reload() |
void |
Project.reload() |
void |
StreamJob.reload() |
void |
Instance.reload() |
void |
Function.reload() |
void |
Resource.reload() |
void |
Table.reload() |
void |
Volume.reload() |
void |
VolumeFSFile.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结束
|
| 限定符和类型 | 方法和说明 |
|---|---|
URI |
GeneralConfiguration.getEndpoint(String projectName) |
URI |
GeneralConfiguration.getURI(String projectName,
String tableName)
取得URI
|
| 限定符和类型 | 类和说明 |
|---|---|
class |
DatahubException
该异常在DataHub服务访问失败时抛出。
|
| 限定符和类型 | 方法和说明 |
|---|---|
URI |
DatahubConfiguration.getEndpoint(String projectName)
取得指定Project的Datahub服务入口地址
|
HashMap<Long,DatahubClient.ShardState> |
DatahubClient.getShardStatus()
查询DatahubClinet对应的table拥有的shard在服务端的状态
|
void |
DatahubClient.loadShard(long shardNumber)
在ODPS hub服务上启用shard
|
DatahubReader |
DatahubClient.openDatahubReader(long shardId)
创建DatahubReader读取指定shard
|
DatahubReader |
DatahubClient.openDatahubReader(long shardId,
String packId)
创建DatahubReader读取指定shard
|
DatahubWriter |
DatahubClient.openDatahubWriter()
创建DatahubWriter
|
DatahubWriter |
DatahubClient.openDatahubWriter(long shardId)
创建DatahubWriter写入指定shard
|
PackReader |
DatahubClient.openPackReader(long shardId) |
PackReader |
DatahubClient.openPackReader(long shardId,
String packId) |
ReplicatorStatus |
DatahubClient.QueryReplicatorStatus(long shardId)
在ODPS hub查询非分区表拷贝到离线集群的状态
|
ReplicatorStatus |
DatahubClient.QueryReplicatorStatus(long shardId,
PartitionSpec partitionSpec)
在ODPS hub查询partiton对应的拷贝到离线集群的状态
|
Record |
DatahubReader.read()
从指定的shard读取一条记录
|
ReadPackResult |
PackReader.read() |
ReadPackResult |
PackReader.read(String packId,
PackType.ReadMode mode) |
byte[] |
DatahubReader.readMeta() |
SeekPackResult |
DatahubReader.seek(long timeStamp) |
SeekPackResult |
PackReader.seek(long timeStamp) |
void |
DatahubClient.setEndpoint(String endpoint)
设置DatahubServer地址
没有设置DatahubServer地址的情况下, 自动选择
|
void |
DatahubClient.waitForShardLoad()
同步等待 load shard 完成
默认超时时间为 120000ms
|
void |
DatahubClient.waitForShardLoad(long timeout)
同步等待 load shard 完成
最大超时时间为 120000ms
|
WritePackResult |
DatahubWriter.write(DatahubRecordPack recordPack)
向ODPS hub服务的非分区表写入一个pack
|
WritePackResult |
DatahubWriter.write(DatahubRecordPack recordPack,
byte[] meta)
向ODPS hub服务的非分区表写入一个pack
|
WritePackResult |
DatahubWriter.write(PartitionSpec partitionSpec,
DatahubRecordPack recordPack)
向ODPS hub服务的分区表写入一个pack
|
WritePackResult |
DatahubWriter.write(PartitionSpec partitionSpec,
DatahubRecordPack recordPack,
byte[] meta)
向ODPS hub服务的分区表写入一个pack
|
| 构造器和说明 |
|---|
DatahubClient(Odps odps,
String projectName,
String tableName,
String datahubEndpoint)
Datahub服务入口类
|
ReplicatorStatus(InputStream is) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 |
SQLTask.run(Odps odps,
String sql)
运行 SQL.
|
static Instance |
SQLCostTask.run(Odps odps,
String sql)
通过匿名Instance运行SQLCostTask
|
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 |
TunnelException
该异常在DataTunnel服务访问失败时抛出。
|
Copyright © 2015 Alibaba Cloud Computing. All rights reserved.