{"action":"created","comment":{"url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/comments/28978558","id":28978558,"diff_hunk":"@@ -22,15 +32,42 @@ class CassandraPartitionedRDD[T](prev: RDD[T])(implicit ct: ClassTag[T]) extends\n   override def getPartitions: Array[Partition] = {\n     partitioner match {\n       case Some(rp: ReplicaPartitioner) => prev.partitions.map(partition => rp.getEndpointPartition(partition))\n-      case _ => throw new IllegalArgumentException(\"CassandraPartitionedRDD hasn't been partitioned by ReplicaPartitioner. This should be impossible\")\n+      case _ => throw new IllegalArgumentException(\"CassandraPartitionedRDD hasn't been \" +\n+        \"partitioned by ReplicaPartitioner. Unable to do any work with data locality.\")\n     }\n   }\n \n+  /**\n+   * This method currently uses thrift to determine the local endpoint and rpc endpoints\n+   * from whatever endpoint the partition belongs to. This gives us a better chance of matching\n+   * the bound interface of the Spark Executor. In addition we will add the HostName and\n+   * HostAddress that we get for each of these endpoints to cover all of the logical choices.\n+   */\n   override def getPreferredLocations(split: Partition): Seq[String] = {\n+    val connector = CassandraConnector(prev.sparkContext.getConf)\n+\n+    val rpcToLocalAddress = connector.withCassandraClientDo { client =>\n+      val ring = client.describe_local_ring(keyspace)\n+      for {\n+        tr <- ring\n+        rpcIps = tr.rpc_endpoints.map(InetAddress.getByName)\n+        localIps = tr.endpoints.map(InetAddress.getByName)\n+        (rpc, local) <- (rpcIps).zip(localIps)","path":"spark-cassandra-connector/src/main/scala/com/datastax/spark/connector/rdd/partitioner/CassandraPartitionedRDD.scala","position":52,"original_position":52,"commit_id":"9b2810fd96a59b6465b717db638c84c221e4fc69","original_commit_id":"9b2810fd96a59b6465b717db638c84c221e4fc69","user":{"login":"helena","id":406103,"avatar_url":"https://avatars.githubusercontent.com/u/406103?v=3","gravatar_id":"","url":"https://api.github.com/users/helena","html_url":"https://github.com/helena","followers_url":"https://api.github.com/users/helena/followers","following_url":"https://api.github.com/users/helena/following{/other_user}","gists_url":"https://api.github.com/users/helena/gists{/gist_id}","starred_url":"https://api.github.com/users/helena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helena/subscriptions","organizations_url":"https://api.github.com/users/helena/orgs","repos_url":"https://api.github.com/users/helena/repos","events_url":"https://api.github.com/users/helena/events{/privacy}","received_events_url":"https://api.github.com/users/helena/received_events","type":"User","site_admin":false},"body":"rpcIps.zip(localIps)","created_at":"2015-04-23T16:25:10Z","updated_at":"2015-04-23T16:25:10Z","html_url":"https://github.com/datastax/spark-cassandra-connector/pull/635#discussion_r28978558","pull_request_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635","_links":{"self":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/comments/28978558"},"html":{"href":"https://github.com/datastax/spark-cassandra-connector/pull/635#discussion_r28978558"},"pull_request":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635"}}},"pull_request":{"url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635","id":33506598,"html_url":"https://github.com/datastax/spark-cassandra-connector/pull/635","diff_url":"https://github.com/datastax/spark-cassandra-connector/pull/635.diff","patch_url":"https://github.com/datastax/spark-cassandra-connector/pull/635.patch","issue_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/635","number":635,"state":"open","locked":false,"title":"SPARKC-126: Populate HostName & Address in preferredIps","user":{"login":"RussellSpitzer","id":413025,"avatar_url":"https://avatars.githubusercontent.com/u/413025?v=3","gravatar_id":"","url":"https://api.github.com/users/RussellSpitzer","html_url":"https://github.com/RussellSpitzer","followers_url":"https://api.github.com/users/RussellSpitzer/followers","following_url":"https://api.github.com/users/RussellSpitzer/following{/other_user}","gists_url":"https://api.github.com/users/RussellSpitzer/gists{/gist_id}","starred_url":"https://api.github.com/users/RussellSpitzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RussellSpitzer/subscriptions","organizations_url":"https://api.github.com/users/RussellSpitzer/orgs","repos_url":"https://api.github.com/users/RussellSpitzer/repos","events_url":"https://api.github.com/users/RussellSpitzer/events{/privacy}","received_events_url":"https://api.github.com/users/RussellSpitzer/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-17T00:54:45Z","updated_at":"2015-04-23T16:25:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e4d9d40e7ad7beb144635405f6ddf5e8a69952c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635/commits","review_comments_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635/comments","review_comment_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/comments{/number}","comments_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/635/comments","statuses_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/statuses/9b2810fd96a59b6465b717db638c84c221e4fc69","head":{"label":"datastax:SPARKC-126","ref":"SPARKC-126","sha":"9b2810fd96a59b6465b717db638c84c221e4fc69","user":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"repo":{"id":21280887,"name":"spark-cassandra-connector","full_name":"datastax/spark-cassandra-connector","owner":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/datastax/spark-cassandra-connector","description":"If you write a Spark application that needs access to Cassandra, this library is for you","fork":false,"url":"https://api.github.com/repos/datastax/spark-cassandra-connector","forks_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/forks","keys_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/teams","hooks_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/hooks","issue_events_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/events{/number}","events_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/events","assignees_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/assignees{/user}","branches_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/branches{/branch}","tags_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/tags","blobs_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/statuses/{sha}","languages_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/languages","stargazers_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/stargazers","contributors_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/contributors","subscribers_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/subscribers","subscription_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/subscription","commits_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/comments{/number}","contents_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/contents/{+path}","compare_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/merges","archive_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/downloads","issues_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues{/number}","pulls_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls{/number}","milestones_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/milestones{/number}","notifications_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/labels{/name}","releases_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/releases{/id}","created_at":"2014-06-27T15:45:54Z","updated_at":"2015-04-23T12:34:44Z","pushed_at":"2015-04-23T15:47:12Z","git_url":"git://github.com/datastax/spark-cassandra-connector.git","ssh_url":"git@github.com:datastax/spark-cassandra-connector.git","clone_url":"https://github.com/datastax/spark-cassandra-connector.git","svn_url":"https://github.com/datastax/spark-cassandra-connector","homepage":"","size":11369,"stargazers_count":487,"watchers_count":487,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":146,"mirror_url":null,"open_issues_count":16,"forks":146,"open_issues":16,"watchers":487,"default_branch":"master"}},"base":{"label":"datastax:master","ref":"master","sha":"a6fe12d4f4dc42754bd8acc9f295112ee78aacfe","user":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"repo":{"id":21280887,"name":"spark-cassandra-connector","full_name":"datastax/spark-cassandra-connector","owner":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/datastax/spark-cassandra-connector","description":"If you write a Spark application that needs access to Cassandra, this library is for you","fork":false,"url":"https://api.github.com/repos/datastax/spark-cassandra-connector","forks_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/forks","keys_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/teams","hooks_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/hooks","issue_events_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/events{/number}","events_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/events","assignees_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/assignees{/user}","branches_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/branches{/branch}","tags_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/tags","blobs_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/statuses/{sha}","languages_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/languages","stargazers_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/stargazers","contributors_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/contributors","subscribers_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/subscribers","subscription_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/subscription","commits_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/comments{/number}","contents_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/contents/{+path}","compare_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/merges","archive_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/downloads","issues_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues{/number}","pulls_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls{/number}","milestones_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/milestones{/number}","notifications_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/labels{/name}","releases_url":"https://api.github.com/repos/datastax/spark-cassandra-connector/releases{/id}","created_at":"2014-06-27T15:45:54Z","updated_at":"2015-04-23T12:34:44Z","pushed_at":"2015-04-23T15:47:12Z","git_url":"git://github.com/datastax/spark-cassandra-connector.git","ssh_url":"git@github.com:datastax/spark-cassandra-connector.git","clone_url":"https://github.com/datastax/spark-cassandra-connector.git","svn_url":"https://github.com/datastax/spark-cassandra-connector","homepage":"","size":11369,"stargazers_count":487,"watchers_count":487,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":146,"mirror_url":null,"open_issues_count":16,"forks":146,"open_issues":16,"watchers":487,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635"},"html":{"href":"https://github.com/datastax/spark-cassandra-connector/pull/635"},"issue":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/635"},"comments":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/issues/635/comments"},"review_comments":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635/comments"},"review_comment":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/pulls/635/commits"},"statuses":{"href":"https://api.github.com/repos/datastax/spark-cassandra-connector/statuses/9b2810fd96a59b6465b717db638c84c221e4fc69"}}}}