本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.getViewOriginalText()
方法的一些代码示例,展示了Table.getViewOriginalText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getViewOriginalText()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:getViewOriginalText
暂无
代码示例来源:origin: apache/hive
/**
* @return the original view text, or null if this table is not a view
*/
public String getViewOriginalText() {
return tTable.getViewOriginalText();
}
代码示例来源:origin: apache/drill
/**
* @return the original view text, or null if this table is not a view
*/
public String getViewOriginalText() {
return tTable.getViewOriginalText();
}
代码示例来源:origin: prestodb/presto
public static Table fromMetastoreApiTable(org.apache.hadoop.hive.metastore.api.Table table, List<FieldSchema> schema)
{
StorageDescriptor storageDescriptor = table.getSd();
if (storageDescriptor == null) {
throw new PrestoException(HIVE_INVALID_METADATA, "Table is missing storage descriptor");
}
Table.Builder tableBuilder = Table.builder()
.setDatabaseName(table.getDbName())
.setTableName(table.getTableName())
.setOwner(nullToEmpty(table.getOwner()))
.setTableType(table.getTableType())
.setDataColumns(schema.stream()
.map(ThriftMetastoreUtil::fromMetastoreApiFieldSchema)
.collect(toList()))
.setPartitionColumns(table.getPartitionKeys().stream()
.map(ThriftMetastoreUtil::fromMetastoreApiFieldSchema)
.collect(toList()))
.setParameters(table.getParameters() == null ? ImmutableMap.of() : table.getParameters())
.setViewOriginalText(Optional.ofNullable(emptyToNull(table.getViewOriginalText())))
.setViewExpandedText(Optional.ofNullable(emptyToNull(table.getViewExpandedText())));
fromMetastoreApiStorageDescriptor(storageDescriptor, tableBuilder.getStorageBuilder(), table.getTableName());
return tableBuilder.build();
}
代码示例来源:origin: apache/hive
.getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(),
convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(),
tbl.getViewOriginalText(), tbl.getViewExpandedText(), tbl.isRewriteEnabled(),
tableType);
return mtable;
代码示例来源:origin: apache/hive
if (tableType == null) {
if (tbl.getViewOriginalText() != null) {
tableType = TableType.VIRTUAL_VIEW.toString();
} else if ("TRUE".equals(tbl.getParameters().get("EXTERNAL"))) {
代码示例来源:origin: apache/hive
return getViewOriginalText();
代码示例来源:origin: apache/hive
Assert.assertNull("Comparing ViewOriginalText", createdTable.getViewOriginalText());
Assert.assertNull("Comparing ViewExpandedText", createdTable.getViewExpandedText());
Assert.assertEquals("Comparing TableType", "MANAGED_TABLE", createdTable.getTableType());
代码示例来源:origin: com.facebook.presto.hive/hive-apache
/**
* @return the original view text, or null if this table is not a view
*/
public String getViewOriginalText() {
return tTable.getViewOriginalText();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* @return the original view text, or null if this table is not a view
*/
public String getViewOriginalText() {
return tTable.getViewOriginalText();
}
代码示例来源:origin: dremio/dremio-oss
static int getHash(Table table) {
return Objects.hashCode(
table.getTableType(),
table.getParameters(),
table.getPartitionKeys(),
table.getSd(),
table.getViewExpandedText(),
table.getViewOriginalText());
}
代码示例来源:origin: Netflix/metacat
private void validAndUpdateVirtualView(final Table table) {
if (isVirtualView(table)
&& Strings.isNullOrEmpty(table.getViewOriginalText())) {
throw new MetacatBadRequestException(
String.format("Invalid view creation for %s/%s. Missing viewOrginialText",
table.getDbName(),
table.getDbName()));
}
if (Strings.isNullOrEmpty(table.getViewExpandedText())) {
//set viewExpandedText to viewOriginalTest
table.setViewExpandedText(table.getViewOriginalText());
}
//setting dummy string to view to avoid dropping view issue in hadoop Path org.apache.hadoop.fs
if (Strings.isNullOrEmpty(table.getSd().getLocation())) {
table.getSd().setLocation("file://tmp/" + table.getDbName() + "/" + table.getTableName());
}
}
代码示例来源:origin: com.netflix.metacat/metacat-connector-hive
private void validAndUpdateVirtualView(final Table table) {
if (isVirtualView(table)
&& Strings.isNullOrEmpty(table.getViewOriginalText())) {
throw new MetacatBadRequestException(
String.format("Invalid view creation for %s/%s. Missing viewOrginialText",
table.getDbName(),
table.getDbName()));
}
if (Strings.isNullOrEmpty(table.getViewExpandedText())) {
//set viewExpandedText to viewOriginalTest
table.setViewExpandedText(table.getViewOriginalText());
}
//setting dummy string to view to avoid dropping view issue in hadoop Path org.apache.hadoop.fs
if (Strings.isNullOrEmpty(table.getSd().getLocation())) {
table.getSd().setLocation("file://tmp/" + table.getDbName() + "/" + table.getTableName());
}
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-hive
@Override
public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)
{
ImmutableMap.Builder<SchemaTableName, ConnectorViewDefinition> views = ImmutableMap.builder();
List<SchemaTableName> tableNames;
if (prefix.getTableName() != null) {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
else {
tableNames = listViews(session, prefix.getSchemaName());
}
for (SchemaTableName schemaTableName : tableNames) {
Optional<Table> table = metastore.getTable(schemaTableName.getSchemaName(), schemaTableName.getTableName());
if (table.isPresent() && HiveUtil.isPrestoView(table.get())) {
views.put(schemaTableName, new ConnectorViewDefinition(
schemaTableName,
Optional.ofNullable(table.get().getOwner()),
decodeViewData(table.get().getViewOriginalText())));
}
}
return views.build();
}
代码示例来源:origin: prestosql/presto
public static Table fromMetastoreApiTable(org.apache.hadoop.hive.metastore.api.Table table, List<FieldSchema> schema)
{
StorageDescriptor storageDescriptor = table.getSd();
if (storageDescriptor == null) {
throw new PrestoException(HIVE_INVALID_METADATA, "Table is missing storage descriptor");
}
Table.Builder tableBuilder = Table.builder()
.setDatabaseName(table.getDbName())
.setTableName(table.getTableName())
.setOwner(nullToEmpty(table.getOwner()))
.setTableType(table.getTableType())
.setDataColumns(schema.stream()
.map(ThriftMetastoreUtil::fromMetastoreApiFieldSchema)
.collect(toList()))
.setPartitionColumns(table.getPartitionKeys().stream()
.map(ThriftMetastoreUtil::fromMetastoreApiFieldSchema)
.collect(toList()))
.setParameters(table.getParameters() == null ? ImmutableMap.of() : table.getParameters())
.setViewOriginalText(Optional.ofNullable(emptyToNull(table.getViewOriginalText())))
.setViewExpandedText(Optional.ofNullable(emptyToNull(table.getViewExpandedText())));
fromMetastoreApiStorageDescriptor(storageDescriptor, tableBuilder.getStorageBuilder(), table.getTableName());
return tableBuilder.build();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-metastore
return getViewOriginalText();
代码示例来源:origin: Netflix/metacat
/**
* {@inheritDoc}
*/
@Override
public TableDto hiveToMetacatTable(final QualifiedName name, final Table table) {
final TableDto dto = new TableDto();
dto.setSerde(toStorageDto(table.getSd(), table.getOwner()));
dto.setAudit(new AuditDto());
dto.setName(name);
if (table.isSetCreateTime()) {
dto.getAudit().setCreatedDate(epochSecondsToDate(table.getCreateTime()));
}
dto.setMetadata(table.getParameters());
final List<FieldSchema> nonPartitionColumns = table.getSd().getCols();
final List<FieldSchema> partitionColumns = table.getPartitionKeys();
final List<FieldDto> allFields =
Lists.newArrayListWithCapacity(nonPartitionColumns.size() + partitionColumns.size());
nonPartitionColumns.stream()
.map(field -> this.hiveToMetacatField(field, false))
.forEachOrdered(allFields::add);
partitionColumns.stream()
.map(field -> this.hiveToMetacatField(field, true))
.forEachOrdered(allFields::add);
dto.setFields(allFields);
dto.setView(new ViewDto(table.getViewOriginalText(),
table.getViewExpandedText()));
return dto;
}
代码示例来源:origin: com.netflix.metacat/metacat-thrift
/**
* {@inheritDoc}
*/
@Override
public TableDto hiveToMetacatTable(final QualifiedName name, final Table table) {
final TableDto dto = new TableDto();
dto.setSerde(toStorageDto(table.getSd(), table.getOwner()));
dto.setAudit(new AuditDto());
dto.setName(name);
if (table.isSetCreateTime()) {
dto.getAudit().setCreatedDate(epochSecondsToDate(table.getCreateTime()));
}
dto.setMetadata(table.getParameters());
final List<FieldSchema> nonPartitionColumns = table.getSd().getCols();
final List<FieldSchema> partitionColumns = table.getPartitionKeys();
final List<FieldDto> allFields =
Lists.newArrayListWithCapacity(nonPartitionColumns.size() + partitionColumns.size());
nonPartitionColumns.stream()
.map(field -> this.hiveToMetacatField(field, false))
.forEachOrdered(allFields::add);
partitionColumns.stream()
.map(field -> this.hiveToMetacatField(field, true))
.forEachOrdered(allFields::add);
dto.setFields(allFields);
dto.setView(new ViewDto(table.getViewOriginalText(),
table.getViewExpandedText()));
return dto;
}
代码示例来源:origin: HotelsDotCom/circus-train
@Override
public Table transform(Table table) {
if (!MetaStoreUtils.isView(table)) {
return table;
}
LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName());
String tableQualifiedName = Warehouse.getQualifiedName(table);
String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOriginalText());
String expandedHql = hqlTranslator.translate(tableQualifiedName, table.getViewExpandedText());
Table transformedView = new Table(table);
transformedView.setViewOriginalText(hql);
transformedView.setViewExpandedText(expandedHql);
if (!replicaHiveConf.getBoolean(SKIP_TABLE_EXIST_CHECKS, false)) {
LOG
.info("Validating that tables used by the view {}.{} exist in the replica catalog", table.getDbName(),
table.getTableName());
validateReferencedTables(transformedView);
}
return transformedView;
}
代码示例来源:origin: edu.berkeley.cs.shark/hive-metastore
.getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(),
convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(),
tbl.getViewOriginalText(), tbl.getViewExpandedText(),
tableType);
代码示例来源:origin: com.hotels/circus-train-hive-view
@Override
public Table transform(Table table) {
if (!MetaStoreUtils.isView(table)) {
return table;
}
LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName());
String tableQualifiedName = Warehouse.getQualifiedName(table);
String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOriginalText());
String expandedHql = hqlTranslator.translate(tableQualifiedName, table.getViewExpandedText());
Table transformedView = new Table(table);
transformedView.setViewOriginalText(hql);
transformedView.setViewExpandedText(expandedHql);
if (!replicaHiveConf.getBoolean(SKIP_TABLE_EXIST_CHECKS, false)) {
LOG
.info("Validating that tables used by the view {}.{} exist in the replica catalog", table.getDbName(),
table.getTableName());
validateReferencedTables(transformedView);
}
return transformedView;
}
内容来源于网络,如有侵权,请联系作者删除!