| Package | Description |
|---|---|
| com.aliyun.odps |
提供操作ODPS基本资源的类
|
| com.aliyun.odps.commons | |
| com.aliyun.odps.datahub |
ODPS Datahub服务用于上传、下载数据到ODPS
|
| com.aliyun.odps.task |
提供ODPS支持的Task定义
|
| com.aliyun.odps.tunnel |
ODPS Tunnel服务用于上传、下载数据到ODPS
|
| Modifier and Type | Class and Description |
|---|---|
class |
NoSuchObjectException
ODPS对象不存在
|
| Modifier and Type | Method and Description |
|---|---|
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 |
Volumes.create(String volumeName,
String comment)
Deprecated.
call #create(String, String, Volume.TYPE) instead.
|
void |
Topologies.create(String topologyName,
String description)
创建Topology
|
String |
StreamJobs.create(String streamJobName,
String sql,
Map<String,String> hints)
创建StreamJob
|
void |
Volumes.create(String projectName,
String volumeName,
String comment)
Deprecated.
call #create(String, String, String, Volume.TYPE) instead.
|
void |
Topologies.create(String projectName,
String topologyName,
String description)
创建Topology
|
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
|
void |
Tables.createTableWithLifeCycle(String projectName,
String tableName,
TableSchema schema,
String comment,
boolean ifNotExists,
Long lifeCycle)
创建表
|
FileResource |
Resources.createTempResource(String fileName)
上传临时文件资源
|
FileResource |
Resources.createTempResource(String projectName,
String fileName)
上传临时文件资源
|
FileResource |
Resources.createTempResource(String projectName,
String fileName,
Resource.Type type) |
void |
Volumes.delete(String volumeName)
删除Volume
|
void |
Topologies.delete(String topologyName)
删除Topology
|
void |
Tables.delete(String tableName)
删除表
|
String |
StreamJobs.delete(String streamJobName)
删除StreamJob
|
void |
Resources.delete(String name)
删除资源
|
void |
Functions.delete(String name)
删除函数
|
void |
Tables.delete(String tableName,
boolean ifExists)
删除表
|
void |
Volumes.delete(String projectName,
String volumeName)
删除Volume
|
void |
Topologies.delete(String projectName,
String topologyName)
删除Topology
|
void |
Tables.delete(String projectName,
String tableName)
删除表
|
String |
StreamJobs.delete(String projectName,
String streamJobName)
删除StreamJob
|
void |
Resources.delete(String projectName,
String name)
删除资源
|
void |
Functions.delete(String projectName,
String name)
删除函数
|
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 |
Volumes.exists(String volumeName)
判断指定Volume是否存在
|
boolean |
Tables.exists(String tableName)
判断指定表是否存在
|
boolean |
Resources.exists(String resourceName)
判断指定资源是否存在
|
boolean |
Projects.exists(String projectName)
检查
Project是否存在 |
boolean |
Instances.exists(String id)
判断指定 Instance 是否存在
|
boolean |
Functions.exists(String functionName)
判断 Function 是否存在
|
boolean |
Volumes.exists(String projectName,
String volumeName)
判断指定Volume是否存在
|
boolean |
Tables.exists(String projectName,
String tableName)
判断指定表是否存在
|
boolean |
Resources.exists(String projectName,
String resourceName)
判断指定资源是否存在
|
boolean |
Instances.exists(String projectName,
String id)
判断指定 Instance 是否存在
|
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的状态
|
Map<String,String> |
Project.getSystemVersion() |
Instance.TaskCost |
Instance.getTaskCost(String taskName)
获得 Instance 中 Task 的运行资源消耗信息
当且仅当 Task 产生计量信息时,返回资源消耗信息,否则返回 null
|
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是否执行成功 |
List<Table> |
Tables.loadTables(Collection<String> tableNames)
批量加载表信息
|
List<Table> |
Tables.loadTables(String projectName,
Collection<String> tableNames)
批量加载表信息
|
void |
OdpsHooks.onInstanceCreated(Instance instance,
Odps odps)
调用 Hook 的 ready
|
void |
OdpsHook.onInstanceCreated(Instance instance,
Odps odps)
向远程提交 job 并产生 instance 时,将 Instance 和 Odps 对象传入 Hook
|
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 条记录,若超过,数据将被截断。 另外,读取的数据大小不能超过 10MB,否则将抛出异常。 |
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 |
VolumePartition.reload() |
void |
VolumeFSFile.reload() |
void |
Volume.reload() |
void |
Topology.reload() |
void |
Table.reload() |
void |
StreamJob.reload() |
void |
Resource.reload() |
void |
Project.reload() |
void |
Partition.reload() |
abstract void |
LazyLoad.reload()
重新加载属性值
|
void |
Instance.reload() |
void |
Function.reload() |
void |
Table.reload(com.aliyun.odps.Table.TableModel model) |
List<Table> |
Tables.reloadTables(Collection<Table> tables)
批量加载表信息
|
List<Table> |
Tables.reloadTables(Iterator<Table> tables)
批量加载表信息
rest api 对请求数量有限制, 目前一次操作最多可请求 100 张表信息; 返回的表数据,与操作权限有关. |
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 |
Resource.updateOwner(String newOwner)
更新 资源的 owner
需要是 project owner
|
void |
Function.updateOwner(String newOwner) |
void |
Instance.waitForSuccess()
阻塞当前线程, 直到Instance结束
|
void |
Instance.waitForSuccess(long interval)
阻塞当前线程, 直到Instance结束
|
| Modifier and Type | Method and Description |
|---|---|
URI |
GeneralConfiguration.getEndpoint(String projectName) |
URI |
GeneralConfiguration.getURI(String projectName,
String tableName)
取得URI
|
| Modifier and Type | Class and Description |
|---|---|
class |
DatahubException
该异常在DataHub服务访问失败时抛出。
|
| Modifier and Type | Method and Description |
|---|---|
URI |
DatahubConfiguration.getEndpoint(String projectName)
取得指定Project的Datahub服务入口地址
|
HashMap<Long,DatahubClient.ShardState> |
DatahubClient.getShardStatus()
查询DatahubClinet对应的table拥有的shard在服务端的状态
|
TableSchema |
DatahubClient.getStreamSchemaFromServer() |
Date |
DatahubClient.getTableReplicatedTimeStamp()
返回一个写入datahub的pack的时间戳,datahub确保小于等于这个时间戳的pack都已经进入离线ODPS
|
Date |
DatahubClient.getTableTimestamp()
返回一个时间戳,datahub确保小于等于这个时间戳的pack都已经进入离线ODPS
|
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)
Deprecated.
返回的packid不一定是对应partition的, 只能通过比较大小来判断, 不要使用是否相等来判断
|
ReadPackResult |
PackReader.read() |
Record |
DatahubReader.read()
从指定的shard读取一条记录
|
ReadPackResult |
PackReader.read(String packId,
PackType.ReadMode mode) |
Map<String,String> |
PackReader.readMeta() |
byte[] |
DatahubReader.readMeta() |
ReadPackResult |
PackReader.readPackMeta() |
SeekPackResult |
PackReader.seek(long timeStamp) |
SeekPackResult |
DatahubReader.seek(long timeStamp) |
void |
DatahubClient.setEndpoint(String endpoint)
设置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(DatahubRecordPack recordPack,
Map<String,String> meta)
向ODPS hub服务的非分区表写入一个pack
|
WritePackResult |
DatahubWriter.write(PartitionSpec partitionSpec,
DatahubRecordPack recordPack)
向ODPS hub服务的分区表写入一个pack
|
WritePackResult |
DatahubWriter.write(PartitionSpec partitionSpec,
DatahubRecordPack recordPack,
Map<String,String> meta)
向ODPS hub服务的非分区表写入一个pack
|
| Constructor and Description |
|---|
DatahubClient(Odps odps,
String projectName,
String tableName,
String datahubEndpoint)
Datahub服务入口类
|
ReplicatorStatus(InputStream is) |
| Modifier and Type | Method and Description |
|---|---|
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)
Deprecated.
|
static List<Record> |
SQLTask.getResultByInstanceTunnel(Instance instance)
使用 instance tunnel 的方式获取 Anonymous task 的结果
|
static List<Record> |
SQLTask.getResultByInstanceTunnel(Instance instance,
Long limit)
使用 instance tunnel 的方式获取 Anonymous task 的结果
|
static List<Record> |
SQLTask.getResultByInstanceTunnel(Instance instance,
String taskName)
使用 instance tunnel 的方式获取 instance 结果
当数据量不大于
SQLTask.SQL_TASK_RESULT_LIMIT 条时,成功;
若数据量量大于 SQLTask.SQL_TASK_RESULT_LIMIT 条, 返回 SQL_TASK_RESULT_LIMIT 条结果;
可使用 SQLTask.getResultByInstanceTunnel(Instance, String, Long) 接口调整 limit 参数, 来获取更多数据; |
static List<Record> |
SQLTask.getResultByInstanceTunnel(Instance instance,
String taskName,
Long limit)
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.
执行读取数据时,最多返回 1W 条记录,若超过,数据将被截断。 特别注意,在执行数据读取操作时: 正常情况下的 task 执行后,task 的状态为 SUCCESS,并正常返回数据结果。 但是,当读取数据量超过 10MB,task 的状态将是 FAILED,返回的数据结果为 error message。 因此,大量数据的获取建议使用 TableTunnel 进行操作。示例代码: |
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 |
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) |
static Instance |
CupidTask.run(Odps odps,
String project,
String plan,
Map<String,String> hints) |
static Instance |
MoyeTask.run(Odps odps,
String project,
String plan,
Map<String,String> hints,
int priority) |
static Instance |
CupidTask.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) |
| Modifier and Type | Class and Description |
|---|---|
class |
TunnelException
该异常在DataTunnel服务访问失败时抛出。
|
Copyright © 2016 Alibaba Cloud Computing. All rights reserved.