You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/11/11 14:48:39 UTC

[GitHub] [doris] BePPPower opened a new pull request, #14213: [feature](table-valued-function) support `hdfs()` tvf

BePPPower opened a new pull request, #14213:
URL: https://github.com/apache/doris/pull/14213

   # Proposed changes
   
   Issue Number: close #13959
   
   This pr does two things:
   1. support `hdfs()` table valued function.
   2. add regression test
   
   ## Problem summary
   
   Just like S3() table valued function, we can use `hdfs()` tvf to read file in hdfs. Like this:
   ```
   MySQL [(none)]> select * from hdfs("uri" = "hdfs://127.0.0.1:842/user/doris/csv_format_test/student.csv", "fs.defaultFS" = "hdfs://127.0.0.1:8424", "hadoop.username" = "xx", "format" = "csv");
   +------+---------+------+
   | c1   | c2      | c3   |
   +------+---------+------+
   | 1    | alice   | 18   |
   | 2    | bob     | 20   |
   | 3    | jack    | 24   |
   | 4    | jackson | 19   |
   | 5    | liming  | 18   |
   | 6    | luffy   | 20   |
   | 7    | zoro    | 22   |
   | 8    | sanzi   | 26   |
   | 9    | wusuopu | 21   |
   | 10   | nami    | 18   |
   +------+---------+------+
   
   // Also support desc function hdfs()
   MySQL [(none)]> desc function hdfs("uri" = "hdfs://127.0.0.1:8424/user/doris/csv_format_test/student_with_names.csv", "fs.defaultFS" = "hdfs://127.0.0.1:8424", "hadoop.username" = "xx", "format" = "csv_with_names");
   +-------+------+------+-------+---------+-------+
   | Field | Type | Null | Key   | Default | Extra |
   +-------+------+------+-------+---------+-------+
   | id    | TEXT | Yes  | false | NULL    | NONE  |
   | name  | TEXT | Yes  | false | NULL    | NONE  |
   | age   | TEXT | Yes  | false | NULL    | NONE  |
   +-------+------+------+-------+---------+-------+
   ```
   
   And `hdfs()` is also support `csv/csv_with_names/csv_with_names_and_types/json/parquet/orc` file format.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [x] Yes
       - [ ] No
       - [ ] I don't know
   3. Has unit tests been added:
       - [ ] Yes
       - [x] No
       - [ ] No Need
   4. Has document been added or modified:
       - [ ] Yes
       - [x] No
       - [ ] No Need
   5. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   6. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on pull request #14213: [feature](table-valued-function) support `hdfs()` tvf

Posted by GitBox <gi...@apache.org>.
morningman commented on PR #14213:
URL: https://github.com/apache/doris/pull/14213#issuecomment-1311822886

   You need to add all new csv file to `.licenserc.yaml`, to pass the license check


-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #14213: [feature](table-valued-function) support `hdfs()` tvf

Posted by GitBox <gi...@apache.org>.
morningman commented on code in PR #14213:
URL: https://github.com/apache/doris/pull/14213#discussion_r1020324233


##########
fe/fe-core/src/main/java/org/apache/doris/tablefunction/HdfsTableValuedFunction.java:
##########
@@ -0,0 +1,128 @@
+// 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.doris.tablefunction;
+
+import org.apache.doris.analysis.BrokerDesc;
+import org.apache.doris.analysis.ExportStmt;
+import org.apache.doris.analysis.StorageBackend.StorageType;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.util.URI;
+import org.apache.doris.thrift.TFileType;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import org.apache.commons.collections.map.CaseInsensitiveMap;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+import java.util.Map;
+
+/**
+ * The Implement of table valued function
+ * hdfs("uri" = "xxx", "hadoop.username" = "xx", "FORMAT" = "csv").
+ */
+public class HdfsTableValuedFunction extends ExternalFileTableValuedFunction {
+    public static final Logger LOG = LogManager.getLogger(HdfsTableValuedFunction.class);
+
+    public static final String NAME = "hdfs";
+    public static final String HDFS_URI = "uri";
+    public static String HADOOP_FS_NAME = "fs.defaultFS";
+    // simple or kerberos
+    public static String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
+    public static String HADOOP_USER_NAME = "hadoop.username";
+    public static String HADOOP_KERBEROS_PRINCIPAL = "hadoop.kerberos.principal";
+    public static String HADOOP_KERBEROS_KEYTAB = "hadoop.kerberos.keytab";
+    public static String HADOOP_SHORT_CIRCUIT = "dfs.client.read.shortcircuit";
+    public static String HADOOP_SOCKET_PATH = "dfs.domain.socket.path";
+
+    private static final ImmutableSet<String> FILE_FORMAT_PROPERTIES = new ImmutableSet.Builder<String>()

Review Comment:
   `FILE_FORMAT_PROPERTIES` should be a common property for both HDFS and S3 table?
   So how about move it to the parent class?



-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] BePPPower commented on a diff in pull request #14213: [feature](table-valued-function) support `hdfs()` tvf

Posted by GitBox <gi...@apache.org>.
BePPPower commented on code in PR #14213:
URL: https://github.com/apache/doris/pull/14213#discussion_r1023769850


##########
fe/fe-core/src/main/java/org/apache/doris/tablefunction/HdfsTableValuedFunction.java:
##########
@@ -0,0 +1,128 @@
+// 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.doris.tablefunction;
+
+import org.apache.doris.analysis.BrokerDesc;
+import org.apache.doris.analysis.ExportStmt;
+import org.apache.doris.analysis.StorageBackend.StorageType;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.util.URI;
+import org.apache.doris.thrift.TFileType;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import org.apache.commons.collections.map.CaseInsensitiveMap;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+import java.util.Map;
+
+/**
+ * The Implement of table valued function
+ * hdfs("uri" = "xxx", "hadoop.username" = "xx", "FORMAT" = "csv").
+ */
+public class HdfsTableValuedFunction extends ExternalFileTableValuedFunction {
+    public static final Logger LOG = LogManager.getLogger(HdfsTableValuedFunction.class);
+
+    public static final String NAME = "hdfs";
+    public static final String HDFS_URI = "uri";
+    public static String HADOOP_FS_NAME = "fs.defaultFS";
+    // simple or kerberos
+    public static String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
+    public static String HADOOP_USER_NAME = "hadoop.username";
+    public static String HADOOP_KERBEROS_PRINCIPAL = "hadoop.kerberos.principal";
+    public static String HADOOP_KERBEROS_KEYTAB = "hadoop.kerberos.keytab";
+    public static String HADOOP_SHORT_CIRCUIT = "dfs.client.read.shortcircuit";
+    public static String HADOOP_SOCKET_PATH = "dfs.domain.socket.path";
+
+    private static final ImmutableSet<String> FILE_FORMAT_PROPERTIES = new ImmutableSet.Builder<String>()

Review Comment:
   you are right.



-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] hello-stephen commented on pull request #14213: [feature](table-valued-function) support `hdfs()` tvf

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #14213:
URL: https://github.com/apache/doris/pull/14213#issuecomment-1311874523

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 36.04 seconds
    load time: 441 seconds
    storage size: 17183690818 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221111155335_clickbench_pr_44572.html


-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman merged pull request #14213: [feature](table-valued-function) support `hdfs()` tvf

Posted by GitBox <gi...@apache.org>.
morningman merged PR #14213:
URL: https://github.com/apache/doris/pull/14213


-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org