File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -1250,6 +1250,7 @@ def _get_column_aggregate(
12501250
12511251 from pyspark .sql import SparkSession
12521252 from pyspark .sql .functions import approx_count_distinct
1253+ from pyspark .sql import functions as F
12531254
12541255 function = function .upper ()
12551256 (workspace_name , workspace_id ) = resolve_workspace_name_and_id (workspace )
@@ -1260,7 +1261,7 @@ def _get_column_aggregate(
12601261 df = spark .read .format ("delta" ).load (path )
12611262
12621263 if function in {"COUNTDISTINCT" , "DISTINCTCOUNT" }:
1263- result = df .selectExpr ( f"COUNT(DISTINCT { column_name } )" )
1264+ result = df .select ( F . count_distinct ( F . col ( column_name )) )
12641265 elif "APPROX" in function :
12651266 result = df .select (approx_count_distinct (column_name ))
12661267 else :
You can’t perform that action at this time.
0 commit comments