{"action":"created","issue":{"url":"https://api.github.com/repos/Stratio/spark-mongodb/issues/49","labels_url":"https://api.github.com/repos/Stratio/spark-mongodb/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/Stratio/spark-mongodb/issues/49/comments","events_url":"https://api.github.com/repos/Stratio/spark-mongodb/issues/49/events","html_url":"https://github.com/Stratio/spark-mongodb/pull/49","id":112156864,"number":49,"title":"Use generic RDD[DBObject] for MongodbSchema","user":{"login":"kanielc","id":1334074,"avatar_url":"https://avatars.githubusercontent.com/u/1334074?v=3","gravatar_id":"","url":"https://api.github.com/users/kanielc","html_url":"https://github.com/kanielc","followers_url":"https://api.github.com/users/kanielc/followers","following_url":"https://api.github.com/users/kanielc/following{/other_user}","gists_url":"https://api.github.com/users/kanielc/gists{/gist_id}","starred_url":"https://api.github.com/users/kanielc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kanielc/subscriptions","organizations_url":"https://api.github.com/users/kanielc/orgs","repos_url":"https://api.github.com/users/kanielc/repos","events_url":"https://api.github.com/users/kanielc/events{/privacy}","received_events_url":"https://api.github.com/users/kanielc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-19T14:29:42Z","updated_at":"2015-10-21T08:37:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Stratio/spark-mongodb/pulls/49","html_url":"https://github.com/Stratio/spark-mongodb/pull/49","diff_url":"https://github.com/Stratio/spark-mongodb/pull/49.diff","patch_url":"https://github.com/Stratio/spark-mongodb/pull/49.patch"},"body":"This is backward compatible, but allows inferring the schema from an\r\nexisting RDD[DBObject].\r\n\r\nThe advantage is that it allows code like:\r\n```\r\ndef createDataframe(sqlContext: SQLContext, rdd: RDD[DBObject], samplingRatio: Double = 1.0): DataFrame = {\r\n    Try {\r\n      val schema = MongodbSchema(rdd, samplingRatio).schema()\r\n      val rowRDD = MongodbRowConverter.asRow(schema, rdd)\r\n      sqlContext.createDataFrame(rowRDD, schema)\r\n    } getOrElse sqlContext.emptyDataFrame\r\n  }\r\n```\r\n\r\nAmong the ways this is useful is that it allows interaction with the mongodb-hadoop-connector, which supports some features not yet implemented in spark-mongodb (like Split pattern min/max)"},"comment":{"url":"https://api.github.com/repos/Stratio/spark-mongodb/issues/comments/149819127","html_url":"https://github.com/Stratio/spark-mongodb/pull/49#issuecomment-149819127","issue_url":"https://api.github.com/repos/Stratio/spark-mongodb/issues/49","id":149819127,"user":{"login":"darroyocazorla","id":8123986,"avatar_url":"https://avatars.githubusercontent.com/u/8123986?v=3","gravatar_id":"","url":"https://api.github.com/users/darroyocazorla","html_url":"https://github.com/darroyocazorla","followers_url":"https://api.github.com/users/darroyocazorla/followers","following_url":"https://api.github.com/users/darroyocazorla/following{/other_user}","gists_url":"https://api.github.com/users/darroyocazorla/gists{/gist_id}","starred_url":"https://api.github.com/users/darroyocazorla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darroyocazorla/subscriptions","organizations_url":"https://api.github.com/users/darroyocazorla/orgs","repos_url":"https://api.github.com/users/darroyocazorla/repos","events_url":"https://api.github.com/users/darroyocazorla/events{/privacy}","received_events_url":"https://api.github.com/users/darroyocazorla/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T08:37:18Z","updated_at":"2015-10-21T08:37:18Z","body":"LGTM"}}