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 2019/09/20 03:14:38 UTC

[GitHub] [flink] lirui-apache commented on a change in pull request #9721: [FLINK-14129][hive] HiveTableSource should implement ProjectableTable…

lirui-apache commented on a change in pull request #9721: [FLINK-14129][hive] HiveTableSource should implement ProjectableTable…
URL: https://github.com/apache/flink/pull/9721#discussion_r326457315
 
 

 ##########
 File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveTableInputFormat.java
 ##########
 @@ -207,19 +211,22 @@ public Row nextRecord(Row ignore) throws IOException {
 		if (reachedEnd()) {
 			return null;
 		}
-		Row row = new Row(rowArity);
+		Row row = new Row(fields.length);
 		try {
 			//Use HiveDeserializer to deserialize an object out of a Writable blob
 			Object hiveRowStruct = deserializer.deserialize(value);
-			int index = 0;
-			for (; index < structFields.size(); index++) {
-				StructField structField = structFields.get(index);
-				Object object = HiveInspectors.toFlinkObject(structField.getFieldObjectInspector(),
-						structObjectInspector.getStructFieldData(hiveRowStruct, structField));
-				row.setField(index, object);
-			}
-			for (String partition : partitionColNames){
-				row.setField(index++, hiveTablePartition.getPartitionSpec().get(partition));
+			for (int i = 0; i < fields.length; i++) {
+				// non-partition column
+				if (fields[i] < structFields.size()) {
+					StructField structField = structFields.get(fields[i]);
+					Object object = HiveInspectors.toFlinkObject(structField.getFieldObjectInspector(),
+							structObjectInspector.getStructFieldData(hiveRowStruct, structField));
+					row.setField(i, object);
+				} else {
+					// partition column
+					String partition = partitionColNames.get(fields[i] - structFields.size());
 
 Review comment:
   Yeah, will pre-compute the partition values.

----------------------------------------------------------------
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


With regards,
Apache Git Services