public static int findColumnIndex(
      TableArgument tableArgument, String expectedFieldName, Set<Type> expectedTypes)
      throws UDFException {
    for (int i = 0; i < tableArgument.getFieldTypes().size(); i++) {
      Optional<String> fieldName = tableArgument.getFieldNames().get(i);
      if (fieldName.isPresent() && expectedFieldName.equalsIgnoreCase(fieldName.get())) {
        if (!expectedTypes.contains(tableArgument.getFieldTypes().get(i))) {
          throw new UDFException(
              String.format("The type of the column [%s] is not as expected.", expectedFieldName));
        }
        return i;
      }
    }
    throw new UDFException(
        String.format(
            "Required column [%s] not found in the source table argument.", expectedFieldName));
  }
Find the index of the column in the table argument.

@param tableArgument the table argument
@param expectedFieldName the expected field name
@param expectedTypes the expected types
@return the index of the time column, -1 if not found
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/WindowTVFUtils.java