flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #3529: [FLINK-6039] [core] Row of TableFunction should su...
Date Tue, 14 Mar 2017 09:45:20 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3529#discussion_r105862926
  
    --- Diff: flink-core/src/main/java/org/apache/flink/types/Row.java ---
    @@ -66,10 +66,11 @@ public int getArity() {
     	 * Gets the field at the specified position.
     	 * @param pos The position of the field, 0-based.
     	 * @return The field at the specified position.
    -	 * @throws IndexOutOfBoundsException Thrown, if the position is negative, or equal to,
or larger than the number of fields.
    +	 * Return null if the position is equal to, or larger than the number of fields.
    +	 * @throws IndexOutOfBoundsException Thrown, if the position is negative.
     	 */
     	public Object getField(int pos) {
    -		return fields[pos];
    +		return pos >= fields.length ? null : fields[pos];
    --- End diff --
    
    As I said before, I think the default should be to be type-safe. If a TableFunction would
like to relax its type, this should be explicitly indicated in my opinion. Either through
a dedicated TableFunction or a marker interface.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message