public class SQLExecutorImpl extends Object implements SQLExecutor
Modifier and Type | Method and Description |
---|---|
void |
cancel()
取消当前查询
|
void |
close()
默认行为关闭该executor,若为连接池模式,则归还Executor到连接池中
|
List<String> |
getExecutionLog()
获取当前查询的执行日志
|
String |
getId()
获取Executor的ID
|
Instance |
getInstance()
获取当前查询Instance
|
String |
getLogView()
获取当前query Logview
|
List<Instance.StageProgress> |
getProgress()
获取当前查询的进度信息
|
String |
getQueryId()
获取当前queryId
|
List<Record> |
getResult()
获取当前query的所有结果
|
List<Record> |
getResult(Long countLimit)
获取有限集结果
|
List<Record> |
getResult(Long countLimit,
Long sizeLimit)
获取有限集结果
|
List<Record> |
getResult(Long offset,
Long countLimit,
Long sizeLimit)
通过InstanceTunnel获取有限集结果
|
List<Record> |
getResult(Long offset,
Long countLimit,
Long sizeLimit,
boolean limitEnabled)
通过InstanceTunnel获取有限集结果
|
ResultSet |
getResultSet()
通过InstanceTunnel获取当前query的结果的迭代器
|
ResultSet |
getResultSet(Long countLimit)
通过InstanceTunnel获取有限集结果的迭代器
|
ResultSet |
getResultSet(Long countLimit,
Long sizeLimit)
通过InstanceTunnel获取有限集结果的迭代器
|
ResultSet |
getResultSet(Long offset,
Long countLimit,
Long sizeLimit)
通过InstanceTunnel获取有限集结果的迭代器
|
ResultSet |
getResultSet(Long offset,
Long countLimit,
Long sizeLimit,
boolean limitEnabled)
通过InstanceTunnel获取有限集结果的迭代器
|
int |
getSubqueryId()
获取当前subquery ID
|
String |
getSummary()
获取当前查询的Summary信息
|
String |
getTaskName()
获取当前query taskName
|
boolean |
hasResultSet()
从语法结构上判断执行的sql是否具备结果集
不判断也不保证是否有数据
|
boolean |
isActive()
检查该Executor是否活跃
|
boolean |
isRunningInInteractiveMode()
判断当前执行的sql是否在 Interactive Mode
|
boolean |
isSelect(String sql) |
boolean |
isUseInstanceTunnel()
判断当前 SQLExecutor 是否使用 Instance Tunnel 取结果
|
void |
run(String sql,
Map<String,String> hint)
提交一个query
|
public void close()
close
in interface SQLExecutor
public String getId()
getId
in interface SQLExecutor
public String getTaskName()
getTaskName
in interface SQLExecutor
public int getSubqueryId()
getSubqueryId
in interface SQLExecutor
public String getQueryId()
getQueryId
in interface SQLExecutor
public String getLogView()
getLogView
in interface SQLExecutor
public boolean isActive()
isActive
in interface SQLExecutor
public void cancel() throws OdpsException
cancel
in interface SQLExecutor
OdpsException
public Instance getInstance()
getInstance
in interface SQLExecutor
public List<Instance.StageProgress> getProgress() throws OdpsException
getProgress
in interface SQLExecutor
OdpsException
public String getSummary() throws OdpsException
getSummary
in interface SQLExecutor
OdpsException
public List<String> getExecutionLog()
getExecutionLog
in interface SQLExecutor
OdpsException
public List<Record> getResult() throws OdpsException, IOException
getResult
in interface SQLExecutor
OdpsException,
- IOExceptionOdpsException
IOException
public ResultSet getResultSet() throws OdpsException, IOException
getResultSet
in interface SQLExecutor
OdpsException,
- IOExceptionOdpsException
IOException
public List<Record> getResult(Long countLimit) throws OdpsException, IOException
getResult
in interface SQLExecutor
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
List
, 数据量较大时会带来较多内存开销 大数据量下载建议直接使用getResultSet(Long)
;OdpsException,
- IOExceptionOdpsException
IOException
public List<Record> getResult(Long countLimit, Long sizeLimit) throws OdpsException, IOException
getResult
in interface SQLExecutor
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
sizeLimit
- 返回结果大小(Bytes) 如果超过count大小会截断 如果超过sizeLimit会直接抛出异常 注意 : 返回结果类型为 List
,
数据量较大时会带来较多内存开销 大数据量下载建议直接使用getResultSet(Long, Long)
;
在打开command api的情况下,同步和异步command均不受该参数限制。OdpsException,
- IOExceptionOdpsException
IOException
public List<Record> getResult(Long offset, Long countLimit, Long sizeLimit) throws OdpsException, IOException
getResult
in interface SQLExecutor
offset
- 返回结果的开始行数,从第几行开始取结果。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
sizeLimit
- 返回结果大小 注意 : 返回结果类型为 List
, 数据量较大时会带来较多内存开销 大数据量下载建议直接使用getResultSet(Long, Long, Long)
;
在打开command api的情况下,同步和异步command均不受该参数限制。OdpsException,
- IOExceptionOdpsException
IOException
public List<Record> getResult(Long offset, Long countLimit, Long sizeLimit, boolean limitEnabled) throws OdpsException, IOException
getResult
in interface SQLExecutor
offset
- 返回结果的开始行数, 从第几行开始取结果。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
sizeLimit
- 返回结果大小。在打开command api的情况下,同步和异步command均不受该参数限制。limitEnabled
- 是否启用project设置的READ_TABLE_MAX_ROW, 启用后countLimit设置不再生效(被READ_TABLE_MAX_ROW覆盖)
不启用则取countLimit数量的结果, 但会进行权限校验, 需要提前在policy中为对应SQL中涉及的相应表和视图添加exception,
否则无权下载。在打开command api的情况下,同步和异步command均不受该参数限制。List
, 数据量较大时会带来较多内存开销 大数据量下载建议直接使用getResultSet(Long, Long, Long, boolean)
;OdpsException,
- IOExceptionOdpsException
IOException
public ResultSet getResultSet(Long countLimit) throws OdpsException, IOException
getResultSet
in interface SQLExecutor
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
OdpsException,
- IOExceptionOdpsException
IOException
public ResultSet getResultSet(Long countLimit, Long sizeLimit) throws OdpsException, IOException
getResultSet
in interface SQLExecutor
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
sizeLimit
- 返回结果大小(Bytes) 如果超过count大小会截断 如果超过sizeLimit会直接抛出异常。
在打开command api的情况下,同步和异步command均不受该参数限制。OdpsException,
- IOExceptionOdpsException
IOException
public ResultSet getResultSet(Long offset, Long countLimit, Long sizeLimit) throws OdpsException, IOException
getResultSet
in interface SQLExecutor
offset
- 返回结果的开始行数,从第几行开始取结果。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
sizeLimit
- 返回结果大小。在打开command api的情况下,同步和异步command均不受该参数限制。OdpsException,
- IOExceptionOdpsException
IOException
public ResultSet getResultSet(Long offset, Long countLimit, Long sizeLimit, boolean limitEnabled) throws OdpsException, IOException
getResultSet
in interface SQLExecutor
offset
- 返回结果的开始行数, 从第几行开始取结果。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
countLimit
- 返回结果数量。在打开command api的情况下,异步command不受该参数限制,
见SQLExecutorBuilder.enableCommandApi(boolean)
sizeLimit
- 返回结果大小。在打开command api的情况下,同步和异步command均不受该参数限制。limitEnabled
- 是否启用project设置的READ_TABLE_MAX_ROW, 启用后countLimit设置不再生效(被READ_TABLE_MAX_ROW覆盖)
不启用则取countLimit数量的结果, 但会进行权限校验, 需要提前在policy中为对应SQL中涉及的相应表和视图添加exception,
否则无权下载。在打开command api的情况下,同步和异步command均不受该参数限制。OdpsException,
- IOExceptionOdpsException
IOException
public void run(String sql, Map<String,String> hint) throws OdpsException
run
in interface SQLExecutor
sql
- sql语句hint
- query需要的hint参数OdpsException
public boolean hasResultSet()
SQLExecutor
hasResultSet
in interface SQLExecutor
public boolean isRunningInInteractiveMode()
SQLExecutor
isRunningInInteractiveMode
in interface SQLExecutor
public boolean isUseInstanceTunnel()
SQLExecutor
isUseInstanceTunnel
in interface SQLExecutor
public boolean isSelect(String sql) throws OdpsException
OdpsException
Copyright © 2024 Alibaba Cloud Computing. All rights reserved.