Zhumengze commented on code in PR #512: URL: https://github.com/apache/doris-flink-connector/pull/512#discussion_r1845935751
########## flink-doris-connector/src/test/java/org/apache/doris/flink/lookup/DorisLookupTableITCase.java: ########## @@ -0,0 +1,89 @@ +package org.apache.doris.flink.lookup; + +import org.apache.doris.flink.container.AbstractITCaseService; +import org.apache.doris.flink.container.ContainerUtils; +import org.apache.doris.flink.source.DorisSourceITCase; +import org.apache.doris.flink.table.DorisConfigOptions; +import org.apache.flink.api.common.RuntimeExecutionMode; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.apache.flink.table.api.bridge.java.StreamTableEnvironment; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DorisLookupTableITCase extends AbstractITCaseService { + + private static final Logger LOG = LoggerFactory.getLogger(DorisSourceITCase.class); + private static final String DATABASE = "test_lookup"; + private static final String TABLE_READ_TBL = "tbl_read_tbl"; + + @Test + public void testLookupTable() throws Exception { + initializeTable(TABLE_READ_TBL); + final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); + env.setParallelism(DEFAULT_PARALLELISM); + env.setRuntimeMode(RuntimeExecutionMode.STREAMING); + final StreamTableEnvironment tEnv = StreamTableEnvironment.create(env); + String datagenDDL = "CREATE TABLE datagen (" + + " `id` INT," + + " `proctime` AS PROCTIME()" + + ") WITH (" + + " 'connector' = 'datagen'," + + " 'rows-per-second' = '1'," + + " 'fields.id.kind' = 'random'," + + " 'fields.id.min' = '1'," + + " 'fields.id.max' = '10'" + + ")"; + tEnv.executeSql(datagenDDL); + String lookupDDL = String.format("CREATE TABLE `doris_lookup`(" + + " `id` INTEGER," + + " `tinyintColumn` TINYINT," + + " `smallintColumn` SMALLINT," + + " `bigintColumn` BIGINT," + + " PRIMARY KEY (`id`) NOT ENFORCED" + + ") WITH (" + + "'connector' = '" + DorisConfigOptions.IDENTIFIER + "'," + + "'fenodes' = '%s'," + + "'jdbc-url' = '%s'," + + "'table.identifier' = '%s'," + + "'username' = '%s'," + + "'password' = '%s'," + + "'lookup.cache.max-rows' = '100'" + + ")", + getFenodes(), + getDorisQueryUrl(), + DATABASE + "." + TABLE_READ_TBL, + getDorisUsername(), + getDorisPassword()); + tEnv.executeSql(lookupDDL); + tEnv.executeSql("select datagen.id," + + "tinyintColumn," + + "smallintColumn," + + "bigintColumn" + + " from `datagen`" + + " inner join `doris_lookup` FOR SYSTEM_TIME AS OF datagen.proctime on datagen.id = doris_lookup.id").print(); + env.execute("Flink doris lookup test"); Review Comment: Ok, I'll change it later -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org