Skip to content

Commit

Permalink
Avoid throwing exception if fails to get columns using deserializer (#94
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ljfgem authored Jun 1, 2021
1 parent 3af358b commit 3c23a3d
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.apache.hadoop.hive.serde2.Deserializer;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;

import com.linkedin.coral.com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
Expand All @@ -50,6 +50,7 @@
*/
public class HiveTable implements ScannableTable {

private static final Logger LOG = LoggerFactory.getLogger(HiveTable.class);
protected final org.apache.hadoop.hive.metastore.api.Table hiveTable;
private Deserializer deserializer;

Expand Down Expand Up @@ -162,8 +163,10 @@ private List<FieldSchema> getColumns() {
try {
return MetaStoreUtils.getFieldsFromDeserializer(hiveTable.getTableName(), getDeserializer());
} catch (Exception e) {
Throwables.propagateIfInstanceOf(e, RuntimeException.class);
throw new RuntimeException("Failed to get columns using deserializer", e);
// if there is an exception like failing to get the deserializer or failing to get columns using deserializer,
// we use sd.getCols() to avoid throwing exception
LOG.warn("Failed to get columns using deserializer", e);
return sd.getCols();
}
}
}
Expand Down

0 comments on commit 3c23a3d

Please sign in to comment.