@@ -127,7 +127,8 @@ public static void main(String[] args) throws Exception {
127127 confProp = URLDecoder .decode (confProp , Charsets .UTF_8 .toString ());
128128 Properties confProperties = PluginUtil .jsonStrToObject (confProp , Properties .class );
129129 StreamExecutionEnvironment env = getStreamExeEnv (confProperties , deployMode );
130- StreamTableEnvironment tableEnv = getStreamTableEnv (confProperties , env );
130+ StreamTableEnvironment tableEnv = StreamTableEnvironment .getTableEnvironment (env );
131+ StreamQueryConfig queryConfig = getStreamTableEnvTTL (confProperties , tableEnv );
131132
132133 List <URL > jarURList = Lists .newArrayList ();
133134 SqlTree sqlTree = SqlParser .parseSql (sql );
@@ -146,7 +147,7 @@ public static void main(String[] args) throws Exception {
146147 //register table schema
147148 registerTable (sqlTree , env , tableEnv , localSqlPluginPath , remoteSqlPluginPath , pluginLoadMode , sideTableMap , registerTableCache );
148149
149- sqlTranslation (localSqlPluginPath , tableEnv ,sqlTree ,sideTableMap ,registerTableCache );
150+ sqlTranslation (localSqlPluginPath , tableEnv ,sqlTree ,sideTableMap ,registerTableCache , queryConfig );
150151
151152 if (env instanceof MyLocalStreamEnvironment ) {
152153 ((MyLocalStreamEnvironment ) env ).setClasspaths (ClassLoaderManager .getClassPath ());
@@ -155,7 +156,7 @@ public static void main(String[] args) throws Exception {
155156 env .execute (name );
156157 }
157158
158- private static void sqlTranslation (String localSqlPluginPath , StreamTableEnvironment tableEnv ,SqlTree sqlTree ,Map <String , SideTableInfo > sideTableMap ,Map <String , Table > registerTableCache ) throws Exception {
159+ private static void sqlTranslation (String localSqlPluginPath , StreamTableEnvironment tableEnv ,SqlTree sqlTree ,Map <String , SideTableInfo > sideTableMap ,Map <String , Table > registerTableCache , StreamQueryConfig queryConfig ) throws Exception {
159160 SideSqlExec sideSqlExec = new SideSqlExec ();
160161 sideSqlExec .setLocalSqlPluginPath (localSqlPluginPath );
161162 for (CreateTmpTableParser .SqlParserResult result : sqlTree .getTmpSqlList ()) {
@@ -185,9 +186,9 @@ private static void sqlTranslation(String localSqlPluginPath, StreamTableEnviron
185186 }
186187 if (isSide ){
187188 //sql-dimensional table contains the dimension table of execution
188- sideSqlExec .exec (result .getExecSql (), sideTableMap , tableEnv , registerTableCache );
189+ sideSqlExec .exec (result .getExecSql (), sideTableMap , tableEnv , registerTableCache , queryConfig );
189190 }else {
190- FlinkSQLExec .sqlUpdate (tableEnv , result .getExecSql ());
191+ FlinkSQLExec .sqlUpdate (tableEnv , result .getExecSql (), queryConfig );
191192 if (LOG .isInfoEnabled ()){
192193 LOG .info ("exec sql: " + result .getExecSql ());
193194 }
@@ -353,13 +354,11 @@ private static StreamExecutionEnvironment getStreamExeEnv(Properties confPropert
353354 * 获取StreamTableEnvironment并设置相关属性
354355 *
355356 * @param confProperties
356- * @param env
357+ * @param tableEnv
357358 * @return
358359 */
359- private static StreamTableEnvironment getStreamTableEnv (Properties confProperties , StreamExecutionEnvironment env ) {
360+ private static StreamQueryConfig getStreamTableEnvTTL (Properties confProperties , StreamTableEnvironment tableEnv ) {
360361 confProperties = PropertiesUtils .propertiesTrim (confProperties );
361- StreamTableEnvironment tableEnv = StreamTableEnvironment .getTableEnvironment (env );
362- FlinkUtil .setTableEnvTTL (confProperties , tableEnv );
363- return tableEnv ;
362+ return FlinkUtil .getTableEnvTTL (confProperties , tableEnv );
364363 }
365364}
0 commit comments