You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/08/24 06:24:49 UTC

[GitHub] [flink] JingsongLi commented on a change in pull request #13144: [FLINK-15853][hive][table-planner-blink] Use the new type inference f…

JingsongLi commented on a change in pull request #13144:
URL: https://github.com/apache/flink/pull/13144#discussion_r475367179



##########
File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveScalarFunction.java
##########
@@ -104,4 +142,62 @@ public Object eval(Object... args) {
 	 * Evaluation logical, args will be wrapped when is a single array.
 	 */
 	protected abstract Object evalInternal(Object[] args);
+
+	private Tuple2<Object[], DataType[]> getConstantArgAndTypes(CallContext callContext) {
+		DataType[] inputTypes = callContext.getArgumentDataTypes().toArray(new DataType[0]);
+		Object[] constantArgs = new Object[inputTypes.length];
+		for (int i = 0; i < constantArgs.length; i++) {
+			if (callContext.isArgumentLiteral(i)) {
+				constantArgs[i] = callContext.getArgumentValue(
+						i, ClassLogicalTypeConverter.getDefaultExternalClassForType(inputTypes[i].getLogicalType()))
+						.orElse(null);
+			}
+		}
+		return Tuple2.of(constantArgs, inputTypes);
+	}
+
+	/**
+	 * Validate input argument types and decide result type.
+	 */
+	protected abstract DataType validateInputTypes(DataType[] argTypes) throws UDFArgumentException;

Review comment:
       Looks like it is `inferOutputType`




----------------------------------------------------------------
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:
users@infra.apache.org