Hi folks,

We're using CalCite in our project for SQL parsing and validating. We have a 
question: is there any way to get all used columns from a SQL?


Consider the following case:

we have two tables `user` and `user_region`. And the SQL is like


```

SELECT

    id, name, age, country, province, city

FROM

    user

    INNER JOIN user_region ON user.id = user_region.user_id

WHERE age > 18;

```


The result will be a Map with two keys:

  *   'user' --> List('id', 'name', 'age')
  *   'user_region' --> List('country', 'province', 'city', 'user_id')

======

I've tried with SqlValidator (along with SqlValidatorScope, 
SqlValidatorNamespace) but found no easy ways to do this.
I also tried to replay the validate process in our code but it seems impossible 
since most classes used are package private.
[cid:e62a7598-728a-44d9-8e5c-365bdcde7c45]

Could you please give us some suggestions? Thanks!

Reply via email to