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/08/13 15:10:16 UTC

[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #2399: [Feature][Connector-V2] Add base source connector code for connector-file-base

TyrantLucifer commented on code in PR #2399:
URL: https://github.com/apache/incubator-seatunnel/pull/2399#discussion_r945158520


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.connectors.seatunnel.file.source.reader;
+
+import org.apache.seatunnel.connectors.seatunnel.file.config.HadoopConf;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FilePluginException;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+public abstract class AbstractReadStrategy implements ReadStrategy {
+    HadoopConf hadoopConf;
+
+    @Override
+    public void init(HadoopConf conf) {
+        this.hadoopConf = conf;
+    }
+
+    @Override
+    public Configuration getConfiguration(HadoopConf hadoopConf) {

Review Comment:
   > I guess the `S3 File Source` and `OSS File Source` will extend this class too. Does the `Configuration` can use for read `S3 File` and `OSS File`?
   
   As the current orc and parquet are based on hadoop system products, the official api only provides a read interface based on hadoop file system, if we want to interface with oss or s3, currently only supports reading text files, as far as I know, oss and s3 can also support the hdfs protocol file interface, so I think this method will be used in the future.
   
   For the moment, if you want to read orc or parquet files on top of oss or s3, I can think of two options.
   1. download the oss or s3 file locally and read it through the local interface, which is not an elegant solution, but a fast and effective one
   2. encapsulate the file stream returned by s3 or oss based on the api of parquet or orc, and disguise it as a hadoop file, which is more elegant, but needs time for research and verification



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