spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tedyu <...@git.apache.org>
Subject [GitHub] spark pull request: SPARK-1127 Add spark-hbase.
Date Sat, 22 Mar 2014 17:29:13 GMT
Github user tedyu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/194#discussion_r10863200
  
    --- Diff: external/hbase/src/main/scala/org/apache/spark/nosql/hbase/SparkHBaseWriter.scala
---
    @@ -0,0 +1,152 @@
    +/*
    + * 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.spark.nosql.hbase
    +
    +import org.apache.hadoop.hbase.client.{Put, HTable}
    +import org.apache.hadoop.io.Text
    +import org.apache.hadoop.hbase.util.Bytes
    +import org.apache.commons.codec.binary.Hex
    +import org.apache.hadoop.hbase.HConstants
    +import org.apache.hadoop.conf.Configuration
    +import java.io.IOException
    +import org.apache.spark.Logging
    +
    +/**
    + * Internal helper class that saves an RDD using a HBase OutputFormat. This is only public
    + * because we need to access this class from the `hbase` package to use some package-private
HBase
    + * functions, but this class should not be used directly by users.
    + */
    +private[hbase]
    +class SparkHBaseWriter(conf: HBaseConf)
    +  extends Logging {
    +
    +  private var htable: HTable = null
    +
    +  val zkHost = conf.zkHost
    +  val zkPort = conf.zkPort
    +  val zkNode = conf.zkNode
    +  val table = conf.table
    +  val rowkeyType = conf.rowkeyType
    +  val columns = conf.columns
    +  val delimiter = conf.delimiter
    +
    +  def init() {
    +    val conf = new Configuration()
    +    conf.set(HConstants.ZOOKEEPER_QUORUM, zkHost)
    +    conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, zkPort)
    +    conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, zkNode)
    +    htable = new HTable(conf, table)
    --- End diff --
    
    See 9.3.1.1. under http://hbase.apache.org/book.html#client.connections
    
    Can be done in follow-on JIRA


---
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