godfreyhe commented on a change in pull request #12221:
URL: https://github.com/apache/flink/pull/12221#discussion_r426996670



##########
File path: 
flink-connectors/flink-connector-hbase/src/test/java/org/apache/flink/connector/hbase/HBaseTablePlanTest.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.connector.hbase;
+
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.planner.utils.StreamTableTestUtil;
+import org.apache.flink.table.planner.utils.TableTestBase;
+
+import org.junit.Test;
+
+/**
+ * Plan tests for HBase connector, for example, testing projection push down.
+ */
+public class HBaseTablePlanTest extends TableTestBase {
+
+       private final StreamTableTestUtil util = streamTestUtil(new 
TableConfig());
+
+       @Test
+       public void testProjectionPushDown() {

Review comment:
       also add some tests for `validatePrimaryKey` case ?

##########
File path: 
flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcLookupTableITCase.java
##########
@@ -146,13 +150,17 @@ public void clearOutputTable() throws Exception {
        public void test() throws Exception {

Review comment:
       give a more meaningful name here ?

##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TableSchemaUtils.java
##########
@@ -61,6 +63,23 @@ public static TableSchema getPhysicalSchema(TableSchema 
tableSchema) {
                return builder.build();
        }
 
+       /**
+        * Creates a new {@link TableSchema} with the projected fields from 
another {@link TableSchema}.
+        *
+        * @see 
org.apache.flink.table.connector.source.abilities.SupportsProjectionPushDown
+        */
+       public static TableSchema projectSchema(TableSchema tableSchema, 
int[][] projectedFields) {

Review comment:
       please add some test for this method

##########
File path: 
flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcLookupTableITCase.java
##########
@@ -46,24 +46,28 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import static 
org.apache.flink.connector.jdbc.JdbcTestFixture.DERBY_EBOOKSHOP_DB;
 import static org.apache.flink.table.api.Expressions.$;
+import static org.junit.Assert.assertEquals;
 
 /**
- * IT case for {@link JdbcLookupFunction}.
+ * IT case for lookup source of JDBC connector.
  */
 @RunWith(Parameterized.class)
-public class JdbcLookupFunctionITCase extends AbstractTestBase {
+public class JdbcLookupTableITCase extends AbstractTestBase {

Review comment:
       add some cases for projection

##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSource.java
##########
@@ -126,9 +128,20 @@ public ChangelogMode getChangelogMode() {
                return ChangelogMode.insertOnly();
        }
 
+       @Override
+       public boolean supportsNestedProjection() {
+               // JDBC doesn't support nested projection
+               return false;
+       }
+
+       @Override
+       public void applyProjection(int[][] projectedFields) {
+               this.physicalSchema = 
TableSchemaUtils.projectSchema(physicalSchema, projectedFields);

Review comment:
       `selectFields` need to be updated ?




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


Reply via email to