View implementation corresponding to the LocalCatalog. NOTE: this does _not_ implement "local views" in the sense of a view defined in the scope of a query using a WITH expression.
| 37 | * in the scope of a query using a WITH expression. |
| 38 | */ |
| 39 | public class LocalView extends LocalTable implements FeView { |
| 40 | private final QueryStmt queryStmt_; |
| 41 | |
| 42 | public LocalView(LocalDb db, Table msTbl, TableMetaRef ref) { |
| 43 | super(db, msTbl, ref); |
| 44 | |
| 45 | try { |
| 46 | queryStmt_ = View.parseViewDef(this); |
| 47 | } catch (TableLoadingException e) { |
| 48 | throw new LocalCatalogException(e); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | @Override |
| 53 | public TImpalaTableType getTableType() { |
| 54 | return TImpalaTableType.VIEW; |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public TTableDescriptor toThriftDescriptor(int tableId, |
| 59 | Set<Long> referencedPartitions) { |
| 60 | // Views are always resolved into underlying tables before being serialized. |
| 61 | throw new IllegalStateException("Cannot call toThriftDescriptor() on a view."); |
| 62 | } |
| 63 | |
| 64 | // NOTE: "local view" in this context means "a view defined local to a query" |
| 65 | // whereas "local" in the class name "LocalView" means "view from the |
| 66 | // LocalCatalog catalog implementation". |
| 67 | @Override |
| 68 | public boolean isLocalView() { |
| 69 | // TODO: the org.apache.impala.catalog.View class is still used for local views |
| 70 | // even in the LocalCatalog implementation. |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public QueryStmt getQueryStmt() { |
| 76 | return queryStmt_; |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public List<String> getColLabels() { |
| 81 | // Explicit column labels are only used by local views. |
| 82 | // Returning null indicates that the column labels are derived |
| 83 | // from the underlying statement. |
| 84 | return null; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public TCatalogObjectType getCatalogObjectType() { |
| 89 | return TCatalogObjectType.VIEW; |
| 90 | } |
| 91 | } |
nothing calls this directly
no outgoing calls
no test coverage detected