You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by GitBox <gi...@apache.org> on 2019/07/26 10:38:12 UTC

[GitHub] [kylin] hit-lacus commented on a change in pull request #747: KYLIN-3832 Query pushdown support postgresql

hit-lacus commented on a change in pull request #747: KYLIN-3832 Query pushdown support postgresql
URL: https://github.com/apache/kylin/pull/747#discussion_r307687447
 
 

 ##########
 File path: datasource-sdk/src/main/java/org/apache/kylin/sdk/datasource/adaptor/PostgresqlAdaptor.java
 ##########
 @@ -0,0 +1,100 @@
+/*
+ * 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.kylin.sdk.datasource.adaptor;
+
+import javax.sql.rowset.CachedRowSet;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.ArrayList;
+
+
+public class PostgresqlAdaptor extends DefaultAdaptor {
+    public PostgresqlAdaptor(AdaptorConfig config) throws Exception {
+        super(config);
+    }
+
+    @Override
+    public List<String> listDatabases() throws SQLException {
+        List<String> ret = new ArrayList<>();
+        try (Connection con = getConnection()) {
+            ret.add(con.getCatalog());
+        }
+        return ret;
+    }
+
+    @Override
+    public List<String> listTables(String catalog) throws SQLException {
 
 Review comment:
   Better add following code to filter **INDEX**, **SYSTEM TABLE**
   ```java
   if(tableType.equalsIgnoreCase("TABLE"))
       ret.add(table);
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services