public class Table extends LazyLoad
Modifier and Type | Class and Description |
---|---|
static class |
Table.ClusterInfo |
Modifier and Type | Method and Description |
---|---|
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)
删除指定分区
|
Table.ClusterInfo |
getClusterInfo()
返回 cluster range 表的 cluster 信息
|
String |
getComment()
获取注释
|
Date |
getCreatedTime()
获取创建时间
|
String |
getCryptoAlgoName()
获取表加密算法名称
|
long |
getFileNum()
返回表数据所占的盘古文件数
|
long |
getHubLifecycle()
获取表的datahub生命周期值,单位:天
|
String |
getJsonSchema() |
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)
获取分区迭代器
|
List<Partition> |
getPartitions()
获取所有分区信息
|
long |
getPhysicalSize()
查看表所占磁盘的物理大小
|
String |
getProject()
获取表所属
Project 名称 |
String |
getReserved()
返回扩展信息的保留字段
json 字符串
|
String |
getResources()
返回外部表使用的资源
|
TableSchema |
getSchema()
获取表结构定义
|
Map<String,String> |
getSerDeProperties()
返回外部表序列化和反序列化属性
|
Shard |
getShard()
返回Shard
|
long |
getSize()
获取内部存储大小,单位:Byte
|
String |
getStorageHandler()
返回外部表数据处理句柄
|
List<String> |
getTableExtendedLabels() |
String |
getTableID()
获取表 ID
|
String |
getTableLabel() |
String |
getViewText()
获取视图的文本内容
|
boolean |
hasPartition(PartitionSpec spec)
判断指定分区是否存在
|
boolean |
isArchived()
查看表是否进行过归档操作
|
boolean |
isExternalTable()
判断表是否为外部表
|
boolean |
isPartitioned()
判断是否 Partition 表
|
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 |
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 String getName()
public String getComment()
public String getOwner()
public Date getCreatedTime()
public String getTableLabel()
public String getTableID()
public String getCryptoAlgoName()
public String getMaxExtendedLabel()
public String getMaxLabel()
public Date getLastMetaModifiedTime()
public boolean isVirtualView()
public boolean isExternalTable()
public String getViewText()
public Date getLastDataModifiedTime()
public long getSize()
public long getLife()
public long getHubLifecycle()
public TableSchema getSchema()
TableSchema
对象public String getJsonSchema()
public boolean isArchived()
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 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
Copyright © 2019 Alibaba Cloud Computing. All rights reserved.