Hello! Thanks for your question.
There are three ways to load a UDF into Xcalar:
Type in the code (as you point out).
Copy your code from an editor into your computer's clipboard, then paste into the UDF.
Click on "Browse File" right above the UDF text editor, find the python source file you want to upload, and select it.
Xcalar UDF execution model:
Xcalar executes many instances of your UDF in parallel across the CPU threads on each node and across all nodes in the cluster. Each instance runs within a process called an XPU, or Xcalar Processing Unit. In the case of Map UDFs, each instance is given a subset of the rows of the table on which to operate. In the case of Import UDFs, each instance is given a file to read and import into Xcalar, which generates some number of rows that contribute to the dataset being created.
It's important to understand that within the UDF, only a portion of the table's records (or dataset's source files) are visible. This isolation allows all the instances to execute in parallel and at maximum performance, because they are each doing a defined portion of the overall work that doesn't depend on the others.
I hope this helps! Please feel free to follow up with any further questions, if you need more clarification.