semanticdb-core 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare interface DataSourceItemType {
|
|
2
2
|
id: string;
|
|
3
|
-
client: 'clickhouse' | 'mysql' | 'postgres' | 'starrocks' | 'oracle' | 'impala' | 'sybase';
|
|
3
|
+
client: 'clickhouse' | 'mysql' | 'postgres' | 'starrocks' | 'oracle' | 'impala' | 'sybase' | 'databricks';
|
|
4
4
|
connection: {
|
|
5
5
|
database: string;
|
|
6
6
|
host: string;
|
|
@@ -12,6 +12,9 @@ export declare interface DataSourceItemType {
|
|
|
12
12
|
cluster?: string;
|
|
13
13
|
shardingKey?: string;
|
|
14
14
|
time?: string;
|
|
15
|
+
sid?: string;
|
|
16
|
+
path?: string;
|
|
17
|
+
token?: string;
|
|
15
18
|
};
|
|
16
19
|
readonly?: boolean;
|
|
17
20
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getValueByChain = exports.getFlattenQuery = exports.isDimensionInLogicform = exports.isDimensionInPred = exports.isDimensionInGroupby = exports.isDimensionInQuery = void 0;
|
|
4
4
|
const date_1 = require("../common/date");
|
|
5
|
+
const tws = (0, date_1.getSupportedTimeWindows)();
|
|
5
6
|
/**
|
|
6
7
|
* 判断一个维度是否在查询中被使用
|
|
7
8
|
* @param query - 查询对象
|
|
@@ -23,7 +24,9 @@ const isDimensionInQuery = (query, dimension, strictMode = true) => {
|
|
|
23
24
|
else if (dimension._id in flattenQuery) {
|
|
24
25
|
if ((0, date_1.isStandardDateForm)(flattenQuery[dimension._id])) {
|
|
25
26
|
const minGran = (0, date_1.getMinGran)(flattenQuery[dimension._id]);
|
|
26
|
-
|
|
27
|
+
if (!minGran)
|
|
28
|
+
return false;
|
|
29
|
+
return tws.indexOf(minGran) >= tws.indexOf(dimension.level);
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -38,8 +41,22 @@ exports.isDimensionInQuery = isDimensionInQuery;
|
|
|
38
41
|
const isDimensionInGroupby = (groupby, dimension) => {
|
|
39
42
|
for (const groupbyItem of groupby) {
|
|
40
43
|
if (typeof dimension === 'object') {
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
// predItem check
|
|
45
|
+
if (groupbyItem._id === dimension._id || groupbyItem._id.startsWith(`${dimension._id}_`)) {
|
|
46
|
+
if (groupbyItem.level) {
|
|
47
|
+
// level check
|
|
48
|
+
if (tws.indexOf(groupbyItem.level) < 0) {
|
|
49
|
+
return groupbyItem.level === dimension.level;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return tws.indexOf(groupbyItem.level) >= tws.indexOf(dimension.level);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
43
60
|
}
|
|
44
61
|
if (groupbyItem._id === dimension) {
|
|
45
62
|
return true;
|