ibzib commented on a change in pull request #16911: URL: https://github.com/apache/beam/pull/16911#discussion_r812549495
########## File path: sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/AnalyticScanConverter.java ########## @@ -0,0 +1,35 @@ +/* + * 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.zetasql.translation; + +import com.google.zetasql.resolvedast.ResolvedNodes.ResolvedAnalyticScan; +import org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode; + +import java.util.List; + +public class AnalyticScanConverter extends RelConverter<ResolvedAnalyticScan> { Review comment: We use AggregateScanConverter to convert ZetaSql's ResolvedAggregateScan to Calcite's LogicalAggregate. Similarly, we need AnalyticScanConverter to transform ResolvedAnalyticScan to a RelNode. I believe LogicalWindow is the type of output RelNode we want. Because the input and output types are presumably different, I don't think it will be possible to reuse AggregateScanConverter directly. I'll admit I'm a bit confused by the TODO in AggregateScanConverter (mentioned in the JIRA). https://github.com/apache/beam/blob/43cd356f865fa52bcce217c613e747a9220136e0/sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/AggregateScanConverter.java#L149 Since analytic scans are a separate class, I'm not sure how AggregateScanConverter would handle them. Andrew probably knows more, but he's still on leave for a couple more weeks. However, I do think we can reuse at least some of the logic in AggregateScanConverter. https://github.com/apache/beam/blob/43cd356f865fa52bcce217c613e747a9220136e0/sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/AggregateScanConverter.java#L123-L127 It looks like the input of ResolvedAnalyticScan is also a scan rather than a project, so we will probably have to do something similar in AnalyticScanConverter. Perhaps since ResolvedAnalyticScan and ResolvedAggregateScan share the ResolvedScan parent class, we can make `convertAggregateScanInputScanToLogicalProject` more generic, and share it for both cases. -- 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]
