Hello Yogi, Enum type is not supported in CSV Formatter. Currently, only following types are supported BOOLEAN, DOUBLE, INTEGER, FLOAT, LONG, SHORT, CHARACTER, STRING, DATE
Thanks, Shubham On Mon, Jul 18, 2016 at 5:57 PM, Yogi Devendra <yogideven...@apache.org> wrote: > > Hi, > > We have a java object which has a enum field. We wish to send these > objects to CSVFormatter. > What should I specify for "type" of this field? > > For example, > > My Java Object is : > > https://github.com/yogidevendra/examples/blob/13cd0ec8d24b5e5b125fe7567c18197b0a9a8f7e/tutorials/filter/src/main/java/com/datatorrent/tutorial/filter/TransactionPOJO.java > > I am using schema as follows: > {"separator": "|","quoteChar":"\"","lineDelimiter":"\n","fields": > [{"name": "trasactionId","type": "long"},{"name": "amount","type": > "double"},{"name": "type","type": > "com.datatorrent.tutorial.filter.TransactionPOJO.TRANSACTION_TYPE"}]} > > But, it gives following exception: > > Abandoning deployment due to setup failure. > java.lang.IllegalArgumentException: No enum constant > > com.datatorrent.contrib.parser.DelimitedSchema.FieldType.COM.DATATORRENT.TUTORIAL.FILTER.TRANSACTIONPOJO.TRANSACTION_TYPE > at java.lang.Enum.valueOf(Enum.java:236) > at > com.datatorrent.contrib.parser.DelimitedSchema$FieldType.valueOf(DelimitedSchema.java:161) > at > com.datatorrent.contrib.parser.DelimitedSchema$Field.<init>(DelimitedSchema.java:289) > at > com.datatorrent.contrib.parser.DelimitedSchema.initialize(DelimitedSchema.java:199) > at > com.datatorrent.contrib.parser.DelimitedSchema.<init>(DelimitedSchema.java:169) > at > com.datatorrent.contrib.formatter.CsvFormatter.setup(CsvFormatter.java:128) > at > com.datatorrent.contrib.formatter.CsvFormatter.setup(CsvFormatter.java:67) > at com.datatorrent.stram.engine.Node.setup(Node.java:187) > at > com.datatorrent.stram.engine.StreamingContainer.setupNode(StreamingContainer.java:1309) > at > com.datatorrent.stram.engine.StreamingContainer.access$100(StreamingContainer.java:130) > at > com.datatorrent.stram.engine.StreamingContainer$2.run(StreamingContainer.java:1388) > > ~ Yogi > >