apilloud commented on a change in pull request #15486:
URL: https://github.com/apache/beam/pull/15486#discussion_r706525088



##########
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
##########
@@ -207,20 +204,28 @@ public Calc copy(RelTraitSet traitSet, RelNode input, 
RexProgram program) {
     private final Schema outputSchema;
     private final boolean verifyRowValues;
     private final List<String> jarPaths;
+
+    @FieldAccess("row")
+    private final FieldAccessDescriptor fieldAccess;
+
     private transient @Nullable ScriptEvaluator se = null;
 
     public CalcFn(
         String processElementBlock,
         Schema outputSchema,
         boolean verifyRowValues,
-        List<String> jarPaths) {
+        List<String> jarPaths,
+        FieldAccessDescriptor fieldAccess) {
       this.processElementBlock = processElementBlock;
       this.outputSchema = outputSchema;
       this.verifyRowValues = verifyRowValues;
       this.jarPaths = jarPaths;
+      this.fieldAccess = fieldAccess;
+
+      compile(processElementBlock, jarPaths);

Review comment:
       Done.

##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/BeamZetaSqlCalcRel.java
##########
@@ -190,10 +193,22 @@ private static TimestampedFuture create(Instant t, 
Future<Value> f) {
       this.outputSchema = outputSchema;
       this.defaultTimezone = defaultTimezone;
       this.verifyRowValues = verifyRowValues;
+
+      PreparedExpression exp = prepareExpression(sql, nullParams, inputSchema, 
defaultTimezone);
+
+      ImmutableList.Builder<Integer> columns = new ImmutableList.Builder<>();
+      for (String c : exp.getReferencedColumns()) {
+        columns.add(Integer.parseInt(c.substring(1)));
+      }
+      this.referencedColumns = columns.build();
+      this.fieldAccess = 
FieldAccessDescriptor.withFieldIds(this.referencedColumns);
+
+      exp.close();

Review comment:
       Done.




-- 
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]


Reply via email to