prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Spark raw String Support, comonly used with regexes
  This fails with sqlglot:
  
  ```python
  import sqlglot
  
  sql = """select regexp_replace('100-200', r'([^0-9])', '')"""
  sqlglot.parse_one(sql, read="databricks")
  ```
  
  **Official Documentation**
  https://spark.apache.org/docs/latest/sql-ref-literals.html
  
  
  </issue>
  <code>
  [start of sqlglot/dialects/spark.py]
  1 from __future__ import annotations
  2 
  3 import typing as t
  4 
  5 from sqlglot import exp
  6 from sqlglot.dialects.dialect import rename_func
  7 from sqlglot.dialects.spark2 import Spark2
  8 from sqlglot.helper import seq_get
  9 
  10 
  11 def _parse_datediff(args: t.List) -> exp.Expression:
  12     """
  13     Although Spark docs don't mention the "unit" argument, Spark3 added support for
  14     it at some point. Databricks also supports this variant (see below).
  15 
  16     For example, in spark-sql (v3.3.1):
  17     - SELECT DATEDIFF('2020-01-01', '2020-01-05') results in -4
  18     - SELECT DATEDIFF(day, '2020-01-01', '2020-01-05') results in 4
  19 
  20     See also:
  21     - https://docs.databricks.com/sql/language-manual/functions/datediff3.html
  22     - https://docs.databricks.com/sql/language-manual/functions/datediff.html
  23     """
  24     unit = None
  25     this = seq_get(args, 0)
  26     expression = seq_get(args, 1)
  27 
  28     if len(args) == 3:
  29         unit = this
  30         this = args[2]
  31 
  32     return exp.DateDiff(
  33         this=exp.TsOrDsToDate(this=this), expression=exp.TsOrDsToDate(this=expression), unit=unit
  34     )
  35 
  36 
  37 class Spark(Spark2):
  38     class Parser(Spark2.Parser):
  39         FUNCTIONS = {
  40             **Spark2.Parser.FUNCTIONS,
  41             "ANY_VALUE": lambda args: exp.AnyValue(
  42                 this=seq_get(args, 0), ignore_nulls=seq_get(args, 1)
  43             ),
  44             "DATEDIFF": _parse_datediff,
  45         }
  46 
  47         FUNCTION_PARSERS = Spark2.Parser.FUNCTION_PARSERS.copy()
  48         FUNCTION_PARSERS.pop("ANY_VALUE")
  49 
  50     class Generator(Spark2.Generator):
  51         TYPE_MAPPING = {
  52             **Spark2.Generator.TYPE_MAPPING,
  53             exp.DataType.Type.MONEY: "DECIMAL(15, 4)",
  54             exp.DataType.Type.SMALLMONEY: "DECIMAL(6, 4)",
  55             exp.DataType.Type.UNIQUEIDENTIFIER: "STRING",
  56         }
  57 
  58         TRANSFORMS = {
  59             **Spark2.Generator.TRANSFORMS,
  60             exp.StartsWith: rename_func("STARTSWITH"),
  61             exp.TimestampAdd: lambda self, e: self.func(
  62                 "DATEADD", e.args.get("unit") or "DAY", e.expression, e.this
  63             ),
  64         }
  65         TRANSFORMS.pop(exp.AnyValue)
  66         TRANSFORMS.pop(exp.DateDiff)
  67         TRANSFORMS.pop(exp.Group)
  68 
  69         def anyvalue_sql(self, expression: exp.AnyValue) -> str:
  70             return self.function_fallback_sql(expression)
  71 
  72         def datediff_sql(self, expression: exp.DateDiff) -> str:
  73             unit = self.sql(expression, "unit")
  74             end = self.sql(expression, "this")
  75             start = self.sql(expression, "expression")
  76 
  77             if unit:
  78                 return self.func("DATEDIFF", unit, start, end)
  79 
  80             return self.func("DATEDIFF", end, start)
  81
  [end of sqlglot/dialects/spark.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/sqlglot/dialects/spark.py b/sqlglot/dialects/spark.py
  --- a/sqlglot/dialects/spark.py
  +++ b/sqlglot/dialects/spark.py
  @@ -35,6 +35,13 @@
   
   
   class Spark(Spark2):
  +    class Tokenizer(Spark2.Tokenizer):
  +        RAW_STRINGS = [
  +            (prefix + q, q)
  +            for q in t.cast(t.List[str], Spark2.Tokenizer.QUOTES)
  +            for prefix in ("r", "R")
  +        ]
  +
       class Parser(Spark2.Parser):
           FUNCTIONS = {
               **Spark2.Parser.FUNCTIONS,
  
verification_info: {"golden_diff": "diff --git a/sqlglot/dialects/spark.py b/sqlglot/dialects/spark.py\n--- a/sqlglot/dialects/spark.py\n+++ b/sqlglot/dialects/spark.py\n@@ -35,6 +35,13 @@\n \n \n class Spark(Spark2):\n+    class Tokenizer(Spark2.Tokenizer):\n+        RAW_STRINGS = [\n+            (prefix + q, q)\n+            for q in t.cast(t.List[str], Spark2.Tokenizer.QUOTES)\n+            for prefix in (\"r\", \"R\")\n+        ]\n+\n     class Parser(Spark2.Parser):\n         FUNCTIONS = {\n             **Spark2.Parser.FUNCTIONS,\n", "issue": "Spark raw String Support, comonly used with regexes\nThis fails with sqlglot:\r\n\r\n```python\r\nimport sqlglot\r\n\r\nsql = \"\"\"select regexp_replace('100-200', r'([^0-9])', '')\"\"\"\r\nsqlglot.parse_one(sql, read=\"databricks\")\r\n```\r\n\r\n**Official Documentation**\r\nhttps://spark.apache.org/docs/latest/sql-ref-literals.html\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nimport typing as t\n\nfrom sqlglot import exp\nfrom sqlglot.dialects.dialect import rename_func\nfrom sqlglot.dialects.spark2 import Spark2\nfrom sqlglot.helper import seq_get\n\n\ndef _parse_datediff(args: t.List) -> exp.Expression:\n    \"\"\"\n    Although Spark docs don't mention the \"unit\" argument, Spark3 added support for\n    it at some point. Databricks also supports this variant (see below).\n\n    For example, in spark-sql (v3.3.1):\n    - SELECT DATEDIFF('2020-01-01', '2020-01-05') results in -4\n    - SELECT DATEDIFF(day, '2020-01-01', '2020-01-05') results in 4\n\n    See also:\n    - https://docs.databricks.com/sql/language-manual/functions/datediff3.html\n    - https://docs.databricks.com/sql/language-manual/functions/datediff.html\n    \"\"\"\n    unit = None\n    this = seq_get(args, 0)\n    expression = seq_get(args, 1)\n\n    if len(args) == 3:\n        unit = this\n        this = args[2]\n\n    return exp.DateDiff(\n        this=exp.TsOrDsToDate(this=this), expression=exp.TsOrDsToDate(this=expression), unit=unit\n    )\n\n\nclass Spark(Spark2):\n    class Parser(Spark2.Parser):\n        FUNCTIONS = {\n            **Spark2.Parser.FUNCTIONS,\n            \"ANY_VALUE\": lambda args: exp.AnyValue(\n                this=seq_get(args, 0), ignore_nulls=seq_get(args, 1)\n            ),\n            \"DATEDIFF\": _parse_datediff,\n        }\n\n        FUNCTION_PARSERS = Spark2.Parser.FUNCTION_PARSERS.copy()\n        FUNCTION_PARSERS.pop(\"ANY_VALUE\")\n\n    class Generator(Spark2.Generator):\n        TYPE_MAPPING = {\n            **Spark2.Generator.TYPE_MAPPING,\n            exp.DataType.Type.MONEY: \"DECIMAL(15, 4)\",\n            exp.DataType.Type.SMALLMONEY: \"DECIMAL(6, 4)\",\n            exp.DataType.Type.UNIQUEIDENTIFIER: \"STRING\",\n        }\n\n        TRANSFORMS = {\n            **Spark2.Generator.TRANSFORMS,\n            exp.StartsWith: rename_func(\"STARTSWITH\"),\n            exp.TimestampAdd: lambda self, e: self.func(\n                \"DATEADD\", e.args.get(\"unit\") or \"DAY\", e.expression, e.this\n            ),\n        }\n        TRANSFORMS.pop(exp.AnyValue)\n        TRANSFORMS.pop(exp.DateDiff)\n        TRANSFORMS.pop(exp.Group)\n\n        def anyvalue_sql(self, expression: exp.AnyValue) -> str:\n            return self.function_fallback_sql(expression)\n\n        def datediff_sql(self, expression: exp.DateDiff) -> str:\n            unit = self.sql(expression, \"unit\")\n            end = self.sql(expression, \"this\")\n            start = self.sql(expression, \"expression\")\n\n            if unit:\n                return self.func(\"DATEDIFF\", unit, start, end)\n\n            return self.func(\"DATEDIFF\", end, start)\n", "path": "sqlglot/dialects/spark.py"}]}