twalthr commented on a change in pull request #11081: [FLINK-16033][table-api]
Introduced Java Table API Expression DSL
URL: https://github.com/apache/flink/pull/11081#discussion_r385005863
##########
File path:
flink-table/flink-table-api-scala/src/main/scala/org/apache/flink/table/api/expressionDsl.scala
##########
@@ -1284,47 +490,85 @@ trait ImplicitExpressionConversions {
* @see TableEnvironment#createTemporaryFunction
* @see TableEnvironment#createTemporarySystemFunction
*/
- def call(path: String, params: Expression*): Expression = {
- lookupCall(path, params: _*)
- }
+ def call(path: String, params: Expression*): Expression =
Expressions.call(path, params: _*)
+
+ /**
+ * A call to an unregistered, inline function. For functions that have been
registered before and
+ * are identified by a name, use [[call(String, Object...)]].
+ */
+ def call(function: UserDefinedFunction, params: Expression*): Expression =
Expressions.call(
+ function,
+ params: _*)
//
----------------------------------------------------------------------------------------------
// Implicit expressions in prefix notation
//
----------------------------------------------------------------------------------------------
+ /**
+ * Creates a SQL literal.
+ *
+ * The data type is derived from the object's class and its value.
+ *
+ * For example:
+ *
+ * - `lit(12)`` leads to `INT`
+ * - `lit("abc")`` leads to `CHAR(3)`
+ * - `lit(new BigDecimal("123.45"))` leads to `DECIMAL(5, 2)`
+ *
+ * See [[org.apache.flink.table.types.utils.ValueDataTypeConverter]] for a
list of supported
+ * literal values.
+ */
+ def lit(v: Any): Expression = Expressions.lit(v)
+
+ /**
+ * Creates a SQL literal of a given [[DataType]].
+ *
+ * The method [[lit(Object)]] is preferred as it extracts the [[DataType]]
+ * automatically. The class of `v` must be supported according to the
+ *
[[org.apache.flink.table.types.logical.LogicalType#supportsInputConversion(Class)]].
+ */
+ def lit(v: Any, dataType: DataType): Expression = Expressions.lit(v,
dataType)
+
+ /**
+ * Returns negative numeric.
+ */
+ def minus(v: Expression): Expression = {
Review comment:
should we name it negative? I don't know.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services