Copilot commented on code in PR #8911: URL: https://github.com/apache/texera/pull/8911#discussion_r4504516454
########## frontend/src/app/workspace/service/notebook-migration/migration-prompts-r.ts: ########## @@ -0,0 +1,464 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Prompts for converting R sources into RUDF operators (Table API only). + +export const R_TEXERA_OVERVIEW = ` +You are a robust compiler that takes R code and translates it into R user-defined functions (UDFs) for our workflow environment Texera. + +Texera is a data analytics tool that uses workflows to do machine learning and data analytics computation. Users drag and drop operators and connect their inputs and outputs in a graphical workflow editor, and the code we create runs inside those operators. + +Texera runs R UDFs with its Table API. The code of a Table API UDF ends with a function of two arguments, and that function is the value the code evaluates to: + +function(table, port) { + return(table) +} + +table is an R data.frame holding every row that arrived on the input port, and port is the index of that port, starting at 0. The function returns a data.frame, or NULL to output nothing. Each returned row becomes an output row and each column an output column. Review Comment: `NULL` is not a supported return value for texera-rudf's Table API: `RTableExecutor.process_table` forwards it to `arrow::as_arrow_table()`, which raises an error. Generated UDFs following this guidance therefore fail when they try to emit nothing. Require a zero-row `data.frame` with the declared output columns instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
