forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathST08.yml
More file actions
70 lines (59 loc) · 1.54 KB
/
Copy pathST08.yml
File metadata and controls
70 lines (59 loc) · 1.54 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
rule: ST08
test_fail_distinct_with_parenthesis_1:
# Check we get fails for using DISTINCT apparently incorrectly
fail_str: SELECT DISTINCT(a)
fix_str: SELECT DISTINCT a
test_fail_distinct_with_parenthesis_2:
fail_str: SELECT DISTINCT(a + b) * c
fix_str: SELECT DISTINCT (a + b) * c
test_fail_distinct_with_parenthesis_3:
fail_str: SELECT DISTINCT (a)
fix_str: SELECT DISTINCT a
test_fail_distinct_with_parenthesis_4:
pass_str: SELECT DISTINCT (a + b) * c
test_fail_distinct_with_parenthesis_5:
fail_str: |
SELECT DISTINCT(field_1)
FROM my_table
fix_str: |
SELECT DISTINCT field_1
FROM my_table
test_fail_distinct_with_parenthesis_6:
fail_str: |
SELECT DISTINCT(a), b
fix_str: |
SELECT DISTINCT a, b
test_fail_distinct_with_parenthesis_7:
pass_str: |
SELECT
DISTINCT ON(bcolor) bcolor,
fcolor
FROM
distinct_demo
configs:
core:
dialect: postgres
test_pass_no_distinct:
pass_str: |
SELECT a, b
test_fail_distinct_column_inside_count:
fail_str: |
SELECT COUNT(DISTINCT(unique_key))
fix_str: |
SELECT COUNT(DISTINCT unique_key)
test_fail_distinct_concat_inside_count:
fail_str: |
SELECT COUNT(DISTINCT(CONCAT(col1, '-', col2, '-', col3)))
fix_str: |
SELECT COUNT(DISTINCT CONCAT(col1, '-', col2, '-', col3))
test_pass_distinct_subquery_inside_count:
pass_str: |
SELECT
COUNT(
DISTINCT(
SELECT ANY_VALUE(id)
FROM UNNEST(tag) t
)
)
FROM
dataset_name.table_name;