ROdps { public List<DataFrameItem> describeTable(String projectName, String tableName, String partition) throws ROdpsException, OdpsException { Table tbl = odps.tables().get(this.getProjectName(projectName), tableName); List<DataFrameItem> ps = new ArrayList<DataFrameItem>(); if (partition != null) { partition = this.formatPartition(partition, "'", ","); } try { tbl.reload(); ps.add(this.createSingleValueFrame("owner", "String", tbl.getOwner())); ps.add(this.createSingleValueFrame("project", "String", tbl.getProject())); ps.add(this.createSingleValueFrame("comment", "String", tbl.getComment())); ps.add(this.createSingleValueFrame("create_time", "DateTime", formatDateTime(tbl.getCreatedTime()))); ps.add(this.createSingleValueFrame("last_modified_time", "DateTime", formatDateTime(tbl.getLastMetaModifiedTime()))); ps.add(this.createSingleValueFrame("is_internal_table", "boolean", tbl.isVirtualView())); if (tbl.isVirtualView()) { long size = tbl.getPhysicalSize(); if (partition == null || partition.isEmpty()) { ps.add(this.createSingleValueFrame("size", "Long", size)); } else { ps.add(this.createSingleValueFrame("partition_size", "Long", size)); ps.add(this.createSingleValueFrame("partition_name", "String", partition)); } } Map<String, Schema> columns = this.createSchema(tbl.getJsonSchema(), "columns"); DataFrameItem item = new DataFrameItem("columns", "string"); for (Map.Entry<String, Schema> entry : columns.entrySet()) { item.getData().add(entry.getValue().toString()); } ps.add(item); Map<String, Schema> ptKeys = this.createSchema(tbl.getJsonSchema(), "partitionKeys"); if (ptKeys != null && ptKeys.size() > 0) { DataFrameItem ptItem = new DataFrameItem("partition_keys", "String"); for (Map.Entry<String, Schema> entry : ptKeys.entrySet()) { ptItem.getData().add(entry.getValue().toString()); } ps.add(ptItem); } return ps; } catch (Exception e) { LOG.error(e); throw new ROdpsException(e); } } ROdps(String projectName, String accessID, String accessKey, String endPoint,
      String dtEndpoint, String logviewHost, String log4j_properties); void setBizId(String s); void set(String key, String value); void unset(String key); void writeTableFromDT(String projectName, String tableName, String partition,
      String dataFilePathName, String columnDelimiter, String rowDelimiter, long recordCount,
      int threadNumber); List<List<String>> loadTableFromDT(String projectName, String tableName, String partition,
      String tempFile, String colDelimiter, String rowDelimiter, int limit, int threadNumber); boolean useProject(String projectName); String getProjectName(String projectName); long getTableSize(String projectName, String tableName, String partition); List<DataFrameItem> describeTable(String projectName, String tableName, String partition); boolean dropTable(String projectName, String tableName); boolean isTableExist(String projectName, String tableName, String partition); String getTableSchemaJson(String projectName, String tableName); int getIndexFromColName(String colName, String tableSchemaJson); List<String> runSqlTask(String sql); List<DataFrameItem> getTables(String projectName, String pattern); static String formatPartition(String part, String valueDim, String fieldDim); boolean setLogPath(String log_path);  }
@Test public void test_DescribeTable() throws ROdpsException, OdpsException { List<DataFrameItem> ret = rodps.describeTable(null, table, null); for (DataFrameItem d : ret) { List res = d.getData(); System.out.println(d.getName()); System.out.println(res); } assertNotNull(ret); }