Coverage for jstark / features / count_if.py: 91%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-23 22:34 +0000

1"""CountIf feature""" 

2 

3from typing import Callable 

4import pyspark.sql.functions as f 

5from pyspark.sql import Column 

6 

7 

8from jstark.features.feature import BaseFeature 

9 

10 

11class CountIf(BaseFeature): 

12 def aggregator(self) -> Callable[[Column], Column]: 

13 return self.count_if_aggregator 

14 

15 def column_expression(self) -> Column: 

16 return f.lit(1) 

17 

18 def default_value(self) -> Column: 

19 return f.lit(0)