Repository: tobymao/sqlglot

Issue:
approx_top_k is not recognized as an aggregation function in Snowflake
**Fully reproducible code snippet**

```python
from sqlglot import Dialects, exp, parse_one

query = "SELECT approx_top_k(field, 5) FROM  some_table"
parsed_query = parse_one(query, read=Dialects.SNOWFLAKE.value)
agg_funcs = parsed_query.find_all(exp.AggFunc)
has_agg_funcs = any(agg_funcs) # getting False, expected True

```

**Official Documentation**
https://docs.snowflake.com/en/sql-reference/functions/approx_top_k


Discussion:

Patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index 67b41110..7df8be23 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -4174,6 +4174,10 @@ class Abs(Func):
     pass
 
 
+class ApproxTopK(AggFunc):
+    arg_types = {"this": True, "expression": False, "counters": False}
+
+
 class Flatten(Func):
     pass
 


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
index 78dfabe5..65b77ea0 100644
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -9,6 +9,10 @@ class TestSnowflake(Validator):
     dialect = "snowflake"
 
     def test_snowflake(self):
+        expr = parse_one("SELECT APPROX_TOP_K(C4, 3, 5) FROM t")
+        expr.selects[0].assert_is(exp.AggFunc)
+        self.assertEqual(expr.sql(dialect="snowflake"), "SELECT APPROX_TOP_K(C4, 3, 5) FROM t")
+
         self.validate_identity("SELECT DAYOFMONTH(CURRENT_TIMESTAMP())")
         self.validate_identity("SELECT DAYOFYEAR(CURRENT_TIMESTAMP())")
         self.validate_identity("LISTAGG(data['some_field'], ',')")