Add empty table error to join troubleshooting (#4526)

* add empty table error to join troubleshooting

* Apply suggestions from code review

* Update content/flux/v0.x/join-data/troubleshoot-joins.md
pull/4507/head
Scott Anderson 2022-10-05 16:57:13 -06:00 committed by GitHub
parent d2d8710ed2
commit 1fe4a7767e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 0 deletions

View File

@ -88,6 +88,7 @@ group key instances from matching.
- [table is missing column \'\<column\>\'](#table-is-missing-column-column)
- [table is missing label \<label\>](#table-is-missing-label-label)
- [record is missing label \<label\>](#record-is-missing-label-label)
- [cannot join on an empty table](#cannot-join-on-an-empty-table)
### table is missing column `'<column>'`
@ -184,3 +185,31 @@ Ensure the columns that you're using in the `as` output function to assign
values to the output actually exist in the input streams.
{{% /flex-content %}}
{{< /flex >}}
---
### cannot join on an empty table
##### Error message
```js
error preparing <left or right> side of join: cannot join on an empty table
```
{{< flex >}}
{{% flex-content %}}
#### Cause {#cause-e3}
**One of your input streams is an empty stream of tables**.
Functions in the join package error when one or both of the input
streams are empty.
{{% /flex-content %}}
{{% flex-content %}}
#### Solution {#solution-e3}
Use [`array.from()`](/flux/v0.x/stdlib/array/from/) and
[`union()`](/flux/v0.x/stdlib/universe/union/) to insert a dummy table into each
stream that you filter out after the join operation.
The dummy table needs to include all group key columns of the stream it is unioned with.
{{% /flex-content %}}
{{< /flex >}}