Skip to content

Commit 705e364

Browse files
committed
[not null][flinkStreamSQL支持not null 语法][17872]
1 parent d832250 commit 705e364

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/src/main/java/com/dtstack/flink/sql/table/AbsSourceParser.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public abstract class AbsSourceParser extends AbsTableParser {
4242

4343
private static Pattern virtualFieldKeyPattern = Pattern.compile("(?i)^(\\S+\\([^\\)]+\\))\\s+AS\\s+(\\w+)$");
4444
private static Pattern waterMarkKeyPattern = Pattern.compile("(?i)^\\s*WATERMARK\\s+FOR\\s+(\\S+)\\s+AS\\s+withOffset\\(\\s*(\\S+)\\s*,\\s*(\\d+)\\s*\\)$");
45-
private static Pattern notNullKeyPattern = Pattern.compile("(?i)(\\w+)\\s+(\\w+)(\\s+NOT\\s+NULL)?$");
45+
private static Pattern notNullKeyPattern = Pattern.compile("(?i)(\\w+)\\s+(\\w+)\\s+NOT\\s+NULL?$");
4646

4747
static {
4848
keyPatternMap.put(VIRTUAL_KEY, virtualFieldKeyPattern);
@@ -74,9 +74,8 @@ static void dealNotNull(Matcher matcher, TableInfo tableInfo) {
7474
String fieldName = matcher.group(1);
7575
String fieldType = matcher.group(2);
7676
Class fieldClass= ClassUtil.stringConvertClass(fieldType);
77-
boolean notNull = matcher.group(3) != null;
7877
TableInfo.FieldExtraInfo fieldExtraInfo = new TableInfo.FieldExtraInfo();
79-
fieldExtraInfo.setNotNull(notNull);
78+
fieldExtraInfo.setNotNull(true);
8079

8180
tableInfo.addPhysicalMappings(fieldName, fieldName);
8281
tableInfo.addField(fieldName);

0 commit comments

Comments
 (0)