Cascading - Determine 'Fields' at runtime

25 views
Skip to first unread message

Daniel Yanos

unread,
Apr 24, 2015, 4:13:20 PM4/24/15
to cascadi...@googlegroups.com
I'm trying to write an application in Cascading that allows a user to specify field names in a text file. Ideally I would read in the text file and could refer to the fields by name. However after some thorough searching I haven't been able to find a solution. If this isn't possible in Cascading could someone help me: a). Understand why this isn't possible b). Propose a workaround solution. 

Please let me know if you need more information on the problem I'm dealing with. 

Thanks in advance!

- dan

Pushpender Garg

unread,
Apr 25, 2015, 4:01:36 AM4/25/15
to cascadi...@googlegroups.com
Which scheme are you using. Its pretty much possible with text delimited scheme. You can pass around Fields class object for scheme, operations etc. To create Fields object we just need to pass field names (which can be parameterized) as string array to its constructor. Along with name you can now also pass type information for each field using appytypes method.

Andre Kelpe

unread,
Apr 25, 2015, 6:41:38 AM4/25/15
to cascadi...@googlegroups.com
You can specify the fieldnames any way you want, they are just Comparables. It is however important that they are known at planning time. After a flow has been planned they can no longer be modified.

If you look at lingual, it is exactly that: A generic cascading app which parses user input (SQL) and generates flows based on that input. It does of course a bit more than that, but the principal is what you are trying to do. I don't mean to say you should use lingual here, it is just an example that it is possible. http://www.cascading.org/projects/lingual/

The other example would be multitool, which is our cascading based sed/grep/awk/sort/cut replacement. It does a similar thing: http://docs.cascading.org/multitool/2.6/

Can you explain, what you are struggling with?

- André

--
You received this message because you are subscribed to the Google Groups "cascading-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cascading-use...@googlegroups.com.
To post to this group, send email to cascadi...@googlegroups.com.
Visit this group at http://groups.google.com/group/cascading-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/cascading-user/018df9af-a11b-4102-823e-44bbf1eb636f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Daniel Yanos

unread,
Apr 27, 2015, 8:47:19 AM4/27/15
to cascadi...@googlegroups.com
I got it working by using a string array. Not sure why I missed that and didn't try it earlier, but it worked perfectly. Thanks for all of the help!

- dan
Reply all
Reply to author
Forward
0 new messages