Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Char? #50

Open
MaximilianJHuber opened this issue Mar 13, 2018 · 3 comments
Open

Parse Char? #50

MaximilianJHuber opened this issue Mar 13, 2018 · 3 comments

Comments

@MaximilianJHuber
Copy link

When I loadtable using JuliaDB and I tell the colparsers that a certain column is a Char , I get an error:

MethodError: no method matching fromtype(::Type{Char})

Can't TextParse parse characters? Or is it JuliaDB's fault?

@shashi
Copy link
Collaborator

shashi commented Mar 13, 2018

It's TextParse! Just need to add a parser for Char.

@MaximilianJHuber
Copy link
Author

Alright, I wrote a custom parser:

c_parse = CustomParser(Char) do str, i, len, opts
    return (Nullable(str[i]), i+2)
end

It works:
TextParse.tryparsenext(c_parse, "abcd;a;123.23;", 6, 1, nothing) gives:
Nullable{Char}('A')

But while the parse is of type Char, the column in my table has type TextParse.StrRange! Is this an issue for JuliaDB?

@MaximilianJHuber
Copy link
Author

MaximilianJHuber commented Mar 16, 2018

This works:

char_parser = CustomParser(Char) do str, i, len, opts
    return (Nullable{Char}(str[i]), i + 1)
end
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants