test_class.file: plink-sql/plink-sql-core/src/test/java/com/github/hairless/plink/sql/SqlDebugDriverTest.java
test_class.identifier: SqlDebugDriverTest
test_case.body: @Test
      public void debugWatermark() throws Exception {
          String sql = "create table t1( " +
                  "data_time STRING ," +
                  "row1_time AS to_timestamp(data_time)," +
                  "WATERMARK FOR row1_time AS row1_time - INTERVAL '5' SECOND " +
                  ") with ( 'connector' = 'collection','data'='[]');" +
                  "create table t2(stime TIMESTAMP(3),cnt bigint) with ( 'connector' = 'print');" +
                  "insert into t2 select TUMBLE_START(row1_time, INTERVAL '1' MINUTE) as stime,count(1) cnt from t1 group by TUMBLE(row1_time, INTERVAL '1' MINUTE);";
          List<String> sourceData = Stream.of(
                  new JSONObject().fluentPut("data_time", "2020-01-01 12:00:01").toJSONString(),
                  new JSONObject().fluentPut("data_time", "2020-01-01 12:00:02").toJSONString(),
                  new JSONObject().fluentPut("data_time", "2020-01-01 12:00:03").toJSONString(),
                  new JSONObject().fluentPut("data_time", "2020-01-01 12:01:01").toJSONString()
          ).collect(Collectors.toList());
          SqlDebugConfig sqlDebugConfig = new SqlDebugConfig();
          HashMap<String, SqlDebugConfig.SourceConfig> sourceConfigMap = new HashMap<>();
          sourceConfigMap.put("t1", new SqlDebugConfig.SourceConfig(sourceData));
          sqlDebugConfig.setSourceConfigMap(sourceConfigMap);
          sqlDebugConfig.setSql(sql);
          log.info("sqlDebugConfig={}", JSON.toJSONString(sqlDebugConfig));
          Map<String, List<String>> debugResult = SqlDebugDriver.debug(sqlDebugConfig);
          List<String> t2 = debugResult.get("t2");
          assert t2 != null && t2.size() > 0;
          assert "{\"stime\":\"2020-01-01 12:00:00\",\"cnt\":3}".equals(t2.get(0));
          assert "{\"stime\":\"2020-01-01 12:01:00\",\"cnt\":1}".equals(t2.get(1));
      }
test_case.class_method_signature: SqlDebugDriverTest.debugWatermark()
test_case.full_signature: @Test public void debugWatermark()
test_case.identifier: debugWatermark
test_case.invocations: collect of toJSONString fluentPut toJSONString fluentPut toJSONString fluentPut toJSONString fluentPut toList put setSourceConfigMap setSql info toJSONString debug get size equals get equals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void debugWatermark()
focal_class.file: plink-sql/plink-sql-core/src/main/java/com/github/hairless/plink/sql/SqlDebugDriver.java
focal_class.identifier: SqlDebugDriver
focal_class.class_method_signature: SqlDebugDriver.debug(SqlDebugConfig sqlDebugConfig)
focal_class.full_signature: public static Map<String, List<String>> debug(SqlDebugConfig sqlDebugConfig)
focal_class.identifier: debug
focal_class.modifiers: public static
focal_class.parameters: (SqlDebugConfig sqlDebugConfig)
focal_class.return: Map<String, List<String>>
focal_class.signature: Map<String, List<String>> debug(SqlDebugConfig sqlDebugConfig)
focal_class.class_method_signature: SqlDebugDriver.handleDebugSql(final String identifier, String sql, SqlDebugConfig sqlDebugConfig)
focal_class.full_signature: private static String handleDebugSql(final String identifier, String sql, SqlDebugConfig sqlDebugConfig)
focal_class.identifier: handleDebugSql
focal_class.modifiers: private static
focal_class.parameters: (final String identifier, String sql, SqlDebugConfig sqlDebugConfig)
focal_class.return: String
focal_class.signature: String handleDebugSql(final String identifier, String sql, SqlDebugConfig sqlDebugConfig)
focal_class.class_method_signature: SqlDebugDriver.buildDebugSourceSql(SqlParseNode sourceTable, SqlDebugConfig.SourceConfig sourceConfig)
focal_class.full_signature: private static String buildDebugSourceSql(SqlParseNode sourceTable, SqlDebugConfig.SourceConfig sourceConfig)
focal_class.identifier: buildDebugSourceSql
focal_class.modifiers: private static
focal_class.parameters: (SqlParseNode sourceTable, SqlDebugConfig.SourceConfig sourceConfig)
focal_class.return: String
focal_class.signature: String buildDebugSourceSql(SqlParseNode sourceTable, SqlDebugConfig.SourceConfig sourceConfig)
focal_class.class_method_signature: SqlDebugDriver.buildDebugSinkSql(String identifier, SqlParseNode sinkTable)
focal_class.full_signature: private static String buildDebugSinkSql(String identifier, SqlParseNode sinkTable)
focal_class.identifier: buildDebugSinkSql
focal_class.modifiers: private static
focal_class.parameters: (String identifier, SqlParseNode sinkTable)
focal_class.return: String
focal_class.signature: String buildDebugSinkSql(String identifier, SqlParseNode sinkTable)
focal_class.class_method_signature: SqlDebugDriver.buildDebugSinkSql(String identifier, SqlParseNode sinkTable, String newTableName)
focal_class.full_signature: private static String buildDebugSinkSql(String identifier, SqlParseNode sinkTable, String newTableName)
focal_class.identifier: buildDebugSinkSql
focal_class.modifiers: private static
focal_class.parameters: (String identifier, SqlParseNode sinkTable, String newTableName)
focal_class.return: String
focal_class.signature: String buildDebugSinkSql(String identifier, SqlParseNode sinkTable, String newTableName)
focal_class.class_method_signature: SqlDebugDriver.buildDebugInsertSql(SqlParseNode fromTable, String targetTableName)
focal_class.full_signature: private static String buildDebugInsertSql(SqlParseNode fromTable, String targetTableName)
focal_class.identifier: buildDebugInsertSql
focal_class.modifiers: private static
focal_class.parameters: (SqlParseNode fromTable, String targetTableName)
focal_class.return: String
focal_class.signature: String buildDebugInsertSql(SqlParseNode fromTable, String targetTableName)
focal_class.class_method_signature: SqlDebugDriver.filterFormatProperties(Map<String, String> properties)
focal_class.full_signature: private static Map<String, String> filterFormatProperties(Map<String, String> properties)
focal_class.identifier: filterFormatProperties
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> properties)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> filterFormatProperties(Map<String, String> properties)
focal_class.class_method_signature: SqlDebugDriver.newSqlTableOption(String key, String value)
focal_class.full_signature: private static SqlTableOption newSqlTableOption(String key, String value)
focal_class.identifier: newSqlTableOption
focal_class.modifiers: private static
focal_class.parameters: (String key, String value)
focal_class.return: SqlTableOption
focal_class.signature: SqlTableOption newSqlTableOption(String key, String value)
focal_method.body: public static Map<String, List<String>> debug(SqlDebugConfig sqlDebugConfig) throws Exception {
          Preconditions.checkNotNull(sqlDebugConfig, "sqlDebugConfig should be not null");
          Preconditions.checkNotNull(sqlDebugConfig.getSql(), "sql should be not null");
          String identifier = UUID.randomUUID().toString();
          String debugSql = handleDebugSql(identifier, sqlDebugConfig.getSql(), sqlDebugConfig);
          log.debug("start sql debug,sql:{}", debugSql);
          SqlConfig config = SqlConfig.builder().sql(debugSql).jobName("sql_job_debug_test").build();
          SqlJob sqlJob = new SqlJob(config);
          try {
              CollectionDataWarehouse.registerLock(identifier);
              sqlJob.start();
              return CollectionDataWarehouse.getData(identifier);
          } finally {
              CollectionDataWarehouse.remove(identifier);
          }
      }
focal_method.class_method_signature: SqlDebugDriver.debug(SqlDebugConfig sqlDebugConfig)
focal_method.full_signature: public static Map<String, List<String>> debug(SqlDebugConfig sqlDebugConfig)
focal_method.identifier: debug
focal_method.invocations: checkNotNull checkNotNull getSql toString randomUUID handleDebugSql getSql debug build jobName sql builder registerLock start getData remove
focal_method.modifiers: public static
focal_method.parameters: (SqlDebugConfig sqlDebugConfig)
focal_method.return: Map<String, List<String>>
focal_method.signature: Map<String, List<String>> debug(SqlDebugConfig sqlDebugConfig)