|
49 | 49 | import java.util.Objects; |
50 | 50 | import java.util.Set; |
51 | 51 | import java.util.TimeZone; |
| 52 | +import java.util.stream.Collectors; |
52 | 53 |
|
53 | 54 | /** |
54 | 55 | * This class represents a column defined in database. |
@@ -89,6 +90,7 @@ public final class ClickHouseColumn implements Serializable { |
89 | 90 | private List<ClickHouseColumn> nested; |
90 | 91 | private List<String> parameters; |
91 | 92 | private ClickHouseEnum enumConstants; |
| 93 | + private Map<String, ClickHouseColumn> jsonPredefinedPaths; |
92 | 94 |
|
93 | 95 | private int arrayLevel; |
94 | 96 | private ClickHouseColumn arrayBaseColumn; |
@@ -509,11 +511,14 @@ protected static int readColumn(String args, int startIndex, int len, String nam |
509 | 511 | i = ClickHouseUtils.skipBrackets(args, index, len, '('); |
510 | 512 | String originalTypeName = args.substring(startIndex, i); |
511 | 513 | List<ClickHouseColumn> nestedColumns = new ArrayList<>(); |
| 514 | + |
512 | 515 | List<String> parameters = new ArrayList<>(); |
513 | 516 | parseJSONColumn(args.substring(index + 1, i - 1), nestedColumns, parameters); |
514 | 517 | nestedColumns.sort(Comparator.comparing(o -> o.getDataType().name())); |
515 | 518 | column = new ClickHouseColumn(ClickHouseDataType.JSON, name, originalTypeName, nullable, lowCardinality, |
516 | 519 | parameters, nestedColumns); |
| 520 | + column.jsonPredefinedPaths = nestedColumns.stream().collect(Collectors.toMap(ClickHouseColumn::getColumnName, |
| 521 | + c -> c)); |
517 | 522 | fixedLength = false; |
518 | 523 | estimatedLength++; |
519 | 524 | } |
@@ -1009,6 +1014,10 @@ public ClickHouseAggregateFunction getAggregateFunction() { |
1009 | 1014 | return aggFuncType; |
1010 | 1015 | } |
1011 | 1016 |
|
| 1017 | + public Map<String, ClickHouseColumn> getJsonPredefinedPaths() { |
| 1018 | + return jsonPredefinedPaths; |
| 1019 | + } |
| 1020 | + |
1012 | 1021 | public ClickHouseArraySequence newArrayValue(ClickHouseDataConfig config) { |
1013 | 1022 | int level = arrayLevel; |
1014 | 1023 | ClickHouseArraySequence value; |
|
0 commit comments