Skip to content

How to make sure data from two ports have finished loading? #8683

Description

@hhvu0102

Feature Summary

Opening a new thread since I can't reopen the old discussion here #4074

My question is: how can I write a function in a 2-port UDF to access input data at the same time?

For example, if data from port 0 is df0, and data from port 1 is df1, how should I design my code so a function f(df0, df1) could be executed properly?

Attached here is an example in my use case, where port 0 is a df of 19.5k lines and ~200 columns (say df0, while data from port 1 is smaller with 63 lines (say df1). AI bot suggested that we put a parameter with a fix number of lines matching with n lines in df0 to check if df0 has finished loading, which in general cases would not work.

This is other things I have tried (in pseudocode):

  1. Attempt 1:
if port == 0:
df0 <- df0
else if port == 1:
df1 <- df1

#a function that does something with both df0 and df1
function_to_called(df0, df1)

This will not work because df1 will finish loading before df0, and function_to_called will throw an error that df0 is not found.
2) Attempt 2:
Same logic as above, but I forced port 1 data to depend on port 0 so port 0 finishes first (as recommended in #4074). Now function_to_called will throw an error that df1 is not found, because it's called before df1 is loaded.

The attached screenshot is in R, but the question stands the same for Python-based UDF.

Image

Proposed Solution or Design

I expect a way to check if data has finished loading.

Affected Area

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions