fsk119 commented on code in PR #26583:
URL: https://github.com/apache/flink/pull/26583#discussion_r2108213262
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/utils/SqlValidatorUtils.java:
##########
@@ -49,6 +59,75 @@ public static void adjustTypeForMapConstructor(
}
}
+ public static boolean throwValidationSignatureErrorOrReturnFalse(
+ SqlCallBinding callBinding, boolean throwOnFailure) {
+ if (throwOnFailure) {
+ throw callBinding.newValidationSignatureError();
+ } else {
+ return false;
+ }
+ }
+
+ @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
+ public static boolean throwExceptionOrReturnFalse(
+ Optional<RuntimeException> e, boolean throwOnFailure) {
+ if (e.isPresent()) {
+ if (throwOnFailure) {
+ throw e.get();
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Checks whether the heading operands are in the form {@code (ROW,
DESCRIPTOR, DESCRIPTOR ...,
+ * other params)}, returning whether successful, and throwing if any
columns are not found.
+ *
+ * @param callBinding The call binding
+ * @param descriptorStartPos The position of the first descriptor operand
+ * @param descriptorCount The number of descriptors following the first
operand (e.g. the table)
+ * @return true if validation passes; throws if any columns are not found
+ */
+ public static boolean checkTableAndDescriptorOperands(
+ SqlCallBinding callBinding, int descriptorStartPos, int
descriptorCount) {
Review Comment:
I think it's better to use the following signature
```
public static boolean checkTableAndDescriptorOperands(
SqlCallBinding callBinding, Integer... location)
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]