Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for Apache Drill CSV column indices #369
Conversation
|
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. |
|
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"? |
Apache Drill is able to perform queries like this on CSV files:
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.