public class Table extends LazyLoad
Modifier and Type | Class and Description |
---|---|
static class |
Table.ClusterInfo |
static class |
Table.SortColumn |
static class |
Table.TableType |
static class |
Table.TableTypeConverter
Convert
Table.TableType to/from String |
Modifier and Type | Method and Description |
---|---|
void |
addSimpleTag(String category,
String key,
String value)
Attach a simple tag to this table.
|
void |
addSimpleTag(String category,
String key,
String value,
List<String> columnNames)
Attach a simple tag to this table or some of its columns.
|
void |
addTag(Tag tag)
Attach a
Tag to this table. |
void |
addTag(Tag tag,
List<String> columnNames)
Attach a
Tag to this table. |
void |
createPartition(PartitionSpec spec)
增加分区
|
void |
createPartition(PartitionSpec spec,
boolean ifNotExists)
增加分区
|
void |
createShards(long shardCount)
在Table上创建Shards
|
void |
deletePartition(PartitionSpec spec)
删除指定分区
|
void |
deletePartition(PartitionSpec spec,
boolean ifExists)
删除指定分区
|
int |
getAcidDataRetainHours() |
Table.ClusterInfo |
getClusterInfo()
返回 cluster range 表的 cluster 信息
|
String |
getComment()
获取注释
|
Date |
getCreatedTime()
获取创建时间
|
String |
getCryptoAlgoName()
获取表加密算法名称
|
long |
getFileNum()
返回表数据所占的盘古文件数
|
long |
getHubLifecycle()
获取表的datahub生命周期值,单位:天
|
String |
getJsonSchema() |
Date |
getLastDataAccessTime()
获取数据最后访问时间
|
Date |
getLastDataModifiedTime()
获取数据最后修改时间
|
Date |
getLastMetaModifiedTime()
获取最后修改时间
|
long |
getLife()
获取表的生命周期值,单位:天
|
String |
getLocation()
返回外部表数据存储位置
|
String |
getMaxExtendedLabel() |
String |
getMaxLabel()
获取最高的label级别
Label的定义分两部分:
1.
|
String |
getName()
获取表名
|
String |
getOwner()
获取表所属用户
|
Partition |
getPartition(PartitionSpec spec)
获取指定分区信息
|
Iterator<Partition> |
getPartitionIterator()
获取分区迭代器
|
Iterator<Partition> |
getPartitionIterator(PartitionSpec spec)
获取分区迭代器
|
Iterator<Partition> |
getPartitionIterator(PartitionSpec spec,
boolean reverse,
Long batchSize,
Long limit)
Get a partition iterator.
|
List<Partition> |
getPartitions()
获取所有分区信息
|
long |
getPhysicalSize()
查看表所占磁盘的物理大小
|
List<String> |
getPrimaryKey() |
String |
getProject()
获取表所属
Project 名称 |
long |
getRecordNum()
获取表的Record数, 若无准确数据,则返回-1
|
String |
getRefreshCron() |
List<Map<String,String>> |
getRefreshHistory() |
Integer |
getRefreshInterval() |
String |
getReserved()
返回扩展信息的保留字段
json 字符串
|
String |
getResources()
返回外部表使用的资源
|
TableSchema |
getSchema()
获取表结构定义
|
String |
getSchemaName()
Get the schema name.
|
Map<String,String> |
getSerDeProperties()
返回外部表序列化和反序列化属性
|
Shard |
getShard()
返回Shard
|
Map<String,Map<String,String>> |
getSimpleTags()
Get simple tags attached to this table.
|
Map<String,Map<String,String>> |
getSimpleTags(String columnName)
Get simple tags attached to a column of this table.
|
long |
getSize()
获取内部存储大小,单位:Byte
|
String |
getStorageHandler()
返回外部表数据处理句柄
|
StorageTierInfo |
getStorageTierInfo()
获取分层存储的相关信息,包括类型,大小,修改时间等等
|
List<String> |
getTableExtendedLabels() |
String |
getTableID()
获取表 ID
|
String |
getTableLabel() |
List<Tag> |
getTags()
Get
Tag (s) attached to this table. |
List<Tag> |
getTags(String columnName)
Get
Tag (s) attached to a column of this table. |
Table.TableType |
getType() |
String |
getViewExpandedText() |
String |
getViewText()
获取视图的文本内容
|
boolean |
hasPartition(PartitionSpec spec)
判断指定分区是否存在
|
boolean |
hasRowAccessPolicy() |
boolean |
isArchived()
查看表是否进行过归档操作
|
boolean |
isAutoRefreshEnabled() |
Boolean |
isAutoSubstituteEnabled() |
boolean |
isExternalTable()
判断表是否为外部表
|
boolean |
isMaterializedView()
Return if this table is a materialized view.
|
boolean |
isMaterializedViewOutdated()
Return if this materialized view is outdated.
|
boolean |
isMaterializedViewRewriteEnabled()
Return if this materialized view could be used by query rewrite.
|
boolean |
isPartitioned()
判断是否 Partition 表
|
boolean |
isTransactional()
查看表是否事务化
|
boolean |
isVirtualView()
判断表是否为虚拟视图
|
static Table.ClusterInfo |
parseClusterInfo(com.google.gson.JsonObject jsonObject) |
RecordReader |
read(int limit)
读取表内的数据
|
RecordReader |
read(PartitionSpec partition,
List<String> columns,
int limit)
读取表内的数据
读取数据时,最多返回 1W 条记录,若超过,数据将被截断。 另外,读取的数据大小不能超过 10MB,否则将抛出异常。 |
RecordReader |
read(PartitionSpec partition,
List<String> columns,
int limit,
String timezone)
读取表内的数据
读取数据时,最多返回 1W 条记录,若超过,数据将被截断。 另外,读取的数据大小不能超过 10MB,否则将抛出异常。 |
void |
reload()
重新加载属性值
|
void |
reload(com.aliyun.odps.Table.TableModel model) |
void |
reloadExtendInfo() |
void |
removeSimpleTag(String category,
String key,
String value)
Remove a simple tag.
|
void |
removeSimpleTag(String category,
String key,
String value,
List<String> columnNames)
Remove a simple tag from columns.
|
void |
removeTag(Tag tag)
Remove a
Tag . |
void |
removeTag(Tag tag,
List<String> columnNames)
Remove a
Tag from columns. |
void |
truncate()
删除表数据
|
public void reload() throws OdpsException
LazyLoad
reload
in class LazyLoad
OdpsException
public void reload(com.aliyun.odps.Table.TableModel model) throws OdpsException
OdpsException
public void reloadExtendInfo()
public String getName()
public String getComment()
public String getOwner()
public Table.TableType getType()
public Date getCreatedTime()
public String getTableLabel()
public StorageTierInfo getStorageTierInfo()
public List<Tag> getTags(String columnName)
Tag
(s) attached to a column of this table.Tag
public Map<String,Map<String,String>> getSimpleTags()
public Map<String,Map<String,String>> getSimpleTags(String columnName)
columnName
- column name.public void addTag(Tag tag) throws OdpsException
Tag
to this table. The table and tag should be in a same project.tag
- tag to attachOdpsException
public void addTag(Tag tag, List<String> columnNames) throws OdpsException
Tag
to this table. The table and tag should be in a same project.tag
- tag to attachcolumnNames
- column names, could be null.OdpsException
public void addSimpleTag(String category, String key, String value) throws OdpsException
category
- simple tag category, could be nul.key
- simple tag key, cannot be null.value
- simple tag value, cannot be null.OdpsException
public void addSimpleTag(String category, String key, String value, List<String> columnNames) throws OdpsException
category
- simple tag category, could be nul.key
- simple tag key, cannot be null.value
- simple tag value, cannot be null.columnNames
- column names, should not include any partition column, could be null.OdpsException
public void removeTag(Tag tag) throws OdpsException
Tag
.tag
- tag to remove.OdpsException
public void removeTag(Tag tag, List<String> columnNames) throws OdpsException
Tag
from columns.tag
- tag to remove.columnNames
- column names, should not include any partition column, could be null.OdpsException
public void removeSimpleTag(String category, String key, String value) throws OdpsException
category
- category.key
- key.value
- value.OdpsException
public void removeSimpleTag(String category, String key, String value, List<String> columnNames) throws OdpsException
category
- category.key
- key.value
- value.columnNames
- column names, should not include any partition column, could be null.OdpsException
public String getTableID()
public String getCryptoAlgoName()
public String getMaxExtendedLabel()
public String getMaxLabel()
二者是正交关系,即C1,C2,C3,C4,S1,S2,S3,S4,B1,B2,B3,B4。
MaxLabel的语意: 1. MaxLabel=max(TableLabel, ColumnLabel), max(...)函数的语意由Label中的数据等级决定:4>3>2>1 2. MaxLabel显示: 当最高等级Label只出现一次时,MaxLabel=业务分类+数据等级,例如:B4, C3,S2 当最高等级Labe出现多次,但业务分类也唯一,MaxLabel=业务分类+数据等级,例如:B4, C3,S2 当最高等级Labe出现多次,且业务不唯一,MaxLabel=L+数据等级,例如:L4, L3
public Date getLastMetaModifiedTime()
public String getSchemaName()
public boolean isVirtualView()
public boolean isMaterializedView()
public boolean isMaterializedViewRewriteEnabled()
IllegalStateException
- If this table is not a materialized view.public boolean isMaterializedViewOutdated()
IllegalStateException
- If this table is not a materialized view.public boolean isExternalTable()
public String getViewText()
public String getViewExpandedText()
public Date getLastDataModifiedTime()
public Date getLastDataAccessTime()
public long getSize()
public long getRecordNum()
public long getLife()
public long getHubLifecycle()
public TableSchema getSchema()
TableSchema
对象public String getJsonSchema()
public boolean isArchived()
public boolean isTransactional()
public long getPhysicalSize()
public long getFileNum()
public String getLocation()
public String getStorageHandler()
public String getResources()
public Map<String,String> getSerDeProperties()
public String getReserved()
public Table.ClusterInfo getClusterInfo()
public Shard getShard()
public RecordReader read(int limit) throws OdpsException
limit
- 最多读取的记录行数RecordReader
对象OdpsException
public RecordReader read(PartitionSpec partition, List<String> columns, int limit) throws OdpsException
partition
- 表的分区PartitionSpec
。如不指定分区可传入null。columns
- 所要读取的列名的列表。如果读取全表可传入nulllimit
- 最多读取的记录行数。RecordReader
对象OdpsException
public RecordReader read(PartitionSpec partition, List<String> columns, int limit, String timezone) throws OdpsException
partition
- 表的分区PartitionSpec
。如不指定分区可传入null。columns
- 所要读取的列名的列表。如果读取全表可传入nulllimit
- 最多读取的记录行数。timezone
- 设置 datetime 类型数据的时区RecordReader
对象OdpsException
public static Table.ClusterInfo parseClusterInfo(com.google.gson.JsonObject jsonObject)
public void createPartition(PartitionSpec spec) throws OdpsException
spec
- 分区定义 PartitionSpec
OdpsException
public void createPartition(PartitionSpec spec, boolean ifNotExists) throws OdpsException
spec
- 分区定义 PartitionSpec
ifNotExists
- 在创建分区时,如果为 false 而存在同名分区,则返回出错;若为 true,则无论是否存在同名分区,即使分区结构与要创建的目标分区结构不一致,均返回成功。已存在的同名分区的元信息不会被改动。OdpsException
public void deletePartition(PartitionSpec spec) throws OdpsException
spec
- 分区定义 PartitionSpec
OdpsException
public void deletePartition(PartitionSpec spec, boolean ifExists) throws OdpsException
spec
- 分区定义 PartitionSpec
ifExists
- 如果 false 而分区不存在,则返回异常;若为 true,无论分区是否存在,皆返回成功。OdpsException
public void createShards(long shardCount) throws OdpsException
shardCount
- 创建Shard的个数OdpsException
public Iterator<Partition> getPartitionIterator()
Partition
分区迭代器public Iterator<Partition> getPartitionIterator(PartitionSpec spec)
spec
- 指定的上级分区 PartitionSpec
Partition
迭代器public Iterator<Partition> getPartitionIterator(PartitionSpec spec, boolean reverse, Long batchSize, Long limit)
spec
- Specify the values of some of the partition columns. The specified columns'
indices should be continuous and start from 0.reverse
- Reverse the result. The originalbatchSize
- Max number of partitions to get per request. In case of null, the batch size
will be decided by the server.limit
- Limit the number of returned partitions. In case of null, Long.MAX_VALUE
will be used.public Partition getPartition(PartitionSpec spec)
spec
- 分区定义 PartitionSpec
Partition
public boolean hasPartition(PartitionSpec spec) throws OdpsException
spec
- 分区定义 PartitionSpec
OdpsException
public void truncate() throws OdpsException
OdpsException
public boolean isPartitioned() throws OdpsException
OdpsException
public boolean isAutoRefreshEnabled()
public Boolean isAutoSubstituteEnabled()
public Integer getRefreshInterval()
public String getRefreshCron()
public boolean hasRowAccessPolicy()
public int getAcidDataRetainHours()
Copyright © 2023 Alibaba Cloud Computing. All rights reserved.