[英]How to Write Structured Streaming Data into Cassandra with PySpark?
[英]Reading data using Structured Streaming in Pyspark and wants to write data with file size of 100MB
希望你们一切都好。 我正在使用结构化流从目录中读取文件
schema = StructType([
StructField("RowNo", StringType()),
StructField("InvoiceNo", StringType()),
StructField("StockCode", StringType()),
StructField("Description", StringType()),
StructField("Quantity", StringType()),
StructField("InvoiceDate", StringType()),
StructField("UnitPrice", StringType()),
StructField("CustomerId", StringType()),
StructField("Country", StringType()),
StructField("InvoiceTimestamp", StringType())
])
data = spark.readStream.format("orc").schema(schema).option("header", "true").option("path", "<path_here>").load()
应用一些转换后,我喜欢保存大小为 100MB 的 output 文件。
您应该覆盖默认的 HDFS 块大小。
block_size = str(1024 * 1024 * 100)
sc._jsc.hadoopConfiguration().set("dfs.block.size", block_size)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.