[
https://issues.apache.org/jira/browse/STORM-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15285889#comment-15285889
]
ASF GitHub Bot commented on STORM-1778:
---------------------------------------
Github user HeartSaVioR commented on a diff in the pull request:
https://github.com/apache/storm/pull/1410#discussion_r63456612
--- 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) {
--- End diff --
1. I think we can have some test cases on this.
2. StringScheme#deserializeString doesn't use ByteBuffer#toString, and
javadoc says it provides information about instance state, not content:
https://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#toString()
> 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)