comphead commented on issue #1681: URL: https://github.com/apache/datafusion-comet/issues/1681#issuecomment-2830857856
> > > interesting that referring to first column which is `a` returns result correctly, but `b` does not > > > > > > This is because we read all fields in the struct, so we are guaranteed to produce the correct results in the following cases: > > ``` > > * the user only selects the first field > > > > * the user selects all fields > > ``` > > That is not quite correct. We will accidentally have the correct behavior when the user selects a set of fields starting with the first field and not skipping any fields in that range. So for a struct with fields `a, b, c, d`, we will have correct behavior for reading `a` or `a, b` or `a, b, c`, or `a, b, c, d`. Reverse also works. but `a, c` skipping `b` doesn't ``` PASSED test("native reader - read a STRUCT subfield from ARRAY of STRUCTS - field from first") { testSingleLineQuery( """ | select array(str0, str1) c0 from | ( | select | named_struct('a', 1, 'b', 'n', 'c', 'x') str0, | named_struct('a', 2, 'b', 'w', 'c', 'y') str1 | ) |""".stripMargin, "select c0[0].a, c0[0].b, c0[0].c from tbl") } PASSED test("native reader - read a STRUCT subfield from ARRAY of STRUCTS - reverse fields") { testSingleLineQuery( """ | select array(str0, str1) c0 from | ( | select | named_struct('a', 1, 'b', 'n', 'c', 'x') str0, | named_struct('a', 2, 'b', 'w', 'c', 'y') str1 | ) |""".stripMargin, "select c0[0].c, c0[0].b, c0[0].a from tbl") } FAILED test("native reader - read a STRUCT subfield from ARRAY of STRUCTS - skip field") { testSingleLineQuery( """ | select array(str0, str1) c0 from | ( | select | named_struct('a', 1, 'b', 'n', 'c', 'x') str0, | named_struct('a', 2, 'b', 'w', 'c', 'y') str1 | ) |""".stripMargin, "select c0[0].a, c0[0].c from tbl") } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org