@eagleoutice/flowr 2.9.14 → 2.10.2
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.
- package/README.md +52 -29
- package/abstract-interpretation/absint-visitor.d.ts +13 -8
- package/abstract-interpretation/absint-visitor.js +35 -26
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +1 -2
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -15
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +2 -15
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +11 -17
- package/abstract-interpretation/data-frame/mappers/arguments.js +18 -18
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +41 -15
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +74 -48
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -1
- package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/semantics.js +31 -35
- package/abstract-interpretation/data-frame/shape-inference.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -0
- package/abstract-interpretation/domains/interval-domain.js +3 -0
- package/abstract-interpretation/domains/product-domain.d.ts +9 -0
- package/abstract-interpretation/domains/product-domain.js +26 -6
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +36 -22
- package/abstract-interpretation/domains/state-abstract-domain.js +169 -62
- package/abstract-interpretation/unsupported-functions.d.ts +10 -0
- package/abstract-interpretation/unsupported-functions.js +45 -0
- package/benchmark/slicer.js +10 -13
- package/benchmark/stats/stats.d.ts +2 -2
- package/cli/flowr.js +1 -1
- package/cli/repl/parser/slice-query-parser.d.ts +2 -2
- package/config.d.ts +4 -0
- package/config.js +5 -3
- package/control-flow/control-flow-graph.js +13 -9
- package/control-flow/semantic-cfg-guided-visitor.d.ts +6 -0
- package/control-flow/semantic-cfg-guided-visitor.js +6 -0
- package/dataflow/environments/built-in-proc-name.d.ts +6 -0
- package/dataflow/environments/built-in-proc-name.js +6 -0
- package/dataflow/environments/built-in.d.ts +7 -5
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +442 -6
- package/dataflow/environments/default-builtin-config.js +158 -3
- package/dataflow/environments/identifier.d.ts +4 -0
- package/dataflow/environments/identifier.js +17 -0
- package/dataflow/environments/overwrite.js +2 -5
- package/dataflow/graph/call-graph.d.ts +4 -7
- package/dataflow/graph/call-graph.js +0 -22
- package/dataflow/graph/df-helper.d.ts +23 -12
- package/dataflow/graph/df-helper.js +44 -7
- package/dataflow/graph/graph-helper.d.ts +9 -4
- package/dataflow/graph/graph-helper.js +26 -3
- package/dataflow/graph/graph.d.ts +23 -2
- package/dataflow/graph/graph.js +38 -4
- package/dataflow/graph/vertex.d.ts +2 -0
- package/dataflow/instrument/instrument-dataflow-count.d.ts +10 -0
- package/dataflow/instrument/instrument-dataflow-count.js +10 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +23 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +80 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +62 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.js +6 -4
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/documentation/doc-readme.js +2 -1
- package/documentation/wiki-absint.js +6 -5
- package/documentation/wiki-analyzer.js +0 -2
- package/documentation/wiki-linter.js +6 -0
- package/documentation/wiki-normalized-ast.js +7 -7
- package/linter/linter-rules.d.ts +49 -1
- package/linter/linter-rules.js +5 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +3 -4
- package/linter/rules/problematic-eval.d.ts +44 -0
- package/linter/rules/problematic-eval.js +83 -0
- package/linter/rules/roxygen-arguments.d.ts +35 -0
- package/linter/rules/roxygen-arguments.js +100 -0
- package/package.json +8 -9
- package/project/context/flowr-analyzer-context.d.ts +1 -8
- package/project/context/flowr-analyzer-context.js +1 -7
- package/project/context/flowr-analyzer-environment-context.d.ts +5 -0
- package/project/context/flowr-analyzer-environment-context.js +6 -0
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +4 -2
- package/project/flowr-analyzer-builder.js +1 -4
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +10 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -3
- package/queries/catalog/df-shape-query/df-shape-query-format.js +7 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +1 -1
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-executor.js +0 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +3 -3
- package/queries/catalog/input-sources-query/input-sources-query-executor.d.ts +6 -0
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +66 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +36 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +63 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +92 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.js +310 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/location-map-query/location-map-query-executor.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.js +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +3 -3
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +1 -4
- package/queries/catalog/provenance-query/provenance-query-executor.js +3 -6
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
- package/queries/query.d.ts +9 -1
- package/queries/query.js +2 -0
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/model.js +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +29 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +16 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +19 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +16 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +25 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +15 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.js +3 -1
- package/r-bridge/roxygen2/documentation-provider.js +15 -6
- package/r-bridge/roxygen2/roxygen-ast.d.ts +3 -1
- package/search/flowr-search-builder.js +3 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +11 -10
- package/slicing/criterion/parse.js +9 -8
- package/slicing/static/static-slicer.js +24 -1
- package/util/collections/arrays.d.ts +4 -0
- package/util/collections/arrays.js +7 -0
- package/util/mermaid/ast.js +2 -1
- package/util/mermaid/dfg.js +2 -1
- package/util/record.d.ts +23 -0
- package/util/record.js +33 -0
- package/util/version.js +1 -1
- package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +0 -41
- package/abstract-interpretation/domains/mapped-abstract-domain.js +0 -213
|
@@ -10,8 +10,10 @@ const retriever_1 = require("../../../r-bridge/retriever");
|
|
|
10
10
|
const assert_1 = require("../../../util/assert");
|
|
11
11
|
const dataframe_domain_1 = require("../dataframe-domain");
|
|
12
12
|
const resolve_args_1 = require("../resolve-args");
|
|
13
|
+
const semantics_1 = require("../semantics");
|
|
13
14
|
const arguments_1 = require("./arguments");
|
|
14
15
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
16
|
+
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
15
17
|
/**
|
|
16
18
|
* Represents the different types of data frames in R
|
|
17
19
|
*/
|
|
@@ -26,43 +28,48 @@ var DataFrameType;
|
|
|
26
28
|
* including information about the origin library of the functions and the type of the returned data frame.
|
|
27
29
|
*/
|
|
28
30
|
const DataFrameFunctionMapper = {
|
|
29
|
-
'data.frame': { mapper: mapDataFrameCreate, library: 'base', returnType: DataFrameType.DataFrame },
|
|
30
|
-
'as.data.frame': { mapper: mapDataFrameConvert, library: 'base', returnType: DataFrameType.DataFrame },
|
|
31
|
-
'read.table': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
32
|
-
'read.csv': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
33
|
-
'read.csv2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
34
|
-
'read.delim': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
35
|
-
'read.delim2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
36
|
-
'read_table': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
|
|
37
|
-
'read_csv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
|
|
38
|
-
'read_csv2': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
|
|
39
|
-
'read_tsv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
|
|
40
|
-
'read_delim': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
|
|
31
|
+
'data.frame': { mapper: mapDataFrameCreate, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
32
|
+
'as.data.frame': { mapper: mapDataFrameConvert, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
33
|
+
'read.table': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
34
|
+
'read.csv': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
35
|
+
'read.csv2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
36
|
+
'read.delim': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
37
|
+
'read.delim2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
38
|
+
'read_table': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
|
|
39
|
+
'read_csv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
|
|
40
|
+
'read_csv2': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
|
|
41
|
+
'read_tsv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
|
|
42
|
+
'read_delim': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
|
|
41
43
|
'cbind': { mapper: mapDataFrameColBind, library: 'base', returnType: DataFrameType.DataFrame },
|
|
42
44
|
'rbind': { mapper: mapDataFrameRowBind, library: 'base', returnType: DataFrameType.DataFrame },
|
|
43
45
|
'head': { mapper: mapDataFrameHeadTail, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
44
46
|
'tail': { mapper: mapDataFrameHeadTail, library: 'utils', returnType: DataFrameType.DataFrame },
|
|
45
47
|
'subset': { mapper: mapDataFrameSubset, library: 'base', returnType: DataFrameType.DataFrame },
|
|
46
|
-
'filter': { mapper: mapDataFrameFilter, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
47
|
-
'select': { mapper: mapDataFrameSelect, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
48
|
-
'mutate': { mapper: mapDataFrameMutate, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
49
|
-
'transform': { mapper: mapDataFrameMutate, library: 'base', returnType: DataFrameType.DataFrame },
|
|
50
|
-
'group_by': { mapper: mapDataFrameGroupBy, library: 'dplyr', returnType: DataFrameType.Tibble },
|
|
51
|
-
'summarise': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
52
|
-
'summarize': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
53
|
-
'inner_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
54
|
-
'left_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
55
|
-
'right_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
56
|
-
'full_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
57
|
-
'merge': { mapper: mapDataFrameJoin, library: 'base', returnType: DataFrameType.DataFrame },
|
|
58
|
-
'relocate': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame },
|
|
59
|
-
'arrange': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame }
|
|
48
|
+
'filter': { mapper: mapDataFrameFilter, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
49
|
+
'select': { mapper: mapDataFrameSelect, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
50
|
+
'mutate': { mapper: mapDataFrameMutate, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
51
|
+
'transform': { mapper: mapDataFrameMutate, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
52
|
+
'group_by': { mapper: mapDataFrameGroupBy, library: 'dplyr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
|
|
53
|
+
'summarise': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
54
|
+
'summarize': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
55
|
+
'inner_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
56
|
+
'left_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
57
|
+
'right_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
58
|
+
'full_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
59
|
+
'merge': { mapper: mapDataFrameJoin, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
60
|
+
'relocate': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
|
|
61
|
+
'arrange': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true }
|
|
60
62
|
};
|
|
61
63
|
/**
|
|
62
64
|
* List of other data frame functions that are not explicitly supported but may return data frames.
|
|
63
65
|
*/
|
|
64
66
|
const OtherDataFrameFunctions = [
|
|
65
67
|
{
|
|
68
|
+
type: 'entry_point',
|
|
69
|
+
names: ['as.data.frame.matrix'], // S3 dispatch of `as.data.frame`
|
|
70
|
+
library: 'base',
|
|
71
|
+
returnType: DataFrameType.DataFrame
|
|
72
|
+
}, {
|
|
66
73
|
type: 'entry_point',
|
|
67
74
|
names: ['anova', 'AIC', 'BIC'],
|
|
68
75
|
library: 'anova',
|
|
@@ -72,11 +79,6 @@ const OtherDataFrameFunctions = [
|
|
|
72
79
|
names: ['Anova', 'Manova'],
|
|
73
80
|
library: 'car',
|
|
74
81
|
returnType: DataFrameType.DataFrame
|
|
75
|
-
}, {
|
|
76
|
-
type: 'entry_point',
|
|
77
|
-
names: ['lmer'],
|
|
78
|
-
library: 'lme4',
|
|
79
|
-
returnType: DataFrameType.DataFrame
|
|
80
82
|
}, {
|
|
81
83
|
type: 'entry_point',
|
|
82
84
|
names: ['data_frame', 'as_data_frame'],
|
|
@@ -115,7 +117,7 @@ const OtherDataFrameFunctions = [
|
|
|
115
117
|
dataFrame: { pos: 0, name: 'object' }
|
|
116
118
|
}, {
|
|
117
119
|
type: 'transformation',
|
|
118
|
-
names: ['unique', '
|
|
120
|
+
names: ['unique', 'droplevels'],
|
|
119
121
|
library: 'base',
|
|
120
122
|
returnType: DataFrameType.DataFrame,
|
|
121
123
|
dataFrame: { pos: 0, name: 'x' }
|
|
@@ -151,6 +153,7 @@ const OtherDataFrameFunctions = [
|
|
|
151
153
|
],
|
|
152
154
|
library: 'dplyr',
|
|
153
155
|
returnType: DataFrameType.DataFrame,
|
|
156
|
+
alwaysDataFrame: true,
|
|
154
157
|
dataFrame: { pos: 0, name: '.data' }
|
|
155
158
|
}, {
|
|
156
159
|
type: 'transformation',
|
|
@@ -163,6 +166,7 @@ const OtherDataFrameFunctions = [
|
|
|
163
166
|
],
|
|
164
167
|
library: 'dplyr',
|
|
165
168
|
returnType: DataFrameType.Tibble,
|
|
169
|
+
alwaysDataFrame: true,
|
|
166
170
|
dataFrame: { pos: 0, name: '.tbl' }
|
|
167
171
|
}, {
|
|
168
172
|
type: 'transformation',
|
|
@@ -173,12 +177,14 @@ const OtherDataFrameFunctions = [
|
|
|
173
177
|
],
|
|
174
178
|
library: 'dplyr',
|
|
175
179
|
returnType: DataFrameType.DataFrame,
|
|
180
|
+
alwaysDataFrame: true,
|
|
176
181
|
dataFrame: { pos: 0, name: 'x' }
|
|
177
182
|
}, {
|
|
178
183
|
type: 'transformation',
|
|
179
184
|
names: ['bind_cols', 'bind_rows'],
|
|
180
185
|
library: 'dplyr',
|
|
181
|
-
returnType: DataFrameType.DataFrame
|
|
186
|
+
returnType: DataFrameType.DataFrame,
|
|
187
|
+
alwaysDataFrame: true
|
|
182
188
|
}, {
|
|
183
189
|
type: 'transformation',
|
|
184
190
|
names: [
|
|
@@ -193,6 +199,7 @@ const OtherDataFrameFunctions = [
|
|
|
193
199
|
names: ['add_column', 'add_row', 'add_case'],
|
|
194
200
|
library: 'tibble',
|
|
195
201
|
returnType: DataFrameType.Tibble,
|
|
202
|
+
alwaysDataFrame: true,
|
|
196
203
|
dataFrame: { pos: 0, name: '.data' }
|
|
197
204
|
}, {
|
|
198
205
|
type: 'transformation',
|
|
@@ -200,6 +207,20 @@ const OtherDataFrameFunctions = [
|
|
|
200
207
|
library: 'data.table',
|
|
201
208
|
returnType: DataFrameType.DataTable,
|
|
202
209
|
dataFrame: { pos: 0, name: 'data' }
|
|
210
|
+
}, {
|
|
211
|
+
type: 'modification',
|
|
212
|
+
names: ['setNames'],
|
|
213
|
+
library: 'stats',
|
|
214
|
+
constraintType: semantics_1.ConstraintType.OperandModification,
|
|
215
|
+
returnType: DataFrameType.DataFrame,
|
|
216
|
+
dataFrame: { pos: 0, name: 'object' }
|
|
217
|
+
}, {
|
|
218
|
+
type: 'modification',
|
|
219
|
+
names: ['unname'],
|
|
220
|
+
library: 'base',
|
|
221
|
+
constraintType: semantics_1.ConstraintType.OperandModification,
|
|
222
|
+
returnType: DataFrameType.DataFrame,
|
|
223
|
+
dataFrame: { pos: 0, name: 'obj' }
|
|
203
224
|
}
|
|
204
225
|
];
|
|
205
226
|
/**
|
|
@@ -529,30 +550,33 @@ function mapDataFrameFunctionCall(node, inference, dfg, ctx) {
|
|
|
529
550
|
return;
|
|
530
551
|
}
|
|
531
552
|
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
|
|
532
|
-
const
|
|
533
|
-
if (isDataFrameFunction(
|
|
534
|
-
const
|
|
535
|
-
const mapper = DataFrameFunctionMapper[functionName].mapper;
|
|
553
|
+
const functionName = identifier_1.Identifier.getName(node.functionName.content);
|
|
554
|
+
if (isDataFrameFunction(functionName)) {
|
|
555
|
+
const mapping = DataFrameFunctionMapper[functionName];
|
|
536
556
|
const params = DataFrameFunctionParamsMapper[functionName];
|
|
537
557
|
const args = (0, arguments_1.getFunctionArguments)(node, dfg);
|
|
538
558
|
if ((0, arguments_1.hasCriticalArgument)(args, params.critical, resolveInfo)) {
|
|
539
559
|
return [{ operation: 'unknown', operand: undefined }];
|
|
540
560
|
}
|
|
541
561
|
else {
|
|
542
|
-
return mapper(args, params, inference, resolveInfo);
|
|
562
|
+
return mapping.mapper(args, params, inference, resolveInfo) ?? (mapping.alwaysDataFrame ? [{ operation: 'unknown', operand: undefined }] : undefined);
|
|
543
563
|
}
|
|
544
564
|
}
|
|
545
565
|
else {
|
|
546
|
-
const mapping = getOtherDataFrameFunction(
|
|
566
|
+
const mapping = getOtherDataFrameFunction(functionName);
|
|
547
567
|
if (mapping === undefined) {
|
|
548
568
|
return;
|
|
549
569
|
}
|
|
550
570
|
else if (mapping.type === 'entry_point') {
|
|
551
571
|
return [{ operation: 'unknown', operand: undefined }];
|
|
552
572
|
}
|
|
553
|
-
else if (mapping.type === 'transformation'
|
|
573
|
+
else if (mapping.type === 'transformation') {
|
|
574
|
+
const args = (0, arguments_1.getFunctionArguments)(node, dfg);
|
|
575
|
+
return mapDataFrameUnknown(args, mapping, inference, resolveInfo) ?? (mapping.alwaysDataFrame ? [{ operation: 'unknown', operand: undefined }] : undefined);
|
|
576
|
+
}
|
|
577
|
+
else if (mapping.type === 'modification') {
|
|
554
578
|
const args = (0, arguments_1.getFunctionArguments)(node, dfg);
|
|
555
|
-
return mapDataFrameUnknown(args, mapping, inference, resolveInfo);
|
|
579
|
+
return mapDataFrameUnknown(args, { ...mapping, constraintType: semantics_1.ConstraintType.OperandModification }, inference, resolveInfo);
|
|
556
580
|
}
|
|
557
581
|
else {
|
|
558
582
|
(0, assert_1.assertUnreachable)(mapping);
|
|
@@ -873,7 +897,7 @@ function mapDataFrameSelect(args, params, inference, info) {
|
|
|
873
897
|
const accessedCols = [...selectedCols ?? [], ...unselectedCols ?? []];
|
|
874
898
|
const mixedAccess = accessedCols.some(col => typeof col === 'string') && accessedCols.some(col => typeof col === 'number');
|
|
875
899
|
const duplicateAccess = accessedCols.some((col, _, list) => col !== undefined && list.filter(other => other === col).length > 1);
|
|
876
|
-
const renamedCols = selectArgs.some(
|
|
900
|
+
const renamedCols = selectArgs.some(r_argument_1.RArgument.isNamed);
|
|
877
901
|
// map to top if columns are selected mixed by string and number, or are selected duplicate
|
|
878
902
|
if (mixedAccess || duplicateAccess) {
|
|
879
903
|
selectedCols = undefined;
|
|
@@ -974,8 +998,8 @@ function mapDataFrameGroupBy(args, params, inference, info) {
|
|
|
974
998
|
const result = [];
|
|
975
999
|
const byArgs = args.filter(arg => arg !== dataFrame);
|
|
976
1000
|
const accessedNames = byArgs.flatMap(arg => (0, arguments_1.getUnresolvedSymbolsInExpression)(arg, info.graph)).map(identifier_1.Identifier.toString);
|
|
977
|
-
const byNames = byArgs.map(arg =>
|
|
978
|
-
const mutatedCols = byArgs.some(
|
|
1001
|
+
const byNames = byArgs.map(arg => r_argument_1.RArgument.isNamed(arg) ? (0, resolve_args_1.resolveIdToArgName)(arg, info) : (0, resolve_args_1.resolveIdToArgValueSymbolName)(arg, info));
|
|
1002
|
+
const mutatedCols = byArgs.some(r_argument_1.RArgument.isNamed) || byNames.some(assert_1.isUndefined);
|
|
979
1003
|
if (accessedNames.length > 0) {
|
|
980
1004
|
result.push({
|
|
981
1005
|
operation: 'accessCols',
|
|
@@ -1076,7 +1100,7 @@ function mapDataFrameIdentity(args, params, inference, info) {
|
|
|
1076
1100
|
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
1077
1101
|
return;
|
|
1078
1102
|
}
|
|
1079
|
-
else if (params.disallowNamedArgs && args.some(
|
|
1103
|
+
else if (params.disallowNamedArgs && args.some(r_argument_1.RArgument.isNamed)) {
|
|
1080
1104
|
return [{ operation: 'unknown', operand: dataFrame.value.info.id }];
|
|
1081
1105
|
}
|
|
1082
1106
|
return [{
|
|
@@ -1125,21 +1149,23 @@ function getRequestFromRead(fileNameArg, textArg, params, info) {
|
|
|
1125
1149
|
else if (textArg !== undefined && textArg !== r_function_call_1.EmptyArgument) {
|
|
1126
1150
|
const text = (0, resolve_args_1.resolveIdToArgValue)(textArg, info);
|
|
1127
1151
|
if (typeof text === 'string') {
|
|
1128
|
-
source = text;
|
|
1129
1152
|
request = (0, retriever_1.requestFromInput)((0, resolve_args_1.unescapeSpecialChars)(text));
|
|
1130
1153
|
}
|
|
1131
1154
|
}
|
|
1132
|
-
request
|
|
1155
|
+
if (request?.request === 'file' && info.ctx.files.hasCached(request.content)) {
|
|
1156
|
+
request = info.ctx.files.resolveRequest(request).r;
|
|
1157
|
+
}
|
|
1133
1158
|
return { source, request };
|
|
1134
1159
|
}
|
|
1135
1160
|
/**
|
|
1136
1161
|
* Gets all entries from a line of a CSV file using a custom separator char, quote char, and comment char
|
|
1137
1162
|
*/
|
|
1138
1163
|
function getEntriesFromCsvLine(line, sep = ',', quote = '"', comment = '', trim = true) {
|
|
1164
|
+
sep = sep.length > 0 ? sep : '\\s'; // default to whitespace separator
|
|
1139
1165
|
sep = (0, arguments_1.escapeRegExp)(sep, true); // only allow tokens like `\s`, `\t`, or `\n` in separator, quote, and comment chars
|
|
1140
1166
|
quote = (0, arguments_1.escapeRegExp)(quote);
|
|
1141
1167
|
comment = (0, arguments_1.escapeRegExp)(comment);
|
|
1142
|
-
const quantifier = sep === '\\s' ? '+' : '*'; // do not allow unquoted empty entries in whitespace-
|
|
1168
|
+
const quantifier = sep === '\\s' ? '+' : '*'; // do not allow unquoted empty entries in whitespace-separated files
|
|
1143
1169
|
const LineCommentRegex = new RegExp(`[${comment}].*`);
|
|
1144
1170
|
const CsvEntryRegex = new RegExp(`(?<=^|[${sep}])(?:[${quote}]((?:[^${quote}]|[${quote}]{2})*)[${quote}]|([^${sep}]${quantifier}))`, 'g');
|
|
1145
1171
|
const DoubleQuoteRegex = new RegExp(`([${quote}])\\1`, 'g'); // regex for doubled quotes like `""` or `''`
|
|
@@ -4,6 +4,7 @@ exports.mapDataFrameReplacementFunction = mapDataFrameReplacementFunction;
|
|
|
4
4
|
const config_1 = require("../../../config");
|
|
5
5
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
6
6
|
const make_argument_1 = require("../../../dataflow/internal/process/functions/call/argument/make-argument");
|
|
7
|
+
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
7
8
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
9
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
9
10
|
const resolve_args_1 = require("../resolve-args");
|
|
@@ -107,7 +108,7 @@ function mapDataFrameNamedColumnAssignment(access, expression, inference, info)
|
|
|
107
108
|
}
|
|
108
109
|
function mapDataFrameIndexColRowAssignment(access, expression, inference, info) {
|
|
109
110
|
const dataFrame = access.accessed;
|
|
110
|
-
const args = access.access;
|
|
111
|
+
const args = access.access.filter(arg => r_argument_1.RArgument.isEmpty(arg) || r_argument_1.RArgument.isUnnamed(arg));
|
|
111
112
|
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference) || args.every(arg => arg === r_function_call_1.EmptyArgument)) {
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
@@ -6,7 +6,6 @@ exports.getConstraintType = getConstraintType;
|
|
|
6
6
|
const assert_1 = require("../../util/assert");
|
|
7
7
|
const lattice_1 = require("../domains/lattice");
|
|
8
8
|
const positive_interval_domain_1 = require("../domains/positive-interval-domain");
|
|
9
|
-
const dataframe_domain_1 = require("./dataframe-domain");
|
|
10
9
|
/**
|
|
11
10
|
* Represents the different types of resulting constraints that are inferred by abstract data frame operations.
|
|
12
11
|
*/
|
|
@@ -73,7 +72,7 @@ function applyCreateSemantics(value, { colnames, rows }) {
|
|
|
73
72
|
const colnamesValue = setRange(colnames);
|
|
74
73
|
const colsValue = colnames !== undefined ? [colnames.length, colnames.length] : positive_interval_domain_1.PosIntervalTop;
|
|
75
74
|
const rowsValue = Array.isArray(rows) ? rows : typeof rows === 'number' ? [rows, rows] : positive_interval_domain_1.PosIntervalTop;
|
|
76
|
-
return
|
|
75
|
+
return value.create({
|
|
77
76
|
colnames: value.colnames.create(colnamesValue),
|
|
78
77
|
cols: value.cols.create(colsValue),
|
|
79
78
|
rows: value.rows.create(rowsValue)
|
|
@@ -84,14 +83,14 @@ function applyReadSemantics(value, { colnames, rows }) {
|
|
|
84
83
|
}
|
|
85
84
|
function applyAccessColsSemantics(value, { columns }) {
|
|
86
85
|
if (columns?.every(col => typeof col === 'string')) {
|
|
87
|
-
return
|
|
86
|
+
return value.create({
|
|
88
87
|
colnames: value.colnames.union(setRange(columns)),
|
|
89
88
|
cols: value.cols,
|
|
90
89
|
rows: value.rows
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
else if (columns?.every(col => typeof col === 'number')) {
|
|
94
|
-
return
|
|
93
|
+
return value.create({
|
|
95
94
|
colnames: value.colnames,
|
|
96
95
|
cols: columns.reduce((current, col) => current.max([col, col]), value.cols),
|
|
97
96
|
rows: value.rows
|
|
@@ -101,7 +100,7 @@ function applyAccessColsSemantics(value, { columns }) {
|
|
|
101
100
|
}
|
|
102
101
|
function applyAccessRowsSemantics(value, { rows }) {
|
|
103
102
|
if (rows !== undefined) {
|
|
104
|
-
return
|
|
103
|
+
return value.create({
|
|
105
104
|
colnames: value.colnames,
|
|
106
105
|
cols: value.cols,
|
|
107
106
|
rows: rows.reduce((current, row) => current.max([row, row]), value.rows)
|
|
@@ -111,20 +110,20 @@ function applyAccessRowsSemantics(value, { rows }) {
|
|
|
111
110
|
}
|
|
112
111
|
function applyAssignColsSemantics(value, { columns }) {
|
|
113
112
|
if (columns?.every(col => typeof col === 'string')) {
|
|
114
|
-
return
|
|
113
|
+
return value.create({
|
|
115
114
|
colnames: value.colnames.union(setRange(columns)),
|
|
116
115
|
cols: value.cols.add([0, columns.length]).max([columns.length, columns.length]),
|
|
117
116
|
rows: value.rows
|
|
118
117
|
});
|
|
119
118
|
}
|
|
120
119
|
else if (columns?.every(col => typeof col === 'number')) {
|
|
121
|
-
return
|
|
120
|
+
return value.create({
|
|
122
121
|
colnames: value.colnames.widenUp(),
|
|
123
122
|
cols: columns.reduce((current, col) => current.max([col, col]), value.cols),
|
|
124
123
|
rows: value.rows
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
|
-
return
|
|
126
|
+
return value.create({
|
|
128
127
|
colnames: value.colnames.widenUp(),
|
|
129
128
|
cols: value.cols.widenUp(),
|
|
130
129
|
rows: value.rows
|
|
@@ -132,13 +131,13 @@ function applyAssignColsSemantics(value, { columns }) {
|
|
|
132
131
|
}
|
|
133
132
|
function applyAssignRowsSemantics(value, { rows }) {
|
|
134
133
|
if (rows !== undefined) {
|
|
135
|
-
return
|
|
134
|
+
return value.create({
|
|
136
135
|
colnames: value.colnames,
|
|
137
136
|
cols: value.cols,
|
|
138
137
|
rows: rows.reduce((current, row) => current.max([row, row]), value.rows)
|
|
139
138
|
});
|
|
140
139
|
}
|
|
141
|
-
return
|
|
140
|
+
return value.create({
|
|
142
141
|
colnames: value.colnames,
|
|
143
142
|
cols: value.cols,
|
|
144
143
|
rows: value.rows.widenUp()
|
|
@@ -146,21 +145,21 @@ function applyAssignRowsSemantics(value, { rows }) {
|
|
|
146
145
|
}
|
|
147
146
|
function applySetColNamesSemantics(value, { colnames }, options) {
|
|
148
147
|
if (options?.partial) {
|
|
149
|
-
return
|
|
148
|
+
return value.create({
|
|
150
149
|
colnames: value.colnames.widenDown().union(setRange(colnames)),
|
|
151
150
|
cols: value.cols,
|
|
152
151
|
rows: value.rows
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
const allColNames = colnames?.every(assert_1.isNotUndefined) && value.cols.value !== lattice_1.Bottom && colnames.length >= value.cols.value[1];
|
|
156
|
-
return
|
|
155
|
+
return value.create({
|
|
157
156
|
colnames: allColNames ? value.colnames.create(setRange(colnames)) : value.colnames.create(setRange(colnames)).widenUp(),
|
|
158
157
|
cols: value.cols,
|
|
159
158
|
rows: value.rows
|
|
160
159
|
});
|
|
161
160
|
}
|
|
162
161
|
function applyAddColsSemantics(value, { colnames }) {
|
|
163
|
-
return
|
|
162
|
+
return value.create({
|
|
164
163
|
colnames: colnames !== undefined ? value.colnames.union(setRange(colnames)) : value.colnames.widenUp(),
|
|
165
164
|
cols: colnames !== undefined ? value.cols.add([colnames.length, colnames.length]) : value.cols.widenUp(),
|
|
166
165
|
rows: value.rows
|
|
@@ -168,14 +167,13 @@ function applyAddColsSemantics(value, { colnames }) {
|
|
|
168
167
|
}
|
|
169
168
|
function applyAddRowsSemantics(value, { rows }) {
|
|
170
169
|
if (value.cols.value !== lattice_1.Bottom && value.cols.value[0] === 0) {
|
|
171
|
-
return
|
|
172
|
-
...value,
|
|
170
|
+
return value.create({
|
|
173
171
|
colnames: value.colnames.top(),
|
|
174
172
|
cols: rows !== undefined ? value.cols.add([1, 1]) : value.cols.top(),
|
|
175
173
|
rows: rows !== undefined ? value.rows.add([rows, rows]) : value.rows.widenUp()
|
|
176
174
|
});
|
|
177
175
|
}
|
|
178
|
-
return
|
|
176
|
+
return value.create({
|
|
179
177
|
colnames: value.colnames,
|
|
180
178
|
cols: value.cols,
|
|
181
179
|
rows: rows !== undefined ? value.rows.add([rows, rows]) : value.rows.widenUp()
|
|
@@ -183,13 +181,13 @@ function applyAddRowsSemantics(value, { rows }) {
|
|
|
183
181
|
}
|
|
184
182
|
function applyRemoveColsSemantics(value, { colnames }, options) {
|
|
185
183
|
if (options?.maybe) {
|
|
186
|
-
return
|
|
184
|
+
return value.create({
|
|
187
185
|
colnames: colnames !== undefined ? value.colnames.subtract(setRange(colnames)) : value.colnames.widenDown(),
|
|
188
186
|
cols: colnames !== undefined ? value.cols.subtract([colnames.length, 0]) : value.cols.widenDown(),
|
|
189
187
|
rows: value.rows
|
|
190
188
|
});
|
|
191
189
|
}
|
|
192
|
-
return
|
|
190
|
+
return value.create({
|
|
193
191
|
colnames: colnames !== undefined ? value.colnames.subtract(setRange(colnames)) : value.colnames.widenDown(),
|
|
194
192
|
cols: colnames !== undefined ? value.cols.subtract([colnames.length, colnames.length]) : value.cols.widenDown(),
|
|
195
193
|
rows: value.rows
|
|
@@ -197,20 +195,20 @@ function applyRemoveColsSemantics(value, { colnames }, options) {
|
|
|
197
195
|
}
|
|
198
196
|
function applyRemoveRowsSemantics(value, { rows }, options) {
|
|
199
197
|
if (options?.maybe) {
|
|
200
|
-
return
|
|
198
|
+
return value.create({
|
|
201
199
|
colnames: value.colnames,
|
|
202
200
|
cols: value.cols,
|
|
203
201
|
rows: rows !== undefined ? value.rows.subtract([rows, 0]) : value.rows.widenDown()
|
|
204
202
|
});
|
|
205
203
|
}
|
|
206
|
-
return
|
|
204
|
+
return value.create({
|
|
207
205
|
colnames: value.colnames,
|
|
208
206
|
cols: value.cols,
|
|
209
207
|
rows: rows !== undefined ? value.rows.subtract([rows, rows]) : value.rows.widenDown()
|
|
210
208
|
});
|
|
211
209
|
}
|
|
212
210
|
function applyConcatColsSemantics(value, { other }) {
|
|
213
|
-
return
|
|
211
|
+
return value.create({
|
|
214
212
|
colnames: value.colnames.union(other.colnames),
|
|
215
213
|
cols: value.cols.add(other.cols),
|
|
216
214
|
rows: value.rows
|
|
@@ -218,14 +216,13 @@ function applyConcatColsSemantics(value, { other }) {
|
|
|
218
216
|
}
|
|
219
217
|
function applyConcatRowsSemantics(value, { other }) {
|
|
220
218
|
if (value.cols.value !== lattice_1.Bottom && value.cols.value[0] === 0) {
|
|
221
|
-
return
|
|
222
|
-
...value,
|
|
219
|
+
return value.create({
|
|
223
220
|
colnames: value.colnames.join(other.colnames),
|
|
224
221
|
cols: value.cols.join(other.cols),
|
|
225
222
|
rows: value.rows.add(other.rows)
|
|
226
223
|
});
|
|
227
224
|
}
|
|
228
|
-
return
|
|
225
|
+
return value.create({
|
|
229
226
|
colnames: value.colnames,
|
|
230
227
|
cols: value.cols,
|
|
231
228
|
rows: value.rows.add(other.rows)
|
|
@@ -233,20 +230,20 @@ function applyConcatRowsSemantics(value, { other }) {
|
|
|
233
230
|
}
|
|
234
231
|
function applySubsetColsSemantics(value, { colnames }, options) {
|
|
235
232
|
if (options?.duplicateCols) {
|
|
236
|
-
return
|
|
233
|
+
return value.create({
|
|
237
234
|
colnames: value.colnames.top(),
|
|
238
235
|
cols: colnames !== undefined ? value.cols.create([colnames.length, colnames.length]) : value.cols.top(),
|
|
239
236
|
rows: value.rows
|
|
240
237
|
});
|
|
241
238
|
}
|
|
242
239
|
else if (options?.renamedCols) {
|
|
243
|
-
return
|
|
240
|
+
return value.create({
|
|
244
241
|
colnames: value.colnames.top(),
|
|
245
242
|
cols: colnames !== undefined ? value.cols.min([colnames.length, colnames.length]) : value.cols.widenDown(),
|
|
246
243
|
rows: value.rows
|
|
247
244
|
});
|
|
248
245
|
}
|
|
249
|
-
return
|
|
246
|
+
return value.create({
|
|
250
247
|
colnames: colnames !== undefined ? value.colnames.intersect(setRange(colnames)) : value.colnames.widenDown(),
|
|
251
248
|
cols: colnames !== undefined ? value.cols.min([colnames.length, colnames.length]) : value.cols.widenDown(),
|
|
252
249
|
rows: value.rows
|
|
@@ -254,27 +251,27 @@ function applySubsetColsSemantics(value, { colnames }, options) {
|
|
|
254
251
|
}
|
|
255
252
|
function applySubsetRowsSemantics(value, { rows }, options) {
|
|
256
253
|
if (options?.duplicateRows) {
|
|
257
|
-
return
|
|
254
|
+
return value.create({
|
|
258
255
|
colnames: value.colnames,
|
|
259
256
|
cols: value.cols,
|
|
260
257
|
rows: rows !== undefined ? value.rows.create([rows, rows]) : value.rows.top()
|
|
261
258
|
});
|
|
262
259
|
}
|
|
263
|
-
return
|
|
260
|
+
return value.create({
|
|
264
261
|
colnames: value.colnames,
|
|
265
262
|
cols: value.cols,
|
|
266
263
|
rows: rows !== undefined ? value.rows.min([rows, rows]) : value.rows.widenDown()
|
|
267
264
|
});
|
|
268
265
|
}
|
|
269
266
|
function applyFilterRowsSemantics(value, { condition }) {
|
|
270
|
-
return
|
|
267
|
+
return value.create({
|
|
271
268
|
colnames: value.colnames,
|
|
272
269
|
cols: value.cols,
|
|
273
270
|
rows: condition ? value.rows : condition === false ? value.rows.create([0, 0]) : value.rows.widenDown()
|
|
274
271
|
});
|
|
275
272
|
}
|
|
276
273
|
function applyMutateColsSemantics(value, { colnames }) {
|
|
277
|
-
return
|
|
274
|
+
return value.create({
|
|
278
275
|
colnames: colnames !== undefined ? value.colnames.union(setRange(colnames)) : value.colnames.widenUp(),
|
|
279
276
|
cols: colnames !== undefined ? value.cols.add([0, colnames.length]).max([colnames.length, colnames.length]) : value.cols.widenUp(),
|
|
280
277
|
rows: value.rows
|
|
@@ -282,7 +279,7 @@ function applyMutateColsSemantics(value, { colnames }) {
|
|
|
282
279
|
}
|
|
283
280
|
function applyGroupBySemantics(value, { by }, options) {
|
|
284
281
|
if (options?.mutatedCols) {
|
|
285
|
-
return
|
|
282
|
+
return value.create({
|
|
286
283
|
colnames: value.colnames.union(setRange(by)),
|
|
287
284
|
cols: value.cols.add([0, by.length]),
|
|
288
285
|
rows: value.rows
|
|
@@ -292,7 +289,7 @@ function applyGroupBySemantics(value, { by }, options) {
|
|
|
292
289
|
return value;
|
|
293
290
|
}
|
|
294
291
|
function applySummarizeSemantics(value, { colnames }) {
|
|
295
|
-
return
|
|
292
|
+
return value.create({
|
|
296
293
|
colnames: colnames !== undefined ? value.colnames.join(setRange([])).union(setRange(colnames)) : value.colnames.widenUp(),
|
|
297
294
|
cols: colnames !== undefined ? value.cols.add([0, colnames.length]).min([colnames.length, +Infinity]) : value.cols.widenUp(),
|
|
298
295
|
rows: value.rows.min([1, +Infinity]).max([0, 1])
|
|
@@ -360,8 +357,7 @@ function applyJoinSemantics(value, { other, by }, options) {
|
|
|
360
357
|
default:
|
|
361
358
|
(0, assert_1.assertUnreachable)(joinType);
|
|
362
359
|
}
|
|
363
|
-
return
|
|
364
|
-
...value,
|
|
360
|
+
return value.create({
|
|
365
361
|
colnames: duplicateCols === undefined ? value.colnames.top() : duplicateCols.length > 0 ? value.colnames.union(other.colnames).subtract(setRange(duplicateCols)).widenUp() : value.colnames.union(other.colnames),
|
|
366
362
|
cols: by !== undefined ? value.cols.add(other.cols).subtract([by.length, by.length]) : mergeInterval(value.cols, other.cols),
|
|
367
363
|
rows: productRows ? productInterval(rows, value.rows, other.rows) : rows
|
|
@@ -16,7 +16,7 @@ class DataFrameShapeInferenceVisitor extends absint_visitor_1.AbstractInterpreta
|
|
|
16
16
|
*/
|
|
17
17
|
operations;
|
|
18
18
|
constructor({ trackOperations = true, ...config }) {
|
|
19
|
-
super(config);
|
|
19
|
+
super(config, dataframe_domain_1.DataFrameDomain.top());
|
|
20
20
|
if (trackOperations) {
|
|
21
21
|
this.operations = new Map();
|
|
22
22
|
}
|
|
@@ -65,5 +65,6 @@ export declare class IntervalDomain<Value extends IntervalLift = IntervalLift> e
|
|
|
65
65
|
isTop(): this is IntervalDomain<IntervalTop>;
|
|
66
66
|
isBottom(): this is IntervalDomain<IntervalBottom>;
|
|
67
67
|
isValue(): this is IntervalDomain<IntervalValue>;
|
|
68
|
+
isFinite(): this is IntervalDomain<IntervalValue>;
|
|
68
69
|
}
|
|
69
70
|
export {};
|
|
@@ -259,6 +259,9 @@ class IntervalDomain extends abstract_domain_1.AbstractDomain {
|
|
|
259
259
|
isValue() {
|
|
260
260
|
return this.value !== lattice_1.Bottom;
|
|
261
261
|
}
|
|
262
|
+
isFinite() {
|
|
263
|
+
return this.isValue() && Number.isFinite(this.value[0]) && Number.isFinite(this.value[1]);
|
|
264
|
+
}
|
|
262
265
|
}
|
|
263
266
|
exports.IntervalDomain = IntervalDomain;
|
|
264
267
|
//# sourceMappingURL=interval-domain.js.map
|
|
@@ -13,6 +13,7 @@ export type ConcreteProduct<Product extends AbstractProduct> = {
|
|
|
13
13
|
* @template Product - Type of the abstract product of the product domain mapping property names to abstract domains
|
|
14
14
|
*/
|
|
15
15
|
export declare abstract class ProductDomain<Product extends AbstractProduct> extends AbstractDomain<ConcreteProduct<Product>, Product, Product, Product> {
|
|
16
|
+
constructor(value: Product);
|
|
16
17
|
abstract create(value: Product): this;
|
|
17
18
|
bottom(): this;
|
|
18
19
|
top(): this;
|
|
@@ -26,7 +27,15 @@ export declare abstract class ProductDomain<Product extends AbstractProduct> ext
|
|
|
26
27
|
abstract(concrete: ReadonlySet<ConcreteProduct<Product>> | typeof Top): this;
|
|
27
28
|
toJson(): unknown;
|
|
28
29
|
toString(): string;
|
|
30
|
+
isTop(): boolean;
|
|
29
31
|
isTop(): this is this;
|
|
32
|
+
isBottom(): boolean;
|
|
30
33
|
isBottom(): this is this;
|
|
34
|
+
isValue(): boolean;
|
|
31
35
|
isValue(): this is this;
|
|
36
|
+
/**
|
|
37
|
+
* Optional reduction function for a reduced product domain.
|
|
38
|
+
*/
|
|
39
|
+
protected reduce(value: Product): Product;
|
|
40
|
+
private refine;
|
|
32
41
|
}
|