zyratlo commented on code in PR #8911: URL: https://github.com/apache/texera/pull/8911#discussion_r4515420330
########## 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: Fixed in [bb16e15](https://github.com/apache/texera/pull/8911/commits/bb16e15e28421e38cc5868568f228c677d65a443). NULL does fail in texera-rudf, but a zero-row data.frame also fails when its columns are character or binary: the pandas round trip gives the empty column Arrow's null type, which the schema cannot map. Those are the only column types the R UDFs return, so the prompt now asks for at least one row, with a row that says so when there is nothing to report. -- 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]
