summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/trino.py
blob: 805106cee35b853257108878348045a9ea6061c4 (plain)
1
2
3
4
5
6
7
8
9
10
from sqlglot import exp
from sqlglot.dialects.presto import Presto


class Trino(Presto):
    class Generator(Presto.Generator):
        TRANSFORMS = {
            **Presto.Generator.TRANSFORMS,
            exp.ArraySum: lambda self, e: f"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)",
        }