-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jt-chen
committed
Sep 13, 2023
1 parent
051fe82
commit 74f12ff
Showing
49 changed files
with
2,505 additions
and
609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
.../src/test/java/com/alibaba/datax/plugin/reader/clickhousereader/ClickhouseReaderTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
common/src/main/java/com/alibaba/datax/common/util/LimitLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.alibaba.datax.common.util; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author jitongchen | ||
* @date 2023/9/7 9:47 AM | ||
*/ | ||
public class LimitLogger { | ||
|
||
private static Map<String, Long> lastPrintTime = new HashMap<>(); | ||
|
||
public static void limit(String name, long limit, LoggerFunction function) { | ||
if (StringUtils.isBlank(name)) { | ||
name = "__all__"; | ||
} | ||
if (limit <= 0) { | ||
function.apply(); | ||
} else { | ||
if (!lastPrintTime.containsKey(name)) { | ||
lastPrintTime.put(name, System.currentTimeMillis()); | ||
function.apply(); | ||
} else { | ||
if (System.currentTimeMillis() > lastPrintTime.get(name) + limit) { | ||
lastPrintTime.put(name, System.currentTimeMillis()); | ||
function.apply(); | ||
} | ||
} | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
common/src/main/java/com/alibaba/datax/common/util/LoggerFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.alibaba.datax.common.util; | ||
|
||
/** | ||
* @author molin.lxd | ||
* @date 2021-05-09 | ||
*/ | ||
public interface LoggerFunction { | ||
|
||
void apply(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
74f12ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥不再DateColumn里扩展一个subType叫做Timestamp呢,根据是否保留nanos的设置来存储 nanos, 对手方插件获取datecolumn的时候,根据是否包含纳秒来处理事datetime类型还是timestamp类型。