You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/02/06 10:05:08 UTC

[GitHub] [incubator-seatunnel] TyrantLucifer commented on a change in pull request #1188: [SeaTunnel#1142] Translate spark apis from scala to java

TyrantLucifer commented on a change in pull request #1188:
URL: https://github.com/apache/incubator-seatunnel/pull/1188#discussion_r800156258



##########
File path: seatunnel-apis/seatunnel-api-spark/src/main/java/org/apache/seatunnel/spark/batch/SparkBatchExecution.java
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.seatunnel.spark.batch;
+
+import org.apache.seatunnel.common.config.CheckResult;
+import org.apache.seatunnel.common.config.ConfigRuntimeException;
+import org.apache.seatunnel.env.Execution;
+import org.apache.seatunnel.spark.BaseSparkSink;
+import org.apache.seatunnel.spark.BaseSparkSource;
+import org.apache.seatunnel.spark.BaseSparkTransform;
+import org.apache.seatunnel.spark.SparkEnvironment;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+import org.apache.seatunnel.shade.com.typesafe.config.ConfigFactory;
+
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+
+import java.util.List;
+
+public class SparkBatchExecution implements Execution<SparkBatchSource, BaseSparkTransform, SparkBatchSink> {
+
+    public static final String SOURCE_TABLE_NAME = "source_table_name";
+    public static final String RESULT_TABLE_NAME = "result_table_name";
+
+    public static void registerTempView(String tableName, Dataset<Row> ds) {

Review comment:
       In the Scala version, these variables and methods are accessible to classes in the same parent package. If change them to private in Java, other classes will not be able to access them, which is why I chose to change them to public
   
   ![image](https://user-images.githubusercontent.com/51053924/152675800-9f7a4d9f-c742-4e1f-bb9e-7ac7e4d0f6d8.png)
   ![image](https://user-images.githubusercontent.com/51053924/152675938-01dec223-e66f-4b22-9976-5b0809563f9e.png)
   
   




-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org