You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/10/22 12:29:44 UTC

[GitHub] [spark] Kimahriman edited a comment on pull request #34294: [SPARK-37019][SQL] Add codegen support to array transform

Kimahriman edited a comment on pull request #34294:
URL: https://github.com/apache/spark/pull/34294#issuecomment-949585166


   Codegen example for `df.selectExpr("transform(i, (x, i) -> x + i)")`:
   
   ```
   /* 038 */       if (!localtablescan_isNull_0) {
   /* 039 */         final int project_numElements_0 = localtablescan_value_0.numElements();
   /* 040 */
   /* 041 */         ArrayData project_arrayData_0 = ArrayData.allocateArrayData(
   /* 042 */           4, project_numElements_0, " transform failed.");
   /* 043 */
   /* 044 */         for (int project_i_0 = 0; project_i_0 < project_numElements_0; project_i_0++) {
   /* 045 */           int lambda_x_6 = localtablescan_value_0.getInt(project_i_0);
   /* 046 */           boolean lambda_x_6_isNull = localtablescan_value_0.isNullAt(project_i_0);
   /* 047 */           ((java.util.concurrent.atomic.AtomicReference) references[1] /* x_6 */).set(lambda_x_6);
   /* 048 */
   /* 049 */           int lambda_i_7 = project_i_0;
   /* 050 */           ((java.util.concurrent.atomic.AtomicReference) references[2] /* i_7 */).set(lambda_i_7);
   /* 051 */
   /* 052 */           boolean project_isNull_3 = true;
   /* 053 */           int project_value_3 = -1;
   /* 054 */
   /* 055 */           if (!lambda_x_6_isNull) {
   /* 056 */             project_isNull_3 = false; // resultCode could change nullability.
   /* 057 */
   /* 058 */             project_value_3 = lambda_x_6 + lambda_i_7;
   /* 059 */
   /* 060 */           }
   /* 061 */           boolean project_isNull_2 = project_isNull_3;
   /* 062 */           int project_value_2 = project_value_3;
   /* 063 */
   /* 064 */           if (project_isNull_2) {
   /* 065 */             project_arrayData_0.setNullAt(project_i_0);
   /* 066 */           } else {
   /* 067 */             project_arrayData_0.setInt(project_i_0, project_value_2);
   /* 068 */           }
   /* 069 */
   /* 070 */         }
   /* 071 */         project_value_0 = project_arrayData_0;
   /* 072 */
   /* 073 */       }
   ```


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org