Repository: tobymao/sqlglot

Issue:
Cannot convert Redshift STRTOL to Trino
```
sql = """SELECT STRTOL('abc', 16)"""
converted_sql = sqlglot.transpile(sql, read="redshift", write="trino")[0]
print(converted_sql)
SELECT STRTOL('abc', 16)
```

Trino error: `Function 'strtol' not registered`

a fix could be replace STRTOL with FROM_BASE

Discussion:

Patch:
diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py
index fda191bf..afed1d1e 100644
--- a/sqlglot/dialects/redshift.py
+++ b/sqlglot/dialects/redshift.py
@@ -3,6 +3,7 @@ from __future__ import annotations
 import typing as t
 
 from sqlglot import exp, transforms
+from sqlglot.dialects.dialect import rename_func
 from sqlglot.dialects.postgres import Postgres
 from sqlglot.helper import seq_get
 from sqlglot.tokens import TokenType
@@ -34,6 +35,7 @@ class Redshift(Postgres):
                 unit=seq_get(args, 0),
             ),
             "NVL": exp.Coalesce.from_arg_list,
+            "STRTOL": exp.FromBase.from_arg_list,
         }
 
         CONVERT_TYPE_FIRST = True
@@ -105,6 +107,7 @@ class Redshift(Postgres):
             exp.JSONExtractScalar: _json_sql,
             exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),
             exp.SortKeyProperty: lambda self, e: f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})",
+            exp.FromBase: rename_func("STRTOL"),
         }
 
         # Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index b061fd4b..3c6ba2a3 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -4392,6 +4392,10 @@ class NumberToStr(Func):
     arg_types = {"this": True, "format": True}
 
 
+class FromBase(Func):
+    arg_types = {"this": True, "expression": True}
+
+
 class Struct(Func):
     arg_types = {"expressions": True}
     is_var_len_args = True


Test patch:
diff --git a/tests/dialects/test_redshift.py b/tests/dialects/test_redshift.py
index b3dc912a..db5d72a9 100644
--- a/tests/dialects/test_redshift.py
+++ b/tests/dialects/test_redshift.py
@@ -10,6 +10,16 @@ class TestRedshift(Validator):
         self.validate_identity("foo$")
         self.validate_identity("$foo")
 
+        self.validate_all(
+            "SELECT STRTOL('abc', 16)",
+            read={
+                "trino": "SELECT FROM_BASE('abc', 16)",
+            },
+            write={
+                "redshift": "SELECT STRTOL('abc', 16)",
+                "trino": "SELECT FROM_BASE('abc', 16)",
+            },
+        )
         self.validate_all(
             "SELECT SNAPSHOT, type",
             write={