wuchong commented on a change in pull request #10224:
[FLINK-14716][table-planner-blink] Cooperate computed column with push down
rules
URL: https://github.com/apache/flink/pull/10224#discussion_r347779068
##########
File path:
flink-table/flink-table-planner-blink/src/test/java/org/apache/flink/table/planner/plan/FlinkCalciteCatalogReaderTest.java
##########
@@ -66,21 +71,32 @@ public void init() {
}
@Test
- public void testGetFlinkTable() {
- FlinkTable flinkTableMock = mock(FlinkTable.class);
-
when(flinkTableMock.getRowType(typeFactory)).thenReturn(mock(RelDataType.class));
- rootSchemaPlus.add(tableMockName, flinkTableMock);
- Prepare.PreparingTable resultTable =
catalogReader.getTable(Arrays.asList(tableMockName));
+ public void testGetFlinkPreparingTableBase() {
+ // Mock CatalogSchemaTable.
+ CatalogSchemaTable mockTable = mock(CatalogSchemaTable.class);
+
when(mockTable.getRowType(typeFactory)).thenReturn(mock(RelDataType.class));
+ when(mockTable.isStreamingMode()).thenReturn(true);
+
when(mockTable.getStatistic()).thenReturn(FlinkStatistic.UNKNOWN());
+ // Mock ConnectorCatalogTable.
+ TableSource mockTableSource = mock(StreamTableSource.class);
+ ConnectorCatalogTable mockConnectorTable =
mock(ConnectorCatalogTable.class);
+
when(mockConnectorTable.getTableSource()).thenReturn(Optional.of(mockTableSource));
+
when(mockConnectorTable.getSchema()).thenReturn(TableSchema.builder().build());
Review comment:
You already mocked every parameter of `CatalogSchemaTable`, why not
construct an instance of it?
Mockito should be avoid because they are costly to maintain in the long
term, see the [Flink Quality
Guide](https://flink.apache.org/contributing/code-style-and-quality-common.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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services