Github user gauravgopi123 commented on a diff in the pull request: https://github.com/apache/incubator-apex-malhar/pull/154#discussion_r48877866 --- Diff: contrib/src/main/java/com/datatorrent/contrib/parser/CsvParser.java --- @@ -62,247 +69,178 @@ * @since 3.2.0 */ @InterfaceStability.Evolving -public class CsvParser extends Parser<String, String> +public class CsvParser extends Parser<byte[], KeyValPair<String, String>> { - - private ArrayList<Field> fields; - @NotNull - protected int fieldDelimiter; - protected String lineDelimiter; - + /** + * Map Reader to read delimited records + */ + private transient CsvMapReader csvMapReader; + /** + * Bean Reader to read delimited records + */ + private transient CsvBeanReader csvBeanReader; + /** + * Reader used by csvMapReader and csvBeanReader + */ + private transient ReusableStringReader csvStringReader; + /** + * Contents of the schema + */ @NotNull - protected String fieldInfo; - - protected transient String[] nameMapping; - protected transient CellProcessor[] processors; - private transient CsvBeanReader csvReader; - - public enum FIELD_TYPE - { - BOOLEAN, DOUBLE, INTEGER, FLOAT, LONG, SHORT, CHARACTER, STRING, DATE - }; + private String schema; + /** + * Schema is read into this object to access fields + */ + private transient DelimitedSchema delimitedParserSchema; + /** + * 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; + /** + * Names of all the fields in the same order of incoming records + */ + private transient String[] nameMapping; + /** + * header-this will be delimiter separated string of field names + */ + private transient String header; + /** + * Reading preferences that are passed through schema + */ + private transient CsvPreference preference; - @NotNull - private transient ReusableStringReader csvStringReader = new ReusableStringReader(); + @AutoMetric + long parsedOutputCount; --- End diff -- Javadoc for this?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---