hawq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hornn <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request: HAWQ 459 Enhanced metadata api to sup...
Date Tue, 22 Mar 2016 03:37:46 GMT
Github user hornn commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/477#discussion_r56933465
  
    --- Diff: pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/rest/MetadataResource.java
---
    @@ -56,51 +61,53 @@ public MetadataResource() throws IOException {
         }
     
         /**
    -     * This function queries the HiveMetaStore to get the given table's
    -     * metadata: Table name, field names, field types. The types are converted
    -     * from HCatalog types to HAWQ types. Supported HCatalog types: TINYINT,
    -     * SMALLINT, INT, BIGINT, BOOLEAN, FLOAT, DOUBLE, STRING, BINARY, TIMESTAMP,
    -     * DATE, DECIMAL, VARCHAR, CHAR. <br>
    +     * This function queries the underlying store based on the given profile to get schema
for items that match the given pattern
    +     * metadata: Item name, field names, field types. The types are converted
    +     * from the underlying types to HAWQ types.
          * Unsupported types result in an error. <br>
          * Response Examples:<br>
          * For a table <code>default.t1</code> with 2 fields (a int, b float)
will
          * be returned as:
    -     * <code>{"PXFMetadata":[{"table":{"dbName":"default","tableName":"t1"},"fields":[{"name":"a","type":"int"},{"name":"b","type":"float"}]}]}</code>
    +     * <code>{"PXFMetadata":[{"item":{"path":"default","name":"t1"},"fields":[{"name":"a","type":"int"},{"name":"b","type":"float"}]}]}</code>
          *
          * @param servletContext servlet context
          * @param headers http headers
    -     * @param table HCatalog table name
    -     * @return JSON formatted response with metadata for given table
    -     * @throws Exception if connection to Hcatalog failed, table didn't exist or
    +     * @param profile based on this the metadata source can be inferred
    +     * @param pattern table/file name or pattern in the given source
    +     * @return JSON formatted response with metadata of each item that corresponds to
the pattern
    +     * @throws Exception if connection to the source/catalog failed, item didn't exist
for the pattern
          *             its type or fields are not supported
          */
         @GET
    -    @Path("getTableMetadata")
    +    @Path("getMetadata")
         @Produces("application/json")
         public Response read(@Context final ServletContext servletContext,
                              @Context final HttpHeaders headers,
    -                         @QueryParam("table") final String table)
    +                         @QueryParam("profile") final String profile,
    +                         @QueryParam("pattern") final String pattern)
                 throws Exception {
    -        LOG.debug("getTableMetadata started");
    +        LOG.debug("getMetadata started");
             String jsonOutput;
             try {
    +
    +            // Convert headers into a regular map
    +            Map<String, String> params = convertToCaseInsensitiveMap(headers.getRequestHeaders());
    +
    +            // Add profile and verify token
    +            params.put("X-GP-PROFILE", profile.toLowerCase());
    +            ProtocolData protData = new ProtocolData(params);
    +            SecuredHDFS.verifyToken(protData, servletContext);
    +
                 // 1. start MetadataFetcher
    -            MetadataFetcher metadataFetcher = MetadataFetcherFactory.create("org.apache.hawq.pxf.plugins.hive.HiveMetadataFetcher");
// TODO:
    -                                                                                    
                                                // nhorn
    -                                                                                    
                                                // -
    -                                                                                    
                                                // 09-03-15
    -                                                                                    
                                                // -
    -                                                                                    
                                                // pass
    -                                                                                    
                                                // as
    -                                                                                    
                                                // param
    +            MetadataFetcher metadataFetcher = MetadataFetcherFactory.create(protData);
    --- End diff --
    
    aweome!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message