[
https://issues.apache.org/jira/browse/FLINK-2203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14584567#comment-14584567
]
ASF GitHub Bot commented on FLINK-2203:
---------------------------------------
Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/831#discussion_r32369781
--- Diff:
flink-staging/flink-table/src/main/scala/org/apache/flink/api/table/typeinfo/RowSerializer.scala
---
@@ -74,11 +79,16 @@ class RowSerializer(fieldSerializers:
Array[TypeSerializer[Any]])
override def serialize(value: Row, target: DataOutputView) {
val len = fieldSerializers.length
- var i = 0
- while (i < len) {
- val serializer = fieldSerializers(i)
- serializer.serialize(value.productElement(i), target)
- i += 1
+ (0 to len - 1).foreach {
+ index =>
+ val o: AnyRef = value.productElement(index).asInstanceOf[AnyRef]
+ if (o == null) {
+ target.writeBoolean(true)
+ } else {
+ target.writeBoolean(false)
+ val serializer = fieldSerializers(index)
+ serializer.serialize(value.productElement(index), target)
+ }
--- End diff --
Could you please change this back to the simple while loop. I know that
using the fancy Scala features is tempting but the performance of a simple
while loop should be better than creating a range and iterating over it using
foreach.
> Add Support for Null-Values in RowSerializer
> --------------------------------------------
>
> Key: FLINK-2203
> URL: https://issues.apache.org/jira/browse/FLINK-2203
> Project: Flink
> Issue Type: Improvement
> Components: Table API
> Reporter: Aljoscha Krettek
> Assignee: Shiti Saxena
> Priority: Minor
> Labels: Starter
>
> This would be a start towards proper handling of null values. We would still
> need to add support for null values in aggregations.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)