gianm commented on code in PR #5349:
URL: https://github.com/apache/calcite/pull/5349#discussion_r4406900283


##########
core/src/main/java/org/apache/calcite/sql/SqlPipeOperator.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.calcite.sql;
+
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.validate.SqlConformance;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Base class for parse tree nodes that represent operators in SQL pipe
+ * syntax; for example, {@code FROM emp |> WHERE deptno = 10}.
+ *
+ * <p>A pipe operator stays in the parse tree through validation. It is

Review Comment:
   I moved it to `SqlPipeQuery#surrogateSelect` and reworded it:
   
   ```
     /**
      * Creates the surrogate SELECT of this query: a {@code SELECT} that stands
      * in for the query while it is validated and converted.
      *
      * <p>For example, {@code FROM emp |> WHERE c} is a {@link SqlPipeWhere}
      * whose input is the {@link SqlFromQuery} {@code FROM emp}. The surrogate 
of
      * {@code FROM emp} is {@code SELECT * FROM emp}, and the surrogate of the
      * {@link SqlPipeWhere} is {@code SELECT * FROM input WHERE c}.
      *
      * <p>The query itself stays in the parse tree, so that the validator can
      * apply the rules of pipe syntax that differ from plain {@code SELECT},
      * such as which table aliases remain visible and when sort order is kept.
      */
     public abstract SqlSelect surrogateSelect();
   ```



##########
core/src/main/java/org/apache/calcite/sql/SqlPipeOperator.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.calcite.sql;
+
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.validate.SqlConformance;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Base class for parse tree nodes that represent operators in SQL pipe
+ * syntax; for example, {@code FROM emp |> WHERE deptno = 10}.
+ *
+ * <p>A pipe operator stays in the parse tree through validation. It is
+ * validated and converted as its {@link #surrogateSelect}, which reads the
+ * operator's input through a {@link SqlPipeInput}. For example, the
+ * surrogate of {@code |> WHERE c} is {@code SELECT * FROM input WHERE c}.
+ *
+ * @see SqlConformance#isPipeSyntaxAllowed()
+ * @see SqlKind#PIPE_OPERATOR
+ */
+public abstract class SqlPipeOperator extends SqlPipeQuery {
+  /** The {@code |>} token, with which each operator's name starts. */

Review Comment:
   Removed it.



##########
core/src/main/java/org/apache/calcite/sql/SqlPipeOperator.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.calcite.sql;
+
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.validate.SqlConformance;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Base class for parse tree nodes that represent operators in SQL pipe
+ * syntax; for example, {@code FROM emp |> WHERE deptno = 10}.
+ *
+ * <p>A pipe operator stays in the parse tree through validation. It is
+ * validated and converted as its {@link #surrogateSelect}, which reads the
+ * operator's input through a {@link SqlPipeInput}. For example, the
+ * surrogate of {@code |> WHERE c} is {@code SELECT * FROM input WHERE c}.
+ *
+ * @see SqlConformance#isPipeSyntaxAllowed()
+ * @see SqlKind#PIPE_OPERATOR
+ */
+public abstract class SqlPipeOperator extends SqlPipeQuery {
+  /** The {@code |>} token, with which each operator's name starts. */
+  public static final String PIPE = "|>";
+
+  protected SqlNode query;
+
+  //~ Constructors -----------------------------------------------------------
+
+  protected SqlPipeOperator(SqlParserPos pos, SqlNode query) {
+    super(pos);
+    this.query = requireNonNull(query, "query");
+  }
+
+  //~ Methods ----------------------------------------------------------------
+
+  /** Creates a {@code SELECT} for {@link #surrogateSelect} to return, which

Review Comment:
   Reworded it in such a way that it's not using either the phrase "to return" 
or `@returns`. Hopefully it's clear in this form.



##########
core/src/main/java/org/apache/calcite/sql/SqlPipeOperator.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.calcite.sql;
+
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.validate.SqlConformance;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Base class for parse tree nodes that represent operators in SQL pipe
+ * syntax; for example, {@code FROM emp |> WHERE deptno = 10}.
+ *
+ * <p>A pipe operator stays in the parse tree through validation. It is
+ * validated and converted as its {@link #surrogateSelect}, which reads the
+ * operator's input through a {@link SqlPipeInput}. For example, the
+ * surrogate of {@code |> WHERE c} is {@code SELECT * FROM input WHERE c}.
+ *
+ * @see SqlConformance#isPipeSyntaxAllowed()
+ * @see SqlKind#PIPE_OPERATOR
+ */
+public abstract class SqlPipeOperator extends SqlPipeQuery {
+  /** The {@code |>} token, with which each operator's name starts. */
+  public static final String PIPE = "|>";
+
+  protected SqlNode query;
+
+  //~ Constructors -----------------------------------------------------------
+
+  protected SqlPipeOperator(SqlParserPos pos, SqlNode query) {
+    super(pos);
+    this.query = requireNonNull(query, "query");
+  }
+
+  //~ Methods ----------------------------------------------------------------
+
+  /** Creates a {@code SELECT} for {@link #surrogateSelect} to return, which
+   * reads this operator's input through a {@link SqlPipeInput}. */
+  protected SqlSelect surrogate(@Nullable SqlNodeList keywordList,
+      SqlNodeList selectList) {
+    return surrogate(keywordList, selectList, SqlPipeInput.of(this));
+  }
+
+  /** Returns the query that this pipe operator applies to. */
+  public SqlNode getQuery() {
+    return query;
+  }
+
+  @Override public void setOperand(int i, @Nullable SqlNode operand) {
+    if (i == 0) {
+      query = requireNonNull(operand, "operand");

Review Comment:
   changed it.



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