Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 'SparkSession' object has no attribute 'util' #557

Merged
merged 2 commits into from
Jun 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import time
import numpy

from pyspark.sql import SparkSession

class SparkMLTree(dict):
pass
Expand All @@ -31,10 +31,11 @@ def sparkml_tree_dataset_to_sklearn(tree_df, is_classifier):
return tree


def save_read_sparkml_model_data(spark, model):
def save_read_sparkml_model_data(spark: SparkSession, model):
tdir = tempfile.tempdir
if tdir is None:
tdir = spark.util.Utils.createTempDir().getAbsolutePath()
local_dir = spark._jvm.org.apache.spark.util.Utils.getLocalDir(spark._jsc.sc().conf())
tdir = spark._jvm.org.apache.spark.util.Utils.createTempDir(local_dir, "onnx").getAbsolutePath()
if tdir is None:
raise FileNotFoundError(
"Unable to create a temporary directory for model '{}'"
Expand Down