twalthr commented on a change in pull request #8764:  
[FLINK-12798][table-planner][table-api-java] Port TableEnvironment to 
table-api-java module
URL: https://github.com/apache/flink/pull/8764#discussion_r296152072
 
 

 ##########
 File path: 
flink-table/flink-table-api-scala-bridge/src/main/java/org/apache/flink/table/operations/scala/DataStreamQueryOperation.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.flink.table.operations.scala;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.operations.Operation;
+import org.apache.flink.table.operations.OperationUtils;
+import org.apache.flink.table.operations.QueryOperation;
+import org.apache.flink.table.operations.QueryOperationVisitor;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Describes a relational operation that reads from a {@link DataStream}.
+ *
+ * <p>This operation may expose only part, or change the order of the fields 
available in a
+ * {@link org.apache.flink.api.common.typeutils.CompositeType} of the 
underlying {@link DataStream}.
+ * The {@link DataStreamQueryOperation#getFieldIndices()} describes the 
mapping between fields of the
+ * {@link TableSchema} to the {@link 
org.apache.flink.api.common.typeutils.CompositeType}.
+ */
+@Internal
+public class DataStreamQueryOperation<E> implements QueryOperation {
+
+       private final DataStream<E> dataStream;
+       private final int[] fieldIndices;
+       private final TableSchema tableSchema;
+
+       public DataStreamQueryOperation(
+                       DataStream<E> dataStream,
+                       int[] fieldIndices,
+                       TableSchema tableSchema) {
+               this.dataStream = dataStream;
+               this.tableSchema = tableSchema;
+               this.fieldIndices = fieldIndices;
+       }
+
+       public DataStream<E> getDataStream() {
+               return dataStream;
+       }
+
+       public int[] getFieldIndices() {
+               return fieldIndices;
+       }
+
+       @Override
+       public TableSchema getTableSchema() {
+               return tableSchema;
+       }
+
+       @Override
+       public String asSummaryString() {
+               Map<String, Object> args = new LinkedHashMap<>();
+               args.put("id", dataStream.getId());
+               args.put("fields", tableSchema.getFieldNames());
+
+               return OperationUtils.formatWithChildren("DataStream", args, 
getChildren(), Operation::asSummaryString);
 
 Review comment:
   nit: break line

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to