Skip to content

Conversation

@edgararuiz
Copy link
Contributor

Fixes #1309:

  • Replaces object with x in prediction functions for Spark engine in decision trees
  • Adds News item
  • Bumps version
suppressPackageStartupMessages(library(sparklyr))
library(parsnip)

packageVersion("parsnip")
#> [1] '1.3.3.9001'

sc <- spark_connect("local", version = "4.0.1")

iris_2 <- iris[iris$Species %in% c("setosa", "virginica"), ]
tbl_iris <- copy_to(sc, iris_2, name = "iris")

decision_tree_spec <- decision_tree() |>
  set_mode("classification") |> 
  set_engine("spark")

decision_tree_fit <- decision_tree_spec |> 
  fit(Species ~ ., data = tbl_iris)

predict(decision_tree_fit, type = "class", new_data = tbl_iris)
#> # Source:   SQL [?? x 1]
#> # Database: spark_connection
#>    pred_class
#>    <chr>     
#>  1 setosa    
#>  2 setosa    
#>  3 setosa    
#>  4 setosa    
#>  5 setosa    
#>  6 setosa    
#>  7 setosa    
#>  8 setosa    
#>  9 setosa    
#> 10 setosa    
#> # ℹ more rows

spark_disconnect(sc)

@edgararuiz edgararuiz requested a review from topepo November 25, 2025 22:28
@topepo
Copy link
Member

topepo commented Nov 29, 2025

💯 Thanks!

@topepo topepo merged commit bea062d into main Nov 29, 2025
14 checks passed
@topepo topepo deleted the fix-1309 branch November 29, 2025 15:14
@github-actions
Copy link
Contributor

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

argument "x" is missing, with no default for decision_tree() using a Spark engine

3 participants