Hi there,

I'm a contributor to Apache Pinot, which uses Apache Calcite under the
hood. Like some other databases, Pinot defines some *private* columns that
customers can use, but they are not included in select * by default. I
guess this is a not so strange pattern. For example, Postgres does the same
with `xmin` and `xmax`.

My question is: What is the correct way to implement this behavior? We
initially override SqlValidatorImpl.expandStar in our own Validator, but
recently we have enabled identifierExpansion and these columns are
projected again.

Reading the code, it looks like we could
override SqlValidatorImpl.addToSelectList doing something like:

```
protected void addToSelectList(
      List<SqlNode> list,
      Set<String> aliases,
      List<Map.Entry<String, RelDataType>> fieldList,
      SqlNode exp,
      SelectScope scope,
      final boolean includeSystemVars) {
   if (!isPrivateColumn(exp)) {
     super.addToSelectList(list, aliases, fieldList, expr, scope,
includeSystemVars);
   }
}
```

But the javadoc doesn't say that it is allowed to not add the column to
list and fieldList, so that change may break something.

Reply via email to