Re: Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-03 Thread Kyle Weaver
You will be able to access the actual value inside the function you pass to satisfies. I just meant that you will have to go through a function call. On Wed, Mar 3, 2021 at 1:58 AM Sonam Ramchand < sonam.ramch...@venturedive.com> wrote: > Yeah, that sounds right. But the only thing that confuses

Re: Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-03 Thread Sonam Ramchand
Yeah, that sounds right. But the only thing that confuses me is: PAssert.that(stream).satisfies(row -> assertThat("array_agg_concat_field", actual , containsInAnyOrder(Arrays.asList(1L,2L,3L,4L,5L,6L; How come I can access *actual* here when output is not materialized. On Tue, Mar

Re: Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-02 Thread Kyle Weaver
As you can see from existing tests, Beam doesn't materialize the output array directly. Instead you must use the PAssert API. I agree with Tyson's suggestion to use `satisfies`, which lets you do arbitrary assertions on the output data. On Tue, Mar 2, 2021 at 3:57 AM Sonam Ramchand <

Re: Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-02 Thread Sonam Ramchand
Is there any way I can access the output array resulting from the sql query? Then maybe I can sort and compare both *output array* and *expected output array *for the test to pass. On Tue, Mar 2, 2021 at 12:24 AM Kenneth Knowles wrote: > Yea, the reason is that SQL relations are not ordered. So

Re: Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-01 Thread Kenneth Knowles
Yea, the reason is that SQL relations are not ordered. So any ordering of [1, 2, 3, 4] and [5, 6] and [7, 8, 9] is possible and correct. Kenn On Mon, Mar 1, 2021 at 11:01 AM Tyson Hamilton wrote: > I didn't find anything like that after a brief look. What you could do > instead is something

Re: Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-01 Thread Tyson Hamilton
I didn't find anything like that after a brief look. What you could do instead is something like: PAssert.thatSingleton(stream).satisfies( row -> assertThat("array_field containsInAnyOrder", row.getArray("array_field"), containsInAnyOrder(Arrays.asList(...))); using junit/hamcrest matchers. I

Random outputs for ARRAY_CONCAT_AGG fn zetasql

2021-03-01 Thread Sonam Ramchand
Hi Devs, I have implemented the ARRAY_CONCAT_AGG function for zetasql dialect. I am trying to validate the test as: @Test public void testArrayConcatAggZetasql() { String sql = "SELECT ARRAY_CONCAT_AGG(x) AS array_concat_agg FROM (SELECT [1, 2, 3, 4] AS x UNION ALL SELECT [5, 6] UNION ALL