MCPcopy Create free account
hub / github.com/ddf-project/DDF / describeTable

Method describeTable

core/src/main/java/io/ddf/etl/ASqlHandler.java:62–91  ·  view source on GitHub ↗

@brief Get the column information of this table. @param name The URI or the name of the ddf. @param namespace The namespace. @return The column information. @throws DDFException

(String name, String namespace)

Source from the content-addressed store, hash-verified

60 * @throws DDFException
61 */
62 private SqlResult describeTable(String name, String namespace)
63 throws DDFException {
64 DDF ddf = null;
65 try {
66 ddf = this.getManager().getOrRestoreDDFUri(name);
67 } catch (Exception e) {
68 if (null == namespace) {
69 throw new DDFException("ERROR: there is no ddf " + name);
70 }
71 try {
72 mLog.info("trying to restore " + "ddf://" + namespace + "/" + name);
73 ddf = this.getManager().getOrRestoreDDFUri("ddf://" + namespace + "/" + name);
74 } catch (Exception e2) {
75 throw new DDFException("ERROR: there is no ddf " + name);
76 }
77 }
78
79 int colSize = ddf.getNumColumns();
80 List<String> ret = new ArrayList<String>();
81 for (int colIdx = 0; colIdx < colSize; ++colIdx) {
82 Schema.Column col = ddf.getColumn(ddf.getColumnName(colIdx));
83 ret.add(col.getName().concat("\t").concat(col.getType().toString()
84 .toLowerCase()));
85 }
86 List<Column> columnList = new ArrayList<Column>();
87 columnList.add(new Column("column_name", Schema.ColumnType.STRING));
88 columnList.add(new Column("value_type", Schema.ColumnType.STRING));
89 Schema schema = new Schema("table_info", columnList);
90 return new SqlResult(schema, ret);
91 }
92
93 public SqlResult sqlHandle(String command,
94 Integer maxRows,

Callers 1

sqlHandleMethod · 0.95

Calls 9

getNumColumnsMethod · 0.95
getColumnMethod · 0.95
getColumnNameMethod · 0.95
addMethod · 0.65
getNameMethod · 0.65
getOrRestoreDDFUriMethod · 0.45
getManagerMethod · 0.45
toStringMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected