On Sun, Oct 4, 2015 at 2:27 PM, Aman Sinha <[email protected]> wrote:
>
> For multiple levels, would there be a requirement to expand recursively to
> more levels within b ? or is that not a valid requirement ?
>

I want to make sure we're speaking the same language. Can you expound on
what you mean by recursion? To me, there are a number of fields within the
b map. Those fields would be exposed at the level of the projection
directly. Whatever those fields contain would not change shape.

Let me give an example of what I think you mean by full recursion and what
I think is bad about it. In this example, I'm illustrating that we don't
currently do recursive expansion for * at the top-level of record and thus
changing the behavior at a different level would be undesirable.

For example, let's say the table t has the following structure:
{
  a :4,
  b: {
    s: 1,
    t: 2
  }
}

If we currently run the query select * from t, we see:
{
  a :4,
  b: {
    s: 1,
    t: 2
  }
}

*as opposed to* what I would call full recursion

{
  a :4,
  s: 1,
  t: 2
}

The key here is that the * does change the shape of the record. The same
should be true at any level.

In general, a record is simply a map (or struct). A top-level star
projection at the record level returns all the fields associated with the
record. If we project one-level deeper, I would expect the same behavior.

On the case of the aliases, I'd actually argue that in Drill, "select t.*
as x from t" would ideally return a single column x which has a projection
of all columns of the table t.

Reply via email to