15 package com.cloudera.impala.catalog;
17 import java.util.List;
20 import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
24 import com.cloudera.impala.thrift.TCatalogObjectType;
25 import com.cloudera.impala.thrift.TErrorCode;
26 import com.cloudera.impala.thrift.TStatus;
27 import com.cloudera.impala.thrift.TTable;
28 import com.cloudera.impala.thrift.TTableDescriptor;
29 import com.google.common.base.Joiner;
30 import com.google.common.collect.Lists;
45 super(
id, null, db, name, null);
69 throw new IllegalStateException(
cause_);
73 public void load(
Table oldValue, HiveMetaStoreClient client,
75 if (
cause_ instanceof TableLoadingException) {
76 throw (TableLoadingException)
cause_;
78 throw new TableLoadingException(
"Table metadata incomplete: ",
cause_);
85 table.setId(id_.asInt());
87 table.setLoad_status(
new TStatus(TErrorCode.INTERNAL_ERROR,
89 JniUtil.throwableToStackTrace(
cause_))));
96 if (thriftTable.isSetLoad_status()) {
105 List<String> errorMsgs = thriftTable.getLoad_status().getError_msgs();
106 String callStackStr =
"<None available>";
107 if (errorMsgs.size() > 1) callStackStr = errorMsgs.remove(errorMsgs.size() - 1);
109 String errorMsg = Joiner.on(
"\n").join(errorMsgs);
113 errorMsg = errorMsg.replaceFirst(
"^TableLoadingException: ",
"");
115 List<StackTraceElement> stackTrace =
116 Lists.newArrayList(loadingException.getStackTrace());
117 stackTrace.add(
new StackTraceElement(
"========",
118 "<Remote stack trace on catalogd>: " + callStackStr,
"", -1));
119 loadingException.setStackTrace(
120 stackTrace.toArray(
new StackTraceElement[stackTrace.size()]));
121 this.cause_ = loadingException;
TCatalogObjectType getCatalogObjectType()
static IncompleteTable createFailedMetadataLoadTable(TableId id, Db db, String name, ImpalaException e)
static IncompleteTable createUninitializedTable(TableId id, Db db, String name)
void load(Table oldValue, HiveMetaStoreClient client, org.apache.hadoop.hive.metastore.api.Table msTbl)
static String throwableToString(Throwable t)
TTableDescriptor toThriftDescriptor(Set< Long > referencedPartitions)
IncompleteTable(TableId id, Db db, String name, ImpalaException cause)
Table(TableId id, org.apache.hadoop.hive.metastore.api.Table msTable, Db db, String name, String owner)
ImpalaException getCause()
void loadFromThrift(TTable thriftTable)