Skip to content

Commit 6f4e2f9

Browse files
committed
docs: document SessionContextBuilder.withSparkFunctions
1 parent ac34593 commit 6f4e2f9

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎docs/source/user-guide/sessioncontext.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,24 @@ try (SessionContext ctx = SessionContext.builder()
6060
// ...
6161
}
6262
```
63+
64+
## Spark-compatible functions
65+
66+
`withSparkFunctions()` registers Apache Spark–compatible functions and
67+
expression planners (from the
68+
[`datafusion-spark`](https://crates.io/crates/datafusion-spark) crate) on the
69+
context:
70+
71+
```java
72+
try (SessionContext ctx = SessionContext.builder()
73+
.withSparkFunctions()
74+
.build();
75+
DataFrame df = ctx.sql("SELECT crc32('Spark')")) {
76+
// ...
77+
}
78+
```
79+
80+
When enabled, Spark-compatible functions override any DataFusion built-in of
81+
the same name. This requires the native library to be built with the `spark`
82+
Cargo feature, which is enabled in the default build; otherwise `build()`
83+
throws explaining the feature is missing.

0 commit comments

Comments
 (0)