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(
1250
1250
1251
1251
from pyspark .sql import SparkSession
1252
1252
from pyspark .sql .functions import approx_count_distinct
1253
+ from pyspark .sql import functions as F
1253
1254
1254
1255
function = function .upper ()
1255
1256
(workspace_name , workspace_id ) = resolve_workspace_name_and_id (workspace )
@@ -1260,7 +1261,7 @@ def _get_column_aggregate(
1260
1261
df = spark .read .format ("delta" ).load (path )
1261
1262
1262
1263
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 )) )
1264
1265
elif "APPROX" in function :
1265
1266
result = df .select (approx_count_distinct (column_name ))
1266
1267
else :
You can’t perform that action at this time.
0 commit comments