public class Session extends Object
Modifier and Type | Class and Description |
---|---|
class |
Session.SubQueryResponse |
Modifier and Type | Method and Description |
---|---|
static Session |
attach(Odps odps,
String sessionName)
attach 指定名字的 session
此调用会立即返回,不会等待 session 启动完成。 可以手动调用
waitForStart(long) 来等待启动。 |
static Session |
attach(Odps odps,
String sessionName,
Map<String,String> hints)
attach 指定名字的 session
此调用会立即返回,不会等待 session 启动完成。 可以手动调用
waitForStart(long) 来等待启动。 |
static Session |
attach(Odps odps,
String sessionName,
Map<String,String> hints,
Long timeout)
attach 指定名字的 session
|
static Session |
create(Odps odps,
int workerCount,
int workerMemory)
创建 session
此调用会立即返回,不会等待 session 启动完成。 可以手动调用
waitForStart(long) 来等待启动。 |
static Session |
create(Odps odps,
int workerCount,
int workerMemory,
String sessionName)
创建 session
此调用会立即返回,不会等待 session 启动完成。 可以手动调用
waitForStart(long) 来等待启动。 |
static Session |
create(Odps odps,
int workerCount,
int workerMemory,
String sessionName,
String projectName,
String workerSpareSpan,
Map<String,String> hints,
Long timeout)
创建 session
|
static Session |
create(Odps odps,
int workerCount,
int workerMemory,
String sessionName,
String projectName,
String workerSpareSpan,
Map<String,String> hints,
Long timeout,
Integer priority)
创建 session
|
static Session |
create(Odps odps,
String sessionName,
String projectName,
Map<String,String> hints,
Long timeout)
创建 session
|
static Session |
create(Odps odps,
String sessionName,
String projectName,
Map<String,String> hints,
Long timeout,
Integer priority)
创建 session
|
Instance |
getInstance()
返回 odps instance 对象
|
String |
getLogView() |
String |
getSessionName() |
String |
getStartSessionMessage() |
void |
printLogView() |
SessionQueryResult |
run(String sql)
提交查询
|
SessionQueryResult |
run(String sql,
Map<String,String> hints)
提交查询
|
void |
setLogView(String logView) |
void |
stop()
停止 session
|
void |
waitForStart()
阻塞等待 session 启动
|
void |
waitForStart(long timeout)
等待 session 启动
|
public Session(Odps odps, Instance instance) throws OdpsException
OdpsException
public String getLogView()
public void setLogView(String logView)
public String getStartSessionMessage()
public Instance getInstance()
public static Session attach(Odps odps, String sessionName) throws OdpsException
waitForStart(long)
来等待启动。odps
- odps 对象sessionName
- 指定 session 的名字OdpsException
public static Session attach(Odps odps, String sessionName, Map<String,String> hints) throws OdpsException
waitForStart(long)
来等待启动。odps
- odps 对象sessionName
- 指定的 session 名字hints
- 能够影响 SQL 执行的Set 参数OdpsException
public static Session attach(Odps odps, String sessionName, Map<String,String> hints, Long timeout) throws OdpsException
odps
- odps 对象sessionName
- 指定的 session 名字hints
- 能够影响 SQL 执行的Set 参数数timeout
- 等待 session 启动的超时时间,单位: 秒
其中: null 表示从不等待; 0 表示阻塞等待OdpsException
public static Session create(Odps odps, int workerCount, int workerMemory) throws OdpsException
waitForStart(long)
来等待启动。odps
- odps 对象workerCount
- session work 数量(单位:个)workerMemory
- session work 内存 (单位: MB)OdpsException
public static Session create(Odps odps, int workerCount, int workerMemory, String sessionName) throws OdpsException
waitForStart(long)
来等待启动。odps
- odps 对象workerCount
- session work 数量(单位:个)workerMemory
- session work 内存 (单位: MB)sessionName
- 指定 session 名字OdpsException
public static Session create(Odps odps, int workerCount, int workerMemory, String sessionName, String projectName, String workerSpareSpan, Map<String,String> hints, Long timeout) throws OdpsException
odps
- odps 对象workerCount
- session work 数量(单位:个)workerMemory
- session work 内存 (单位: MB)sessionName
- 指定 session 名字workerSpareSpan
- session 对应 cg service 的服务休息时间, 格式是 startHour-endHour
例如 0-12 表示0点到12点 worker 数会降为 0。hints
- 能够影响 SQL 执行的Set 参数timeout
- 等待 session 启动的超时时间,单位: 秒
其中: null 表示从不等待; 0 表示阻塞等待OdpsException
public static Session create(Odps odps, int workerCount, int workerMemory, String sessionName, String projectName, String workerSpareSpan, Map<String,String> hints, Long timeout, Integer priority) throws OdpsException
odps
- odps 对象workerCount
- session work 数量(单位:个)workerMemory
- session work 内存 (单位: MB)sessionName
- 指定 session 名字workerSpareSpan
- session 对应 cg service 的服务休息时间, 格式是 startHour-endHour
例如 0-12 表示0点到12点 worker 数会降为 0。hints
- 能够影响 SQL 执行的Set 参数timeout
- 等待 session 启动的超时时间,单位: 秒
其中: null 表示从不等待; 0 表示阻塞等待priority
- session 优先级OdpsException
public static Session create(Odps odps, String sessionName, String projectName, Map<String,String> hints, Long timeout) throws OdpsException
odps
- odps 对象hints
- 能够影响 SQL 执行的Set 参数timeout
- 等待 session 启动的超时时间,单位: 秒
其中: null 表示从不等待; 0 表示阻塞等待OdpsException
public static Session create(Odps odps, String sessionName, String projectName, Map<String,String> hints, Long timeout, Integer priority) throws OdpsException
odps
- odps 对象hints
- 能够影响 SQL 执行的Set 参数timeout
- 等待 session 启动的超时时间,单位: 秒
其中: null 表示从不等待; 0 表示阻塞等待priority
- session 优先级OdpsException
public SessionQueryResult run(String sql) throws OdpsException
sql
- sql 语句OdpsException
public SessionQueryResult run(String sql, Map<String,String> hints) throws OdpsException
sql
- sql 语句hints
- 能够影响 SQL 执行的Set 参数OdpsException
public void stop() throws OdpsException
OdpsException
public void waitForStart() throws OdpsException
OdpsException
public void waitForStart(long timeout) throws OdpsException
timeout
- 等待的超时时间(单位: 秒)
0 表示阻塞等待OdpsException
public void printLogView()
public String getSessionName()
Copyright © 2019 Alibaba Cloud Computing. All rights reserved.