[ 
https://issues.apache.org/jira/browse/STORM-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15301311#comment-15301311
 ] 

ASF GitHub Bot commented on STORM-1778:
---------------------------------------

Github user vesense commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1410#discussion_r64682353
  
    --- Diff: 
external/sql/storm-sql-kafka/src/jvm/org/apache/storm/sql/kafka/CsvScheme.java 
---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.storm.sql.kafka;
    +
    +import org.apache.storm.spout.Scheme;
    +import org.apache.storm.sql.runtime.FieldInfo;
    +import org.apache.storm.tuple.Fields;
    +
    +import java.lang.reflect.Constructor;
    +import java.lang.reflect.InvocationTargetException;
    +import java.nio.ByteBuffer;
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +public class CsvScheme implements Scheme {
    +  List<FieldInfo> fieldsInfo = null;
    +  List<String> fields = null;
    +
    +  public CsvScheme(List<FieldInfo> fieldsInfo) {
    +    this.fieldsInfo = fieldsInfo;
    +    fields = new ArrayList<>();
    +    for (FieldInfo info : fieldsInfo) {
    +      fields.add(info.name());
    +    }
    +  }
    +
    +  @Override
    +  public List<Object> deserialize(ByteBuffer ser) {
    +    String str = ser.toString();
    +    String[] parts = str.split(",");
    --- End diff --
    
    This is not standard CSV format, something like `a,"b,c",d` is also valid. 
We can use TSV format to address.


> Scheme Extension Framework for KafkaDataSource and support for CSV format
> -------------------------------------------------------------------------
>
>                 Key: STORM-1778
>                 URL: https://issues.apache.org/jira/browse/STORM-1778
>             Project: Apache Storm
>          Issue Type: Improvement
>          Components: storm-sql
>            Reporter: Chuanlei Ni
>            Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to