public class Table extends LazyLoad
| 限定符和类型 | 方法和说明 |
|---|---|
void |
createPartition(PartitionSpec spec)
增加分区
|
void |
createPartition(PartitionSpec spec,
boolean ifNotExists)
增加分区
|
void |
createShards(long shardCount)
在Table上创建Shards
|
void |
createShards(long shardCount,
boolean enableHubTable,
long hubLifeCycle)
在HubTable上创建Shards,只能在HubTable上创建Shard,并且当前一个HubTable只能创建一次Shard,否则抛出OdpsException
|
void |
deletePartition(PartitionSpec spec)
删除指定分区
|
void |
deletePartition(PartitionSpec spec,
boolean ifExists)
删除指定分区
|
String |
getComment()
获取注释
|
Date |
getCreatedTime()
获取创建时间
|
long |
getFileNum()
返回表数据所占的盘古文件数
|
String |
getJsonSchema() |
Date |
getLastDataModifiedTime()
获取数据最后修改时间
|
Date |
getLastMetaModifiedTime()
获取最后修改时间
|
long |
getLife()
获取表的生命周期值,单位:天
|
String |
getName()
获取表名
|
String |
getOwner()
获取表所属用户
|
Partition |
getPartition(PartitionSpec spec)
获取指定分区信息
|
Iterator<Partition> |
getPartitionIterator()
获取分区迭代器
|
Iterator<Partition> |
getPartitionIterator(PartitionSpec spec)
获取分区迭代器
|
List<Partition> |
getPartitions()
获取所有分区信息
|
long |
getPhysicalSize()
查看表所占磁盘的物理大小
|
String |
getProject()
获取表所属
Project名称 |
TableSchema |
getSchema()
获取表结构定义
|
Shard |
getShard()
返回Shard
|
long |
getSize()
获取内部存储大小,单位:Byte
|
String |
getViewText()
获取视图的文本内容
|
boolean |
hasPartition(PartitionSpec spec)
判断指定分区是否存在
|
boolean |
isArchived()
查看表是否进行过归档操作
|
boolean |
isVirtualView()
判断表是否为虚拟视图
|
RecordReader |
read(int limit)
读取表内的数据
|
RecordReader |
read(PartitionSpec partition,
List<String> columns,
int limit)
读取表内的数据
读取数据时,最多返回 1W 条记录,若超过,数据将被截断。 |
void |
reload()
重新加载属性值
|
void |
truncate()
删除表数据
|
public void reload()
throws OdpsException
LazyLoadreload 在类中 LazyLoadOdpsExceptionpublic String getName()
public String getComment()
public String getOwner()
public Date getCreatedTime()
public Date getLastMetaModifiedTime()
public boolean isVirtualView()
public String getViewText()
public Date getLastDataModifiedTime()
public long getSize()
public long getLife()
public TableSchema getSchema()
TableSchema对象public String getJsonSchema()
public boolean isArchived()
public long getPhysicalSize()
public long getFileNum()
public Shard getShard()
public RecordReader read(int limit) throws OdpsException
limit - 最多读取的记录行数RecordReader对象OdpsExceptionpublic RecordReader read(PartitionSpec partition, List<String> columns, int limit) throws OdpsException
partition - 表的分区PartitionSpec。如不指定分区可传入null。columns - 所要读取的列名的列表。如果读取全表可传入nulllimit - 最多读取的记录行数。RecordReader对象OdpsExceptionpublic void createPartition(PartitionSpec spec) throws OdpsException
spec - 分区定义 PartitionSpecOdpsExceptionpublic void createPartition(PartitionSpec spec, boolean ifNotExists) throws OdpsException
spec - 分区定义 PartitionSpecifNotExists - 在创建分区时,如果为 false 而存在同名分区,则返回出错;若为 true,则无论是否存在同名分区,即使分区结构与要创建的目标分区结构不一致,均返回成功。已存在的同名分区的元信息不会被改动。OdpsExceptionpublic void deletePartition(PartitionSpec spec) throws OdpsException
spec - 分区定义 PartitionSpecOdpsExceptionpublic void deletePartition(PartitionSpec spec, boolean ifExists) throws OdpsException
spec - 分区定义 PartitionSpecifExists - 如果 false 而分区不存在,则返回异常;若为 true,无论分区是否存在,皆返回成功。OdpsExceptionpublic void createShards(long shardCount)
throws OdpsException
shardCount - 创建Shard的个数OdpsExceptionpublic void createShards(long shardCount,
boolean enableHubTable,
long hubLifeCycle)
throws OdpsException
shardCount - 创建Shard的个数enableHubTable - 是否是HubTablehubLifeCycle - Hub表的LifeCycleOdpsExceptionpublic Iterator<Partition> getPartitionIterator(PartitionSpec spec)
spec - 指定的上级分区 PartitionSpecPartition迭代器public Partition getPartition(PartitionSpec spec)
spec - 分区定义 PartitionSpecPartitionpublic boolean hasPartition(PartitionSpec spec) throws OdpsException
spec - 分区定义 PartitionSpecOdpsExceptionpublic void truncate()
throws OdpsException
OdpsExceptionCopyright © 2015 Alibaba Cloud Computing. All rights reserved.