[ 
https://issues.apache.org/jira/browse/BEAM-4167?focusedWorklogId=104911&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-104911
 ]

ASF GitHub Bot logged work on BEAM-4167:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/May/18 00:46
            Start Date: 23/May/18 00:46
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on a change in pull request 
#5428: [BEAM-4167] Implement UNNEST
URL: https://github.com/apache/beam/pull/5428#discussion_r190095082
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/interpreter/operator/BeamSqlCorrelVariableExpression.java
 ##########
 @@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package org.apache.beam.sdk.extensions.sql.impl.interpreter.operator;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.values.Row;
+import org.apache.calcite.sql.type.SqlTypeName;
+
+/** A primitive operation for deferencing a correlation variable. */
+public class BeamSqlCorrelVariableExpression extends BeamSqlExpression {
+
+  private final int correlationId;
+
+  public BeamSqlCorrelVariableExpression(SqlTypeName sqlTypeName, int 
correlationId) {
+    super(null, sqlTypeName);
+    this.correlationId = correlationId;
+  }
+
+  @Override
+  public boolean accept() {
+    return true;
+  }
+
+  @Override
+  public BeamSqlPrimitive evaluate(
+      Row inputRow, BoundedWindow window, ImmutableMap<Integer, Object> 
correlateEnv) {
 
 Review comment:
   Oh, I think that the correlation expression - this class - will work in 
general. It can be nested arbitrarily AFAIK. The place where that support is 
missing is at the `Rel` level. If we had a general `BeamCorrelateRel` then it 
would have to add its var to the environment just like the `BeamUnnestRel` 
does. And to be general, all of the `Rel` bits would also need to also know 
about the environment and do something clever. I'm not sure that would be the 
overall solution - likely we want to successfully use Calcite's decorrelate. It 
did not seem to actually decorrelate this particular query, though I might have 
just been using it wrong.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 104911)
    Time Spent: 2h 20m  (was: 2h 10m)

> Implement UNNEST
> ----------------
>
>                 Key: BEAM-4167
>                 URL: https://issues.apache.org/jira/browse/BEAM-4167
>             Project: Beam
>          Issue Type: New Feature
>          Components: dsl-sql
>            Reporter: Anton Kedin
>            Assignee: Kenneth Knowles
>            Priority: Major
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> We need to be able to convert collections to relations in the query to 
> perform any meaningful operations on them. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to