org.apache.spark.input.PortableDataStream Scala Examples
The following examples show how to use org.apache.spark.input.PortableDataStream.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: JsonUtils.scala From XSQL with Apache License 2.0 | 5 votes |
package org.apache.spark.sql.execution.datasources.json import org.apache.spark.input.PortableDataStream import org.apache.spark.rdd.RDD import org.apache.spark.sql.Dataset import org.apache.spark.sql.catalyst.json.JSONOptions object JsonUtils { def sample(json: RDD[PortableDataStream], options: JSONOptions): RDD[PortableDataStream] = { require(options.samplingRatio > 0, s"samplingRatio (${options.samplingRatio}) should be greater than 0") if (options.samplingRatio > 0.99) { json } else { json.sample(withReplacement = false, options.samplingRatio, 1) } } }
Example 2
Source File: JsonUtils.scala From Spark-2.3.1 with Apache License 2.0 | 5 votes |
package org.apache.spark.sql.execution.datasources.json import org.apache.spark.input.PortableDataStream import org.apache.spark.rdd.RDD import org.apache.spark.sql.Dataset import org.apache.spark.sql.catalyst.json.JSONOptions object JsonUtils { def sample(json: RDD[PortableDataStream], options: JSONOptions): RDD[PortableDataStream] = { require(options.samplingRatio > 0, s"samplingRatio (${options.samplingRatio}) should be greater than 0") if (options.samplingRatio > 0.99) { json } else { json.sample(withReplacement = false, options.samplingRatio, 1) } } }