Skip to content
Snippets Groups Projects
Unverified Commit 2e3ef4fd authored by Ariya Hidayat's avatar Ariya Hidayat Committed by GitHub
Browse files

MBQL schema: allows :case for a string expression (#20913)

parent 702833f6
No related branches found
No related tags found
No related merge requests found
...@@ -421,7 +421,7 @@ ...@@ -421,7 +421,7 @@
(def string-expressions (def string-expressions
"String functions" "String functions"
#{:substring :trim :rtrim :ltrim :upper :lower :replace :concat :regex-match-first :coalesce}) #{:substring :trim :rtrim :ltrim :upper :lower :replace :concat :regex-match-first :coalesce :case})
(declare StringExpression) (declare StringExpression)
...@@ -523,13 +523,6 @@ ...@@ -523,13 +523,6 @@
(defclause ^{:requires-features #{:expressions :regex}} regex-match-first (defclause ^{:requires-features #{:expressions :regex}} regex-match-first
s StringExpressionArg, pattern s/Str) s StringExpressionArg, pattern s/Str)
(def ^:private StringExpression*
(one-of substring trim ltrim rtrim replace lower upper concat regex-match-first coalesce))
(def ^:private StringExpression
"Schema for the definition of an string expression."
(s/recursive #'StringExpression*))
(defclause ^{:requires-features #{:expressions}} + (defclause ^{:requires-features #{:expressions}} +
x NumericExpressionArg, y NumericExpressionArgOrInterval, more (rest NumericExpressionArgOrInterval)) x NumericExpressionArg, y NumericExpressionArgOrInterval, more (rest NumericExpressionArgOrInterval))
...@@ -570,6 +563,12 @@ ...@@ -570,6 +563,12 @@
"Schema for the definition of an arithmetic expression." "Schema for the definition of an arithmetic expression."
(s/recursive #'ArithmeticExpression*)) (s/recursive #'ArithmeticExpression*))
(declare StringExpression*)
(def ^:private StringExpression
"Schema for the definition of an string expression."
(s/recursive #'StringExpression*))
;;; ----------------------------------------------------- Filter ----------------------------------------------------- ;;; ----------------------------------------------------- Filter -----------------------------------------------------
...@@ -728,6 +727,10 @@ ...@@ -728,6 +727,10 @@
(def ^:private ArithmeticExpression* (def ^:private ArithmeticExpression*
(one-of + - / * coalesce length floor ceil round abs power sqrt exp log case)) (one-of + - / * coalesce length floor ceil round abs power sqrt exp log case))
(def ^:private StringExpression*
(one-of substring trim ltrim rtrim replace lower upper concat regex-match-first coalesce case))
(def FieldOrExpressionDef (def FieldOrExpressionDef
"Schema for anything that is accepted as a top-level expression definition, either an arithmetic expression such as a "Schema for anything that is accepted as a top-level expression definition, either an arithmetic expression such as a
`:+` clause or a `:field` clause." `:+` clause or a `:field` clause."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment