0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Spark (Databricks) における binary 型のサイズ上限は 2147483647 byte

Posted at

内容

Spark のデータ型の1つである binary 型のサイズ上限は 2147483647 byte (約2GB)のようです。

下記が、Databricks における実行コードとエラーメッセージです。binaryFileとして読み込むことで、BinaryTypecontentというカラムが生成されるのですが、そのカラムのエラーです。

df = spark.read.format('binaryFile').load('dbfs:/databricks-datasets/tpch/data-001/lineitem/*')
display(df)
FileReadException: Error while reading file dbfs:/databricks-datasets/tpch/data-001/lineitem/lineitem.tbl.
Caused by: SparkException: The length of dbfs:/databricks-datasets/tpch/data-001/lineitem/lineitem.tbl is 3863181353, which exceeds the max length allowed: 2147483647.

image.png

binary 型のサイズ上限をあげる方法は特にないそうなので、動画ファイルなどを binary 型のカラムに格納しようとしている方は注意してください。私は、取り込み後のインターフェースファイルを binary 型で管理できないかを検討しておりましたが、本制約により諦めました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?