File: translate-sql-helpers.md

package info (click to toggle)
r-cran-dbplyr 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,644 kB
  • sloc: sh: 13; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# duplicates throw an error

    Code
      sql_translator(round = function(x) x, round = function(y) y)
    Condition
      Error in `sql_translator()`:
      ! Duplicate names in `sql_translator()`
      * round

# output of print method for sql_variant is correct

    Code
      sql_variant(sim_trans, sim_trans, sim_trans)
    Output
      <sql_variant>
      scalar:    +
      aggregate: +
      window:    +

# win_rank() is accepted by the sql_translator

    Code
      sql_variant(sql_translator(test = win_rank("test")))
    Output
      <sql_variant>
      scalar:    test

# sql_prefix checks arguments

    Code
      sin_db(sin(1, 2))
    Condition
      Error in `sin()`:
      ! 2 arguments passed to 'sin' which requires 1

---

    Code
      sin_db(sin(a = 1))
    Condition
      Error in `sin()`:
      ! supplied argument name 'a' does not match 'x'

# runif is translated

    Code
      test_translate_sql(runif(2))
    Condition
      Error in `sql_runif()`:
      ! Only `n = n()` is supported.