---
title: input_file_block_length
description: "input\\_file\\_block\\_length function in PySpark: Returns the length of the block being read, or -1 if not available."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/functions/input_file_block_length
---

# input\_file\_block\_length

Returns the length of the block being read, or -1 if not available.

## Syntax

```python
from pyspark.sql import functions as sf

sf.input_file_block_length()
```

## Examples

**Example 1**: Get input file block length

```python
from pyspark.sql import functions as sf
df = spark.read.text("python/test_support/sql/ages_newlines.csv", lineSep=",")
df.select(sf.input_file_block_length()).show()
```

```Output
+-------------------------+
|input_file_block_length()|
+-------------------------+
|                       87|
|                       87|
|                       87|
|                       87|
|                       87|
|                       87|
|                       87|
|                       87|
+-------------------------+
```
