24
24
ExpressionInfo = namedtuple (
25
25
"ExpressionInfo" , "className name usage arguments examples note since deprecated" )
26
26
27
+ _virtual_operator_infos = [
28
+ ExpressionInfo (
29
+ className = "" ,
30
+ name = "!=" ,
31
+ usage = "expr1 != expr2 - Returns true if `expr1` is not equal to `expr2`, " +
32
+ "or false otherwise." ,
33
+ arguments = "\n Arguments:\n " +
34
+ """* expr1, expr2 - the two expressions must be same type or can be casted to
35
+ a common type, and must be a type that can be used in equality comparison.
36
+ Map type is not supported. For complex types such array/struct,
37
+ the data types of fields must be orderable.""" ,
38
+ examples = "\n Examples:\n " +
39
+ "> SELECT 1 != 2;\n " +
40
+ " true\n " +
41
+ "> SELECT 1 != '2';\n " +
42
+ " true\n " +
43
+ "> SELECT true != NULL;\n " +
44
+ " NULL\n " +
45
+ "> SELECT NULL != NULL;\n " +
46
+ " NULL" ,
47
+ note = "" ,
48
+ since = "1.0.0" ,
49
+ deprecated = "" ),
50
+ ExpressionInfo (
51
+ className = "" ,
52
+ name = "<>" ,
53
+ usage = "expr1 != expr2 - Returns true if `expr1` is not equal to `expr2`, " +
54
+ "or false otherwise." ,
55
+ arguments = "\n Arguments:\n " +
56
+ """* expr1, expr2 - the two expressions must be same type or can be casted to
57
+ a common type, and must be a type that can be used in equality comparison.
58
+ Map type is not supported. For complex types such array/struct,
59
+ the data types of fields must be orderable.""" ,
60
+ examples = "\n Examples:\n " +
61
+ "> SELECT 1 != 2;\n " +
62
+ " true\n " +
63
+ "> SELECT 1 != '2';\n " +
64
+ " true\n " +
65
+ "> SELECT true != NULL;\n " +
66
+ " NULL\n " +
67
+ "> SELECT NULL != NULL;\n " +
68
+ " NULL" ,
69
+ note = "" ,
70
+ since = "1.0.0" ,
71
+ deprecated = "" ),
72
+ ExpressionInfo (
73
+ className = "" ,
74
+ name = "between" ,
75
+ usage = "expr1 [NOT] BETWEEN expr2 AND expr3 - " +
76
+ "evaluate if `expr1` is [not] in between `expr2` and `expr3`." ,
77
+ arguments = "" ,
78
+ examples = "\n Examples:\n " +
79
+ "> SELECT col1 FROM VALUES 1, 3, 5, 7 WHERE col1 BETWEEN 2 AND 5;\n " +
80
+ " 3\n " +
81
+ " 5" ,
82
+ note = "" ,
83
+ since = "1.0.0" ,
84
+ deprecated = "" ),
85
+ ExpressionInfo (
86
+ className = "" ,
87
+ name = "case" ,
88
+ usage = "CASE expr1 WHEN expr2 THEN expr3 " +
89
+ "[WHEN expr4 THEN expr5]* [ELSE expr6] END - " +
90
+ "When `expr1` = `expr2`, returns `expr3`; " +
91
+ "when `expr1` = `expr4`, return `expr5`; else return `expr6`." ,
92
+ arguments = "\n Arguments:\n " +
93
+ "* expr1 - the expression which is one operand of comparison.\n " +
94
+ "* expr2, expr4 - the expressions each of which is the other " +
95
+ " operand of comparison.\n " +
96
+ "* expr3, expr5, expr6 - the branch value expressions and else value expression" +
97
+ " should all be same type or coercible to a common type." ,
98
+ examples = "\n Examples:\n " +
99
+ "> SELECT CASE col1 WHEN 1 THEN 'one' " +
100
+ "WHEN 2 THEN 'two' ELSE '?' END FROM VALUES 1, 2, 3;\n " +
101
+ " one\n " +
102
+ " two\n " +
103
+ " ?\n " +
104
+ "> SELECT CASE col1 WHEN 1 THEN 'one' " +
105
+ "WHEN 2 THEN 'two' END FROM VALUES 1, 2, 3;\n " +
106
+ " one\n " +
107
+ " two\n " +
108
+ " NULL" ,
109
+ note = "" ,
110
+ since = "1.0.1" ,
111
+ deprecated = "" ),
112
+ ExpressionInfo (
113
+ className = "" ,
114
+ name = "||" ,
115
+ usage = "expr1 || expr2 - Returns the concatenation of `expr1` and `expr2`." ,
116
+ arguments = "" ,
117
+ examples = "\n Examples:\n " +
118
+ "> SELECT 'Spark' || 'SQL';\n " +
119
+ " SparkSQL\n " +
120
+ "> SELECT array(1, 2, 3) || array(4, 5) || array(6);\n " +
121
+ " [1,2,3,4,5,6]" ,
122
+ note = "\n || for arrays is available since 2.4.0.\n " ,
123
+ since = "2.3.0" ,
124
+ deprecated = "" )
125
+ ]
126
+
27
127
28
128
def _list_function_infos (jvm ):
29
129
"""
@@ -32,7 +132,7 @@ def _list_function_infos(jvm):
32
132
"""
33
133
34
134
jinfos = jvm .org .apache .spark .sql .api .python .PythonSQLUtils .listBuiltinFunctionInfos ()
35
- infos = []
135
+ infos = _virtual_operator_infos
36
136
for jinfo in jinfos :
37
137
name = jinfo .getName ()
38
138
usage = jinfo .getUsage ()
0 commit comments