flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhue...@apache.org
Subject [2/2] flink git commit: [FLINK-3926] [core] Fix NumberFormatException in TupleTypeInfo.getFieldIndex()
Date Wed, 18 May 2016 22:21:16 GMT
[FLINK-3926] [core] Fix NumberFormatException in TupleTypeInfo.getFieldIndex()

This closes #2004


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/db5ff636
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/db5ff636
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/db5ff636

Branch: refs/heads/release-1.0
Commit: db5ff636bc9b59b80cf661f880537882bcf546c4
Parents: 6f135c1
Author: Yijie Shen <henry.yijieshen@gmail.com>
Authored: Wed May 18 23:31:33 2016 +0800
Committer: Fabian Hueske <fhueske@apache.org>
Committed: Thu May 19 00:19:28 2016 +0200

----------------------------------------------------------------------
 .../org/apache/flink/api/java/typeutils/TupleTypeInfo.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/db5ff636/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java
b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java
index 9ecbe73..99dcf0c 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java
@@ -82,11 +82,12 @@ public final class TupleTypeInfo<T extends Tuple> extends TupleTypeInfoBase<T>
{
 	@Override
 	@PublicEvolving
 	public int getFieldIndex(String fieldName) {
-		int fieldIndex = Integer.parseInt(fieldName.substring(1));
-		if (fieldIndex >= getArity()) {
-			return -1;
+		for (int i = 0; i < fieldNames.length; i++) {
+			if (fieldNames[i].equals(fieldName)) {
+				return i;
+			}
 		}
-		return fieldIndex;
+		return -1;
 	}
 
 	@SuppressWarnings("unchecked")


Mime
View raw message