[ 
https://issues.apache.org/jira/browse/NIFI-3093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15709122#comment-15709122
 ] 

ASF GitHub Bot commented on NIFI-3093:
--------------------------------------

Github user patricker commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1281#discussion_r90278242
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/HiveDatabaseAdapter.java
 ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.processors.standard.db.impl;
    +
    +
    +import org.apache.commons.lang3.StringUtils;
    +import org.apache.nifi.processors.standard.db.DatabaseAdapter;
    +
    +public class HiveDatabaseAdapter implements DatabaseAdapter {
    +    @Override
    +    public String getName() {
    +        return "Hive";
    +    }
    +
    +    @Override
    +    public boolean getSupportsStatementTimeout() {
    +        return false;
    +    }
    +
    +    @Override
    +    public boolean getSupportsGetTableName() {
    +        return false;
    +    }
    +
    +    @Override
    +    public boolean getSupportsMetaDataColumnIsSigned() {
    +        return false;
    +    }
    +
    +    @Override
    +    public boolean getSupportsMetaDataColumnGetPrecision() {
    +        return false;
    +    }
    +
    +    @Override
    +    public String getSelectStatement(String tableName, String columnNames, 
String whereClause, String orderByClause, Integer limit, Integer offset) {
    +        if (StringUtils.isEmpty(tableName)) {
    +            throw new IllegalArgumentException("Table name cannot be null 
or empty");
    +        }
    +        final StringBuilder query = new StringBuilder("SELECT ");
    +        if (StringUtils.isEmpty(columnNames) || 
columnNames.trim().equals("*")) {
    +            query.append("*");
    +        } else {
    +            query.append(columnNames);
    +        }
    +        query.append(" FROM ");
    +        query.append(tableName);
    +
    +        if (!StringUtils.isEmpty(whereClause)) {
    +            query.append(" WHERE ");
    +            query.append(whereClause);
    +        }
    +        if (!StringUtils.isEmpty(orderByClause)) {
    +            query.append(" ORDER BY ");
    +            query.append(orderByClause);
    +        }
    +        if (limit != null) {
    +            query.append(" LIMIT ");
    +            query.append(limit);
    +        }
    +        if (offset != null && offset > 0) {
    +            query.append(" OFFSET ");
    --- End diff --
    
    @mattyb149 I copy/pasted this from the Generic adapter, but from what I can 
find HIVE has no support for `OFFSET`. Do you think this should throw an 
exception at this stage?


> HIVE Support for QueryDatabaseTable
> -----------------------------------
>
>                 Key: NIFI-3093
>                 URL: https://issues.apache.org/jira/browse/NIFI-3093
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 1.2.0
>            Reporter: Peter Wicks
>            Assignee: Peter Wicks
>
> Update Query Database Table so that it can pull data from HIVE tables.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to