Spark 2.3+ 使用 parquet.enable.dictionary?

Spark 2.3+ use of parquet.enable.dictionary?

我正在寻找有关如何在 Spark(最新的 2.3.1)中使用 parquet.enable.dictionary 的文档。创建SparkSession时可以设置为"true"或"false"。

我在谷歌上搜索了有关此功能的任何文档,但一无所获,或者至少是最近一无所获。

具体来说,这些是我的问题:

在 Spark 2.3.1 中默认是 parquet.filter.dictionary.enabled = true 还是 = false?

是否启用此功能(设置为 true)之前我写入 Parquet 文件以便 Spark 的 Parquet 库计算并将字典信息写入磁盘?

Spark 读取 Parquet 文件时是否会忽略此设置,还是我仍需要将其设置为 true 才能读取 parquet(以及写入)?

我什么时候应该使用此功能(设置为 true)? Pros/Cons?

当我用谷歌搜索 parquet.enable.dictionary 时,我也看到了对这个 spark.hadoop.parquet.enable.dictionary 的引用。这有关系吗?我应该使用哪个?

是否还有我需要注意的其他 Spark + Parquet 设置?

非常感谢!

这些是默认设置为 false 的 spark parquet 配置 -

spark.sql.parquet.mergeSchema
spark.sql.parquet.respectSummaryFiles
spark.sql.parquet.binaryAsString
spark.sql.parquet.int96TimestampConversion
spark.sql.parquet.int64AsTimestampMillis
spark.sql.parquet.writeLegacyFormat
spark.sql.parquet.recordLevelFilter.enabled

以下默认设置为true -

spark.sql.parquet.int96AsTimestamp
spark.sql.parquet.filterPushdown
spark.sql.parquet.filterPushdown.date
spark.sql.parquet.filterPushdown.timestamp
spark.sql.parquet.filterPushdown.decimal
spark.sql.parquet.filterPushdown.string.startsWith
spark.sql.parquet.enableVectorizedReader

这些属性需要值并将其与默认值一起列出-

spark.sql.parquet.outputTimestampType = INT96
spark.sql.parquet.compression.codec = snappy
spark.sql.parquet.pushdown.inFilterThreshold = 10
spark.sql.parquet.output.committer.class = org.apache.parquet.hadoop.ParquetOutputCommitter
spark.sql.parquet.columnarReaderBatchSize = 4096

关于parquet.enable.dictionary,Spark暂不支持。但是可以在sqlContext中设置为-

sqlContext.setConf("parquet.enable.dictionary", "false")

这个的默认值是 属性 在 parquet 中是正确的。因此,从Spark调用parquet代码时应该是这样。

这可以帮助:

Parquet file properties are set at write time. The properties listed in Table 13-3 (parquet.block.size, parquet.page.size, parquet.dictionary.page.size, parquet.enable.dictionary) are appro-priate if you are creating Parquet files from MapReduce (using the formats discussed inParquet MapReduce), Crunch, Pig, or Hive.

http://what-when-how.com/Tutorial/topic-2059e313/Hadoop-The-Definitive-Guide-457.html