The Wayback Machine - https://web.archive.org/web/20201011182953/https://github.com/JSQLParser/JSqlParser/pull/369
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

Add support for Apache Drill CSV column indices #369

Open
wants to merge 1 commit into
base: master
from

Conversation

@davidhaller
Copy link

@davidhaller davidhaller commented Dec 11, 2016

Apache Drill is able to perform queries like this on CSV files:

select columns[0], columns[1] from dfs.`/tmp/drill/test.csv`

JSqlParser could not parse column identifiers with an array index, so I modified the grammar. I'm not sure that I did everything right, as I never worked with JavaCC before. Tests still pass, and the debug output says that columns[0] and columns[1] were recognized as identifiers.

@coveralls
Copy link

@coveralls coveralls commented Dec 11, 2016

Coverage Status

Coverage decreased (-0.1%) to 84.108% when pulling 9afb380 on davidhaller:master into 66e44c9 on JSQLParser:master.

@wumpz
Copy link
Member

@wumpz wumpz commented Dec 11, 2016

The problem I see is, that there is already some kind of array indexing. Additionally the array index will be part of an identifier, which is IMHO not correct.

@davidhaller
Copy link
Author

@davidhaller davidhaller commented Dec 11, 2016

Apache Drill names columns from CSV files columns[0], columns[1] and so on which are usually renamed and casted to the desired data type, like this:

select cast(columns[0] as int) as user_id, columns[1] as username,
cast(columns[2] as timestamp) as registration_date
from `users.csv`

PostgreSQL, for example, has arrays similar like this which can be used within the "select" clause (https://www.postgresql.org/docs/9.6/static/arrays.html). If array support already exists in JSQLParser, what do I need to change to allow array access within "select"?

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

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.