def test_funcfilter_within_group_desc(self): stmt = select( [ table1.c.myid, func.percentile_cont(0.5).within_group(table1.c.name.desc()), ] ) self.assert_compile( stmt, "SELECT mytable.myid, percentile_cont(:percentile_cont_1) " "WITHIN GROUP (ORDER BY mytable.name DESC) " "AS anon_1 " "FROM mytable", {"percentile_cont_1": 0.5}, )
def test_funcfilter_within_group_w_over(self): stmt = select( [ table1.c.myid, func.percentile_cont(0.5) .within_group(table1.c.name.desc()) .over(partition_by=table1.c.description), ] ) self.assert_compile( stmt, "SELECT mytable.myid, percentile_cont(:percentile_cont_1) " "WITHIN GROUP (ORDER BY mytable.name DESC) " "OVER (PARTITION BY mytable.description) AS anon_1 " "FROM mytable", {"percentile_cont_1": 0.5}, )
def test_percentile_cont_array_desc(self): expr = func.percentile_cont(0.5, 0.7).within_group( column("data", Integer).desc() ) is_(expr.type._type_affinity, ARRAY) is_(expr.type.item_type._type_affinity, Integer)
def test_percentile_cont(self): expr = func.percentile_cont(0.5).within_group(column("data", Integer)) is_(expr.type._type_affinity, Integer)