本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.getViewExpandedText()
方法的一些代码示例,展示了Table.getViewExpandedText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getViewExpandedText()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:getViewExpandedText
暂无
代码示例来源:origin: apache/hive
/**
* @return the expanded view text, or null if this table is not a view
*/
public String getViewExpandedText() {
return tTable.getViewExpandedText();
}
代码示例来源:origin: apache/drill
/**
* @return the expanded view text, or null if this table is not a view
*/
public String getViewExpandedText() {
return tTable.getViewExpandedText();
}
代码示例来源: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
return getViewExpandedText();
代码示例来源:origin: apache/hive
Assert.assertNull("Comparing ViewExpandedText", createdTable.getViewExpandedText());
Assert.assertEquals("Comparing TableType", "MANAGED_TABLE", createdTable.getTableType());
Assert.assertTrue("Creation metadata should be empty", createdTable.getCreationMetadata() == null);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
/**
* @return the expanded view text, or null if this table is not a view
*/
public String getViewExpandedText() {
return tTable.getViewExpandedText();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* @return the expanded view text, or null if this table is not a view
*/
public String getViewExpandedText() {
return tTable.getViewExpandedText();
}
代码示例来源: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: 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: 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: com.hotels/circus-train-hive-view
private void validateReferencedTables(Table view) {
TableProcessor processor = new TableProcessor();
HiveLanguageParser parser = new HiveLanguageParser(new HiveConf());
parser.parse(view.getViewExpandedText(), processor);
try (CloseableMetaStoreClient replicaClient = replicaMetaStoreClientSupplier.get()) {
for (String replicaTable : processor.getTables()) {
String[] nameParts = MetaStoreUtils.getQualifiedName(null, replicaTable);
try {
replicaClient.getTable(nameParts[0], nameParts[1]);
} catch (NoSuchObjectException e) {
String message = String.format("Table or view %s does not exists in replica catalog", replicaTable);
throw new CircusTrainException(message, e);
} catch (Exception e) {
String message = String
.format("Unable to validate tables used by view %s.%s", view.getDbName(), view.getTableName());
throw new CircusTrainException(message, e);
}
}
}
}
代码示例来源:origin: HotelsDotCom/circus-train
private void validateReferencedTables(Table view) {
TableProcessor processor = new TableProcessor();
HiveLanguageParser parser = new HiveLanguageParser(new HiveConf());
parser.parse(view.getViewExpandedText(), processor);
try (CloseableMetaStoreClient replicaClient = replicaMetaStoreClientSupplier.get()) {
for (String replicaTable : processor.getTables()) {
String[] nameParts = MetaStoreUtils.getQualifiedName(null, replicaTable);
try {
replicaClient.getTable(nameParts[0], nameParts[1]);
} catch (NoSuchObjectException e) {
String message = String.format("Table or view %s does not exists in replica catalog", replicaTable);
throw new CircusTrainException(message, e);
} catch (Exception e) {
String message = String
.format("Unable to validate tables used by view %s.%s", view.getDbName(), view.getTableName());
throw new CircusTrainException(message, e);
}
}
}
}
代码示例来源: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: 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;
}
代码示例来源:origin: edu.berkeley.cs.shark/hive-metastore
.getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(),
convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(),
tbl.getViewOriginalText(), tbl.getViewExpandedText(),
tableType);
代码示例来源:origin: org.spark-project.hive/hive-metastore
.getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(),
convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(),
tbl.getViewOriginalText(), tbl.getViewExpandedText(),
tableType);
内容来源于网络,如有侵权,请联系作者删除!