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

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

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

    https://github.com/apache/nifi/pull/372#discussion_r60474410
  
    --- Diff: 
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java
 ---
    @@ -0,0 +1,184 @@
    +/*
    + * 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.dbcp.hive;
    +
    +import org.apache.commons.dbcp.BasicDataSource;
    +import org.apache.hive.jdbc.HiveDriver;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.annotation.lifecycle.OnDisabled;
    +import org.apache.nifi.annotation.lifecycle.OnEnabled;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.controller.AbstractControllerService;
    +import org.apache.nifi.controller.ConfigurationContext;
    +import org.apache.nifi.controller.ControllerServiceInitializationContext;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.apache.nifi.processor.util.StandardValidators;
    +import org.apache.nifi.reporting.InitializationException;
    +
    +import java.sql.Connection;
    +import java.sql.SQLException;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.List;
    +import java.util.concurrent.TimeUnit;
    +
    +/**
    + * Implementation for Database Connection Pooling Service used for Apache 
Hive connections. Apache DBCP is used for connection pooling functionality.
    + */
    +@Tags({"hive", "dbcp", "jdbc", "database", "connection", "pooling", 
"store"})
    +@CapabilityDescription("Provides Database Connection Pooling Service for 
Apache Hive. Connections can be asked from pool and returned after usage.")
    +public class HiveConnectionPool extends AbstractControllerService 
implements HiveDBCPService {
    +
    +    public static final PropertyDescriptor DATABASE_URL = new 
PropertyDescriptor.Builder()
    +            .name("Database Connection URL")
    +            .description("A database connection URL used to connect to a 
database. May contain database system name, host, port, database name and some 
parameters."
    +                    + " The exact syntax of a database connection URL is 
specified by the Hive documentation. For example, the server principal is often 
included "
    +                    + "as a connection parameter when connecting to a 
secure Hive server.")
    +            .defaultValue(null)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .required(true)
    +            .build();
    +
    +    public static final PropertyDescriptor HIVE_CONFIGURATION_RESOURCES = 
new PropertyDescriptor.Builder().name("Hive Configuration Resources")
    +            .description("A file or comma separated list of files which 
contains the Hive configuration (hive-site.xml, e.g.). Without this, Hadoop "
    +                    + "will search the classpath for a 'hive-site.xml' 
file or will revert to a default configuration.")
    +            
.required(false).addValidator(StandardValidators.createMultipleFilesExistValidator()).build();
    +
    +    public static final PropertyDescriptor DB_USER = new 
PropertyDescriptor.Builder()
    +            .name("Database User")
    +            .description("Database user name")
    +            .defaultValue(null)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    public static final PropertyDescriptor DB_PASSWORD = new 
PropertyDescriptor.Builder()
    +            .name("Password")
    +            .description("The password for the database user")
    +            .defaultValue(null)
    +            .required(false)
    +            .sensitive(true)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    public static final PropertyDescriptor MAX_WAIT_TIME = new 
PropertyDescriptor.Builder()
    +            .name("Max Wait Time")
    +            .description("The maximum amount of time that the pool will 
wait (when there are no available connections) "
    +                    + " for a connection to be returned before failing, or 
-1 to wait indefinitely. ")
    +            .defaultValue("500 millis")
    +            .required(true)
    +            .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
    +            .sensitive(false)
    +            .build();
    +
    +    public static final PropertyDescriptor MAX_TOTAL_CONNECTIONS = new 
PropertyDescriptor.Builder()
    +            .name("Max Total Connections")
    +            .description("The maximum number of active connections that 
can be allocated from this pool at the same time, "
    --- End diff --
    
    Though I guess we are setting a Default Value here, so if you remove the 
value, it will just reset to 8. So I think I understand the reason for allowing 
a negative value now. We should probably consider allowing an optional property 
to have its value removed, even if there is a default value.


> Add support for Hive JDBC / ExecuteSQL
> --------------------------------------
>
>                 Key: NIFI-981
>                 URL: https://issues.apache.org/jira/browse/NIFI-981
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Extensions
>            Reporter: Joseph Witt
>            Assignee: Matt Burgess
>
> In this mailing list thread from September 2015 "NIFI DBCP connection pool 
> not working for hive" the main thrust of the converstation is to provide 
> proper support for delivering data to hive.  Hive's jdbc driver appears to 
> have dependencies on Hadoop libraries.  We need to be careful/thoughtful 
> about how to best support this so that different versions of Hadoop distros 
> can be supported (potentially in parallel on the same flow).



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

Reply via email to