twalthr commented on a change in pull request #9359: [FLINK-13441][e2e] Add e2e 
test for sql batch job
URL: https://github.com/apache/flink/pull/9359#discussion_r310971977
 
 

 ##########
 File path: 
flink-end-to-end-tests/flink-batch-sql-test/src/main/java/org/apache/flink/sql/tests/BatchSQLTestProgram.java
 ##########
 @@ -0,0 +1,178 @@
+/*
+ * 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.sql.tests;
+
+import org.apache.flink.api.common.io.InputFormat;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.api.java.io.IteratorInputFormat;
+import org.apache.flink.api.java.utils.ParameterTool;
+import org.apache.flink.table.api.EnvironmentSettings;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.sinks.CsvTableSink;
+import org.apache.flink.table.sources.DefinedFieldMapping;
+import org.apache.flink.table.sources.DefinedRowtimeAttributes;
+import org.apache.flink.table.sources.InputFormatTableSource;
+import org.apache.flink.table.sources.RowtimeAttributeDescriptor;
+import org.apache.flink.table.sources.tsextractors.ExistingField;
+import org.apache.flink.table.sources.wmstrategies.BoundedOutOfOrderTimestamps;
+import org.apache.flink.types.Row;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+/**
+ * End-to-end test for batch SQL queries.
+ *
+ * <p>The sources are generated and bounded.
+ * The result is always constant.
+ *
+ * <p>Parameters:
+ * -outputPath output file path for CsvTableSink;
+ * -sqlStatement SQL statement that will be executed as sqlUpdate
+ */
+public class BatchSQLTestProgram {
+
+       public static void main(String[] args) throws Exception {
+               ParameterTool params = ParameterTool.fromArgs(args);
+               String outputPath = params.getRequired("outputPath");
+               String sqlStatement = params.getRequired("sqlStatement");
+
+               TableEnvironment tEnv = 
TableEnvironment.create(EnvironmentSettings.newInstance()
+                       .useBlinkPlanner()
+                       .inBatchMode()
+                       .build());
+
+               tEnv.registerTableSource("table1", new GeneratorTableSource(10, 
100, 60, 0));
+               tEnv.registerTableSource("table2", new GeneratorTableSource(5, 
0.2f, 60, 5));
+               tEnv.registerTableSink("sinkTable",
+                       new CsvTableSink(outputPath)
 
 Review comment:
   Can you use the descriptor-based approach or even better the DDL instead? 
Both the `.configure()` and `Types` is deprecated.

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