Return-Path: X-Original-To: apmail-mahout-dev-archive@www.apache.org Delivered-To: apmail-mahout-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5DB8A17421 for ; Fri, 26 Sep 2014 19:31:35 +0000 (UTC) Received: (qmail 62333 invoked by uid 500); 26 Sep 2014 19:31:34 -0000 Delivered-To: apmail-mahout-dev-archive@mahout.apache.org Received: (qmail 62239 invoked by uid 500); 26 Sep 2014 19:31:34 -0000 Mailing-List: contact dev-help@mahout.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mahout.apache.org Delivered-To: mailing list dev@mahout.apache.org Received: (qmail 62226 invoked by uid 99); 26 Sep 2014 19:31:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2014 19:31:34 +0000 Date: Fri, 26 Sep 2014 19:31:34 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@mahout.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MAHOUT-1615) SparkEngine drmFromHDFS returning the same Key for all Key,Vec Pairs for Text-Keyed SequenceFiles MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MAHOUT-1615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14149849#comment-14149849 ] ASF GitHub Bot commented on MAHOUT-1615: ---------------------------------------- Github user dlyubimov commented on a diff in the pull request: https://github.com/apache/mahout/pull/52#discussion_r18108922 --- Diff: spark/src/main/scala/org/apache/mahout/sparkbindings/SparkEngine.scala --- @@ -127,45 +133,64 @@ object SparkEngine extends DistributedEngine { */ def drmFromHDFS (path: String, parMin:Int = 0)(implicit sc: DistributedContext): CheckpointedDrm[_] = { - val rdd = sc.sequenceFile(path, classOf[Writable], classOf[VectorWritable], minPartitions = parMin) - // Get rid of VectorWritable - .map(t => (t._1, t._2.get())) + // HDFS Paramaters + val hConf= new Configuration() + val hPath= new Path(path) + val fs= FileSystem.get(hConf) - def getKeyClassTag[K: ClassTag, V](rdd: RDD[(K, V)]) = implicitly[ClassTag[K]] + /** Get the Key Class For the Sequence File */ + def getKeyClassTag[K:ClassTag] = ClassTag(new SequenceFile.Reader(fs, hPath, hConf).getKeyClass) + --- End diff -- Can we please squirrel away lines 136-143 and all direct hadoop imports into a separate function, separate util helper object please? I am still very wary of direct hadoop dependencies and i predict this will not work on _all_ CDH /public hadoop releases. > SparkEngine drmFromHDFS returning the same Key for all Key,Vec Pairs for Text-Keyed SequenceFiles > ------------------------------------------------------------------------------------------------- > > Key: MAHOUT-1615 > URL: https://issues.apache.org/jira/browse/MAHOUT-1615 > Project: Mahout > Issue Type: Bug > Reporter: Andrew Palumbo > Fix For: 1.0 > > > When reading in seq2sparse output from HDFS in the spark-shell of form SparkEngine's drmFromHDFS method is creating rdds with the same Key for all Pairs: > {code} > mahout> val drmTFIDF= drmFromHDFS( path = "/tmp/mahout-work-andy/20news-test-vectors/part-r-00000") > {code} > Has keys: > {...} > key: /talk.religion.misc/84570 > key: /talk.religion.misc/84570 > key: /talk.religion.misc/84570 > {...} > for the entire set. This is the last Key in the set. > The problem can be traced to the first line of drmFromHDFS(...) in SparkEngine.scala: > {code} > val rdd = sc.sequenceFile(path, classOf[Writable], classOf[VectorWritable], minPartitions = parMin) > // Get rid of VectorWritable > .map(t => (t._1, t._2.get())) > {code} > which gives the same key for all t._1. > -- This message was sent by Atlassian JIRA (v6.3.4#6332)