Search in sources :

Example 1 with ColumnsArgs

use of co.cask.cdap.explore.utils.ColumnsArgs in project cdap by caskdata.

the class ExploreHttpClient method getColumns.

@Override
public QueryHandle getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws ExploreException, SQLException {
    String body = GSON.toJson(new ColumnsArgs(catalog, schemaPattern, tableNamePattern, columnNamePattern));
    String resource = String.format("namespaces/%s/data/explore/jdbc/columns", schemaPattern);
    HttpResponse response = doPost(resource, body, null);
    if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
        return QueryHandle.fromId(parseResponseAsMap(response, "handle"));
    }
    throw new ExploreException("Cannot get the columns. Reason: " + response);
}
Also used : ColumnsArgs(co.cask.cdap.explore.utils.ColumnsArgs) HttpResponse(co.cask.common.http.HttpResponse) ExploreException(co.cask.cdap.explore.service.ExploreException)

Aggregations

ExploreException (co.cask.cdap.explore.service.ExploreException)1 ColumnsArgs (co.cask.cdap.explore.utils.ColumnsArgs)1 HttpResponse (co.cask.common.http.HttpResponse)1