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

ASF GitHub Bot commented on APEXMALHAR-2105:
--------------------------------------------

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

    
https://github.com/apache/incubator-apex-malhar/pull/306#discussion_r65411669
  
    --- Diff: 
contrib/src/main/java/com/datatorrent/contrib/formatter/CsvFormatter.java ---
    @@ -58,215 +68,156 @@
     public class CsvFormatter extends Formatter<String>
     {
     
    -  private ArrayList<Field> fields;
    -  @NotNull
    -  protected String classname;
    -  @NotNull
    -  protected int fieldDelimiter;
    -  protected String lineDelimiter;
    +  /**
    +   * Names of all the fields in the same order that would appear in output
    +   * records
    +   */
    +  private transient String[] nameMapping;
    +  /**
    +   * Cell processors are an integral part of reading and writing with 
Super CSV
    +   * they automate the data type conversions, and enforce constraints.
    +   */
    +  private transient CellProcessor[] processors;
    +  /**
    +   * Writing preferences that are passed through schema
    +   */
    +  private transient CsvPreference preference;
     
    +  /**
    +   * Contents of the schema.Schema is specified in a json format as per
    +   * {@link DelimitedSchema}
    +   */
       @NotNull
    -  protected String fieldInfo;
    +  private String schema;
    +  /**
    +   * Schema is read into this object to access fields
    +   */
    +  private transient DelimitedSchema delimitedParserSchema;
     
    -  public enum FIELD_TYPE
    -  {
    -    BOOLEAN, DOUBLE, INTEGER, FLOAT, LONG, SHORT, CHARACTER, STRING, DATE
    -  };
    +  /**
    +   * metric to keep count of number of tuples emitted on error port port
    +   */
    +  @AutoMetric
    +  protected long errorTupleCount;
    +
    +  /**
    +   * metric to keep count of number of tuples emitted on out port
    +   */
    +  @AutoMetric
    +  protected long emittedObjectCount;
     
    -  protected transient String[] nameMapping;
    -  protected transient CellProcessor[] processors;
    -  protected transient CsvPreference preference;
    +  /**
    +   * metric to keep count of number of tuples emitted on input port
    +   */
    +  @AutoMetric
    +  protected long incomingTuplesCount;
     
       public CsvFormatter()
    --- End diff --
    
    You can remove the constructor as nothing is there in it.


> Enhance CSV Formatter to take in schema similar to Csv Parser
> -------------------------------------------------------------
>
>                 Key: APEXMALHAR-2105
>                 URL: https://issues.apache.org/jira/browse/APEXMALHAR-2105
>             Project: Apache Apex Malhar
>          Issue Type: Improvement
>            Reporter: shubham pathak
>
> CSV Parser takes in a  schema that specifies field names and constraints. CSV 
> Formatter also needs same information, but in the current implementation , it 
> takes it as "fieldInfo".  Enhancing CSV Formatter to support the same schema 
> as CSV Parser would make it simpler for the end user.



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

Reply via email to