-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for column ordering #228
Conversation
This test fails for the reference implementation for a reason that I don't yet understand:
|
Still to do:
|
Hi John, I said a little bit about it here. Basically, I took some a few views from unit tests and placed them in the sof playground and received different column ordering results than the unit tests. Examples can be seen with union.json -> "basic" and union.json ->"unionAll + column". I am not sure if this will help or be different, but this is how I am currently doing column ordering: I recursively add all columns to a blank data table (just to store the order), placing EDIT: I ran this proposed unit test and got the correct ordering with the column ordering code below DataTable
GetViewOrder(Arena *arena, View *view)
{
switch (view->type)
{
case ViewType::Union:
case ViewType::Select:
{
for (View* v = view->column_first; v; v = v->next)
{
DataTable v_list = GetViewOrder(arena, v);
res.AddAllColumnsWithoutValues(arena, v_list);
}
for (View* v = view->select_first; v; v = v->next)
{
DataTable v_list = GetViewOrder(arena, v);
res.AddAllColumnsWithoutValues(arena, v_list);
}
for (View* v = view->union_first; v; v = v->next)
{
DataTable v_list = GetViewOrder(arena, v);
res.AddAllColumnsWithoutValues(arena, v_list);
}
} break;
case ViewType::Column:
{
DataColumn col = {};
col.name = view->name.str8;
col.value_type = view->data_type;
res.AddColumnWithoutValues(arena, col);
} break;
}
return res;
}
DataTable
GetColumnOrder(Arena *arena, native_fhir::ViewDefinition vd)
{
DataTable res = {};
for (View *view = vd.first; view; view = view->next)
{
DataTable view_order = GetViewOrder(arena, view);
res.AddAllColumnsWithoutValues(arena, view_order);
}
return res;
} |
Hi @awalley-ncqa, I might need a bit more time to digest your code example, but I just wrote you a response in Zulip explaining the semantics of the tests. https://chat.fhir.org/#narrow/stream/179219-analytics-on-FHIR/topic/Column.20Ordering/near/434276053 |
Thanks john for your response on Zulip, that should fix the issues I was facing!
|
The code did not cover the case where a select has a column, select and unionAll.
…rceKey without type specifier" getReferenceKey returns a foreign key for patient p3, not an empty collection.
I think this PR is ready to go, just needs a review. |
I think I am going to merge this now, this branch has lived a good life but if it lives any longer we are going to enter merge hell. |
This change adds a new test that verifies the column ordering logic in the specification, for implementations that support ordering of columns in the result.
It's basically just the example in the specification in test form:
Resolves #225.