nichunen created KYLIN-3828:
-------------------------------

             Summary: ArrayIndexOutOfBoundsException thrown when build a 
streaming cube with empty data in its first dimension
                 Key: KYLIN-3828
                 URL: https://issues.apache.org/jira/browse/KYLIN-3828
             Project: Kylin
          Issue Type: Bug
          Components: NRT Streaming
    Affects Versions: v2.6.0
            Reporter: nichunen
            Assignee: nichunen
             Fix For: Future


The root cause is 
in org.apache.kylin.source.kafka.hadoop.KafkaFlatTableMapper#doMap
{code:java}
    public void doMap(LongWritable key, BytesWritable value, Context context) 
throws IOException, InterruptedException {
        ByteBuffer buffer = ByteBuffer.wrap(value.getBytes(), 0, 
value.getLength());
        StreamingMessageRow row = streamingParser.parse(buffer).get(0);
        if (row == null) {
            throw new IllegalArgumentException("");
        }

        data = StringUtil.join(row.getData(), delimiter);
        // output this row to value
        outValue.set(Bytes.toBytes(data));
        context.write(outKey, outValue);
    }
{code}
Method _StringUtil.join_ is used to join a collection of string to a single 
string with delimiter. But _org.apache.kylin.common.util.StringUtil#join_ will 
ignore the leading empty strings in the colletion, source code is:
{code:java}
    public static String join(Iterable<String> parts, String separator) {
        StringBuilder buf = new StringBuilder();
        for (String p : parts) {
            if (buf.length() > 0)
                buf.append(separator);
            buf.append(p);
        }
        return buf.toString();
    }
{code}





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to