Skip to content

Commit

Permalink
fix: 'SparkSession' object has no attribute 'util' (#557)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Wang <jasowang@microsoft.com>
  • Loading branch information
memoryz authored Jun 7, 2022
1 parent 4e1fe87 commit e298dfb
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit e298dfb

Please sign in to comment.