Hi all, 

I'd like to propose a new casting step, asNumber(), which is similar to 
asString() and asDate(), to ease numerical data manipulation.

The basic concept of this step is to take incoming traversers and convert them 
into desired types via a set of Number tokens as parameter. If no token is 
provided, the step will try to parse into `int` or `double` based on the input. 
In case of non-parsable input, an exception will be thrown.

For inputs types: 
- Number: casted into the specified types, potentially overflow exceptions
- String: parsed into specified types, potentially parsing exception
- Collection: will have to be unfolded (can consider adding scopes in the 
future)
- Others: parsing exception

I've opened up a PR here [https://github.com/apache/tinkerpop/pull/3122] with 
the step proposal in detail. Suggestions and comments are welcome. 

Cheers,

Yang

Reply via email to