@uwdata/mosaic-sql 0.16.2 → 0.18.0
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/LICENSE +1 -1
- package/README.md +0 -2
- package/dist/src/ast/aggregate.d.ts +82 -0
- package/dist/src/ast/aggregate.d.ts.map +1 -0
- package/dist/src/ast/aggregate.js +180 -0
- package/dist/src/ast/aggregate.js.map +1 -0
- package/dist/src/ast/between-op.d.ts +46 -0
- package/dist/src/ast/between-op.d.ts.map +1 -0
- package/dist/src/ast/between-op.js +60 -0
- package/dist/src/ast/between-op.js.map +1 -0
- package/dist/src/ast/binary-op.d.ts +21 -0
- package/dist/src/ast/binary-op.d.ts.map +1 -0
- package/dist/src/ast/binary-op.js +29 -0
- package/dist/src/ast/binary-op.js.map +1 -0
- package/dist/src/ast/case.d.ts +53 -0
- package/dist/src/ast/case.d.ts.map +1 -0
- package/dist/src/ast/case.js +75 -0
- package/dist/src/ast/case.js.map +1 -0
- package/dist/src/ast/cast.d.ts +18 -0
- package/dist/src/ast/cast.d.ts.map +1 -0
- package/dist/src/ast/cast.js +26 -0
- package/dist/src/ast/cast.js.map +1 -0
- package/dist/src/ast/collate.d.ts +18 -0
- package/dist/src/ast/collate.d.ts.map +1 -0
- package/dist/src/ast/collate.js +25 -0
- package/dist/src/ast/collate.js.map +1 -0
- package/dist/src/ast/column-param.d.ts +23 -0
- package/dist/src/ast/column-param.d.ts.map +1 -0
- package/dist/src/ast/column-param.js +29 -0
- package/dist/src/ast/column-param.js.map +1 -0
- package/dist/src/ast/column-ref.d.ts +40 -0
- package/dist/src/ast/column-ref.d.ts.map +1 -0
- package/dist/src/ast/column-ref.js +58 -0
- package/dist/src/ast/column-ref.js.map +1 -0
- package/dist/src/ast/fragment.d.ts +20 -0
- package/dist/src/ast/fragment.d.ts.map +1 -0
- package/dist/src/ast/fragment.js +26 -0
- package/dist/src/ast/fragment.js.map +1 -0
- package/dist/src/ast/from.d.ts +22 -0
- package/dist/src/ast/from.d.ts.map +1 -0
- package/dist/src/ast/from.js +37 -0
- package/dist/src/ast/from.js.map +1 -0
- package/dist/src/ast/function.d.ts +18 -0
- package/dist/src/ast/function.d.ts.map +1 -0
- package/dist/src/ast/function.js +26 -0
- package/dist/src/ast/function.js.map +1 -0
- package/dist/src/ast/in-op.d.ts +18 -0
- package/dist/src/ast/in-op.d.ts.map +1 -0
- package/dist/src/ast/in-op.js +25 -0
- package/dist/src/ast/in-op.js.map +1 -0
- package/dist/src/ast/interval.d.ts +18 -0
- package/dist/src/ast/interval.d.ts.map +1 -0
- package/dist/src/ast/interval.js +25 -0
- package/dist/src/ast/interval.js.map +1 -0
- package/dist/src/ast/literal.d.ts +16 -0
- package/dist/src/ast/literal.d.ts.map +1 -0
- package/dist/src/ast/literal.js +53 -0
- package/dist/src/ast/literal.js.map +1 -0
- package/dist/src/ast/logical-op.d.ts +32 -0
- package/dist/src/ast/logical-op.d.ts.map +1 -0
- package/dist/src/ast/logical-op.js +46 -0
- package/dist/src/ast/logical-op.js.map +1 -0
- package/dist/src/ast/node.d.ts +25 -0
- package/dist/src/ast/node.d.ts.map +1 -0
- package/dist/src/ast/node.js +36 -0
- package/dist/src/ast/node.js.map +1 -0
- package/dist/src/ast/order-by.d.ts +21 -0
- package/dist/src/ast/order-by.d.ts.map +1 -0
- package/dist/src/ast/order-by.js +36 -0
- package/dist/src/ast/order-by.js.map +1 -0
- package/dist/{types → src}/ast/param.d.ts +11 -11
- package/dist/src/ast/param.d.ts.map +1 -0
- package/dist/src/ast/param.js +28 -0
- package/dist/src/ast/param.js.map +1 -0
- package/dist/src/ast/query.d.ts +294 -0
- package/dist/src/ast/query.d.ts.map +1 -0
- package/dist/src/ast/query.js +584 -0
- package/dist/src/ast/query.js.map +1 -0
- package/dist/src/ast/sample.d.ts +27 -0
- package/dist/src/ast/sample.d.ts.map +1 -0
- package/dist/src/ast/sample.js +38 -0
- package/dist/src/ast/sample.js.map +1 -0
- package/dist/src/ast/select.d.ts +19 -0
- package/dist/src/ast/select.d.ts.map +1 -0
- package/dist/src/ast/select.js +35 -0
- package/dist/src/ast/select.js.map +1 -0
- package/dist/src/ast/subquery.d.ts +16 -0
- package/dist/src/ast/subquery.d.ts.map +1 -0
- package/dist/src/ast/subquery.js +21 -0
- package/dist/src/ast/subquery.js.map +1 -0
- package/dist/src/ast/table-ref.d.ts +24 -0
- package/dist/src/ast/table-ref.d.ts.map +1 -0
- package/dist/src/ast/table-ref.js +35 -0
- package/dist/src/ast/table-ref.js.map +1 -0
- package/dist/src/ast/unary-op.d.ts +40 -0
- package/dist/src/ast/unary-op.d.ts.map +1 -0
- package/dist/src/ast/unary-op.js +52 -0
- package/dist/src/ast/unary-op.js.map +1 -0
- package/dist/src/ast/verbatim.d.ts +18 -0
- package/dist/src/ast/verbatim.d.ts.map +1 -0
- package/dist/src/ast/verbatim.js +25 -0
- package/dist/src/ast/verbatim.js.map +1 -0
- package/dist/src/ast/window-frame.d.ts +54 -0
- package/dist/src/ast/window-frame.d.ts.map +1 -0
- package/dist/src/ast/window-frame.js +79 -0
- package/dist/src/ast/window-frame.js.map +1 -0
- package/dist/src/ast/window.d.ts +128 -0
- package/dist/src/ast/window.d.ts.map +1 -0
- package/dist/src/ast/window.js +194 -0
- package/dist/src/ast/window.js.map +1 -0
- package/dist/{types → src}/ast/with.d.ts +15 -22
- package/dist/src/ast/with.d.ts.map +1 -0
- package/dist/src/ast/with.js +36 -0
- package/dist/src/ast/with.js.map +1 -0
- package/dist/src/constants.d.ts +38 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +38 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/functions/aggregate.d.ts +236 -0
- package/dist/src/functions/aggregate.d.ts.map +1 -0
- package/dist/src/functions/aggregate.js +308 -0
- package/dist/src/functions/aggregate.js.map +1 -0
- package/dist/{types → src}/functions/case.d.ts +7 -7
- package/dist/src/functions/case.d.ts.map +1 -0
- package/dist/src/functions/case.js +17 -0
- package/dist/src/functions/case.js.map +1 -0
- package/dist/src/functions/cast.d.ts +23 -0
- package/dist/src/functions/cast.d.ts.map +1 -0
- package/dist/src/functions/cast.js +32 -0
- package/dist/src/functions/cast.js.map +1 -0
- package/dist/src/functions/collate.d.ts +10 -0
- package/dist/src/functions/collate.d.ts.map +1 -0
- package/dist/src/functions/collate.js +12 -0
- package/dist/src/functions/collate.js.map +1 -0
- package/dist/src/functions/column.d.ts +10 -0
- package/dist/src/functions/column.d.ts.map +1 -0
- package/dist/src/functions/column.js +17 -0
- package/dist/src/functions/column.js.map +1 -0
- package/dist/{types → src}/functions/cte.d.ts +7 -7
- package/dist/src/functions/cte.d.ts.map +1 -0
- package/dist/src/functions/cte.js +14 -0
- package/dist/src/functions/cte.js.map +1 -0
- package/dist/src/functions/datetime.d.ts +32 -0
- package/dist/src/functions/datetime.d.ts.map +1 -0
- package/dist/src/functions/datetime.js +45 -0
- package/dist/src/functions/datetime.js.map +1 -0
- package/dist/src/functions/interval.d.ts +48 -0
- package/dist/src/functions/interval.d.ts.map +1 -0
- package/dist/src/functions/interval.js +66 -0
- package/dist/src/functions/interval.js.map +1 -0
- package/dist/{types → src}/functions/literal.d.ts +8 -8
- package/dist/src/functions/literal.d.ts.map +1 -0
- package/dist/src/functions/literal.js +20 -0
- package/dist/src/functions/literal.js.map +1 -0
- package/dist/src/functions/numeric.d.ts +80 -0
- package/dist/src/functions/numeric.d.ts.map +1 -0
- package/dist/src/functions/numeric.js +110 -0
- package/dist/src/functions/numeric.js.map +1 -0
- package/dist/src/functions/operators.d.ts +169 -0
- package/dist/src/functions/operators.d.ts.map +1 -0
- package/dist/src/functions/operators.js +235 -0
- package/dist/src/functions/operators.js.map +1 -0
- package/dist/src/functions/order-by.d.ts +15 -0
- package/dist/src/functions/order-by.d.ts.map +1 -0
- package/dist/src/functions/order-by.js +19 -0
- package/dist/src/functions/order-by.js.map +1 -0
- package/dist/src/functions/spatial.d.ts +32 -0
- package/dist/src/functions/spatial.d.ts.map +1 -0
- package/dist/src/functions/spatial.js +44 -0
- package/dist/src/functions/spatial.js.map +1 -0
- package/dist/{types → src}/functions/sql-template-tag.d.ts +8 -10
- package/dist/src/functions/sql-template-tag.d.ts.map +1 -0
- package/dist/src/functions/sql-template-tag.js +44 -0
- package/dist/src/functions/sql-template-tag.js.map +1 -0
- package/dist/src/functions/string.d.ts +49 -0
- package/dist/src/functions/string.d.ts.map +1 -0
- package/dist/src/functions/string.js +67 -0
- package/dist/src/functions/string.js.map +1 -0
- package/dist/src/functions/table-ref.d.ts +10 -0
- package/dist/src/functions/table-ref.d.ts.map +1 -0
- package/dist/src/functions/table-ref.js +13 -0
- package/dist/src/functions/table-ref.js.map +1 -0
- package/dist/src/functions/util.d.ts +7 -0
- package/dist/src/functions/util.d.ts.map +1 -0
- package/dist/src/functions/util.js +9 -0
- package/dist/src/functions/util.js.map +1 -0
- package/dist/src/functions/window-frame.d.ts +41 -0
- package/dist/src/functions/window-frame.d.ts.map +1 -0
- package/dist/src/functions/window-frame.js +52 -0
- package/dist/src/functions/window-frame.js.map +1 -0
- package/dist/{types → src}/functions/window.d.ts +24 -39
- package/dist/src/functions/window.d.ts.map +1 -0
- package/dist/src/functions/window.js +96 -0
- package/dist/src/functions/window.js.map +1 -0
- package/dist/src/index.d.ts +69 -0
- package/dist/src/index.d.ts.map +1 -0
- package/{src → dist/src}/index.js +16 -12
- package/dist/src/index.js.map +1 -0
- package/dist/src/load/create.d.ts +10 -0
- package/dist/src/load/create.d.ts.map +1 -0
- package/dist/src/load/create.js +14 -0
- package/dist/src/load/create.js.map +1 -0
- package/dist/src/load/extension.d.ts +2 -0
- package/dist/src/load/extension.d.ts.map +1 -0
- package/dist/src/load/extension.js +4 -0
- package/dist/src/load/extension.js.map +1 -0
- package/dist/src/load/load.d.ts +18 -0
- package/dist/src/load/load.d.ts.map +1 -0
- package/dist/src/load/load.js +80 -0
- package/dist/src/load/load.js.map +1 -0
- package/dist/src/load/sql-from.d.ts +14 -0
- package/dist/src/load/sql-from.d.ts.map +1 -0
- package/dist/src/load/sql-from.js +29 -0
- package/dist/src/load/sql-from.js.map +1 -0
- package/dist/src/transforms/bin-1d.d.ts +16 -0
- package/dist/src/transforms/bin-1d.d.ts.map +1 -0
- package/dist/src/transforms/bin-1d.js +21 -0
- package/dist/src/transforms/bin-1d.js.map +1 -0
- package/dist/src/transforms/bin-2d.d.ts +19 -0
- package/dist/src/transforms/bin-2d.d.ts.map +1 -0
- package/dist/src/transforms/bin-2d.js +27 -0
- package/dist/src/transforms/bin-2d.js.map +1 -0
- package/dist/src/transforms/bin-date.d.ts +31 -0
- package/dist/src/transforms/bin-date.d.ts.map +1 -0
- package/dist/src/transforms/bin-date.js +20 -0
- package/dist/src/transforms/bin-date.js.map +1 -0
- package/dist/src/transforms/bin-histogram.d.ts +37 -0
- package/dist/src/transforms/bin-histogram.d.ts.map +1 -0
- package/dist/src/transforms/bin-histogram.js +32 -0
- package/dist/src/transforms/bin-histogram.js.map +1 -0
- package/dist/src/transforms/bin-linear-1d.d.ts +11 -0
- package/dist/src/transforms/bin-linear-1d.d.ts.map +1 -0
- package/dist/src/transforms/bin-linear-1d.js +25 -0
- package/dist/src/transforms/bin-linear-1d.js.map +1 -0
- package/dist/src/transforms/bin-linear-2d.d.ts +20 -0
- package/dist/src/transforms/bin-linear-2d.d.ts.map +1 -0
- package/dist/src/transforms/bin-linear-2d.js +49 -0
- package/dist/src/transforms/bin-linear-2d.js.map +1 -0
- package/dist/src/transforms/filter-query.d.ts +12 -0
- package/dist/src/transforms/filter-query.d.ts.map +1 -0
- package/dist/src/transforms/filter-query.js +39 -0
- package/dist/src/transforms/filter-query.js.map +1 -0
- package/dist/src/transforms/line-density.d.ts +24 -0
- package/dist/src/transforms/line-density.d.ts.map +1 -0
- package/dist/src/transforms/line-density.js +98 -0
- package/dist/src/transforms/line-density.js.map +1 -0
- package/dist/src/transforms/m4.d.ts +19 -0
- package/dist/src/transforms/m4.d.ts.map +1 -0
- package/dist/src/transforms/m4.js +38 -0
- package/dist/src/transforms/m4.js.map +1 -0
- package/dist/src/transforms/scales.d.ts +30 -0
- package/dist/src/transforms/scales.d.ts.map +1 -0
- package/dist/src/transforms/scales.js +103 -0
- package/dist/src/transforms/scales.js.map +1 -0
- package/dist/src/transforms/util/bin-step.d.ts +50 -0
- package/dist/src/transforms/util/bin-step.d.ts.map +1 -0
- package/dist/src/transforms/util/bin-step.js +53 -0
- package/dist/src/transforms/util/bin-step.js.map +1 -0
- package/dist/src/transforms/util/time-interval.d.ts +14 -0
- package/dist/src/transforms/util/time-interval.d.ts.map +1 -0
- package/dist/src/transforms/util/time-interval.js +88 -0
- package/dist/src/transforms/util/time-interval.js.map +1 -0
- package/dist/{types → src}/types.d.ts +6 -19
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/{types → src}/util/ast.d.ts +26 -25
- package/dist/src/util/ast.d.ts.map +1 -0
- package/{src → dist/src}/util/ast.js +36 -41
- package/dist/src/util/ast.js.map +1 -0
- package/dist/src/util/function.d.ts +56 -0
- package/dist/src/util/function.d.ts.map +1 -0
- package/dist/src/util/function.js +73 -0
- package/dist/src/util/function.js.map +1 -0
- package/dist/src/util/identity.d.ts +6 -0
- package/dist/src/util/identity.d.ts.map +1 -0
- package/dist/src/util/identity.js +8 -0
- package/dist/src/util/identity.js.map +1 -0
- package/dist/src/util/string.d.ts +4 -0
- package/dist/src/util/string.d.ts.map +1 -0
- package/dist/src/util/string.js +14 -0
- package/dist/src/util/string.js.map +1 -0
- package/dist/src/util/type-check.d.ts +17 -0
- package/dist/src/util/type-check.d.ts.map +1 -0
- package/dist/src/util/type-check.js +28 -0
- package/dist/src/util/type-check.js.map +1 -0
- package/dist/src/visit/clone.d.ts +7 -0
- package/dist/src/visit/clone.d.ts.map +1 -0
- package/dist/src/visit/clone.js +52 -0
- package/dist/src/visit/clone.js.map +1 -0
- package/dist/src/visit/recurse.d.ts +2 -0
- package/dist/src/visit/recurse.d.ts.map +1 -0
- package/dist/src/visit/recurse.js +36 -0
- package/dist/src/visit/recurse.js.map +1 -0
- package/dist/src/visit/rewrite.d.ts +9 -0
- package/dist/src/visit/rewrite.d.ts.map +1 -0
- package/dist/src/visit/rewrite.js +39 -0
- package/dist/src/visit/rewrite.js.map +1 -0
- package/dist/{types → src}/visit/visitors.d.ts +14 -16
- package/dist/src/visit/visitors.d.ts.map +1 -0
- package/dist/src/visit/visitors.js +95 -0
- package/dist/src/visit/visitors.js.map +1 -0
- package/dist/src/visit/walk.d.ts +21 -0
- package/dist/src/visit/walk.d.ts.map +1 -0
- package/dist/src/visit/walk.js +32 -0
- package/dist/src/visit/walk.js.map +1 -0
- package/package.json +12 -10
- package/src/ast/aggregate.ts +198 -0
- package/src/ast/{between-op.js → between-op.ts} +19 -26
- package/src/ast/binary-op.ts +31 -0
- package/src/ast/{case.js → case.ts} +29 -44
- package/src/ast/{cast.js → cast.ts} +8 -14
- package/src/ast/collate.ts +27 -0
- package/src/ast/column-param.ts +34 -0
- package/src/ast/{column-ref.js → column-ref.ts} +16 -25
- package/src/ast/fragment.ts +28 -0
- package/src/ast/from.ts +40 -0
- package/src/ast/{function.js → function.ts} +8 -14
- package/src/ast/{in-op.js → in-op.ts} +8 -14
- package/src/ast/{interval.js → interval.ts} +8 -14
- package/src/ast/{literal.js → literal.ts} +6 -9
- package/src/ast/logical-op.ts +50 -0
- package/src/ast/node.ts +39 -0
- package/src/ast/order-by.ts +38 -0
- package/src/ast/{param.js → param.ts} +6 -12
- package/src/ast/{query.js → query.ts} +193 -205
- package/src/ast/sample.ts +47 -0
- package/src/ast/{select.js → select.ts} +10 -16
- package/src/ast/subquery.ts +24 -0
- package/src/ast/{table-ref.js → table-ref.ts} +7 -12
- package/src/ast/{unary-op.js → unary-op.ts} +16 -23
- package/src/ast/{verbatim.js → verbatim.ts} +9 -8
- package/src/ast/window-frame.ts +97 -0
- package/src/ast/window.ts +246 -0
- package/src/ast/{with.js → with.ts} +19 -20
- package/src/{constants.js → constants.ts} +5 -6
- package/src/functions/aggregate.ts +344 -0
- package/src/functions/{case.js → case.ts} +5 -8
- package/src/functions/{cast.js → cast.ts} +9 -13
- package/src/functions/collate.ts +13 -0
- package/src/functions/{column.js → column.ts} +9 -10
- package/src/functions/{cte.js → cte.ts} +9 -6
- package/src/functions/datetime.ts +50 -0
- package/src/functions/interval.ts +74 -0
- package/src/functions/{literal.js → literal.ts} +6 -7
- package/src/functions/numeric.ts +125 -0
- package/src/functions/operators.ts +272 -0
- package/src/functions/order-by.ts +21 -0
- package/src/functions/spatial.ts +50 -0
- package/src/functions/{sql-template-tag.js → sql-template-tag.ts} +16 -13
- package/src/functions/string.ts +79 -0
- package/src/functions/{table-ref.js → table-ref.ts} +4 -4
- package/src/functions/util.ts +10 -0
- package/src/functions/window-frame.ts +58 -0
- package/src/functions/{window.js → window.ts} +18 -35
- package/src/index.ts +75 -0
- package/src/load/{create.js → create.ts} +9 -3
- package/src/load/extension.ts +3 -0
- package/src/load/{load.js → load.ts} +26 -11
- package/src/load/{sql-from.js → sql-from.ts} +14 -7
- package/src/transforms/{bin-1d.js → bin-1d.ts} +13 -9
- package/src/transforms/{bin-2d.js → bin-2d.ts} +17 -13
- package/src/transforms/bin-date.ts +48 -0
- package/src/transforms/bin-histogram.ts +61 -0
- package/src/transforms/{bin-linear-1d.js → bin-linear-1d.ts} +16 -11
- package/src/transforms/{bin-linear-2d.js → bin-linear-2d.ts} +23 -35
- package/src/transforms/filter-query.ts +40 -0
- package/src/transforms/{line-density.js → line-density.ts} +19 -17
- package/src/transforms/{m4.js → m4.ts} +17 -14
- package/src/transforms/{scales.js → scales.ts} +57 -14
- package/src/transforms/util/bin-step.ts +100 -0
- package/src/transforms/util/{time-interval.js → time-interval.ts} +32 -21
- package/src/types.ts +5 -30
- package/src/util/ast.ts +104 -0
- package/src/util/{function.js → function.ts} +40 -31
- package/src/util/identity.ts +7 -0
- package/src/util/{string.js → string.ts} +4 -4
- package/src/util/type-check.ts +31 -0
- package/src/visit/clone.ts +53 -0
- package/src/visit/{recurse.js → recurse.ts} +18 -6
- package/src/visit/{rewrite.js → rewrite.ts} +10 -18
- package/src/visit/{visitors.js → visitors.ts} +22 -30
- package/src/visit/walk.ts +46 -0
- package/dist/types/ast/aggregate.d.ts +0 -71
- package/dist/types/ast/between-op.d.ts +0 -46
- package/dist/types/ast/binary-op.d.ts +0 -28
- package/dist/types/ast/case.d.ts +0 -67
- package/dist/types/ast/cast.d.ts +0 -21
- package/dist/types/ast/column-param.d.ts +0 -23
- package/dist/types/ast/column-ref.d.ts +0 -40
- package/dist/types/ast/fragment.d.ts +0 -14
- package/dist/types/ast/from.d.ts +0 -21
- package/dist/types/ast/function.d.ts +0 -21
- package/dist/types/ast/in-op.d.ts +0 -21
- package/dist/types/ast/interval.d.ts +0 -21
- package/dist/types/ast/literal.d.ts +0 -15
- package/dist/types/ast/logical-op.d.ts +0 -46
- package/dist/types/ast/node.d.ts +0 -24
- package/dist/types/ast/order-by.d.ts +0 -29
- package/dist/types/ast/query.d.ts +0 -320
- package/dist/types/ast/sample.d.ts +0 -42
- package/dist/types/ast/select.d.ts +0 -22
- package/dist/types/ast/table-ref.d.ts +0 -25
- package/dist/types/ast/unary-op.d.ts +0 -39
- package/dist/types/ast/verbatim.d.ts +0 -9
- package/dist/types/ast/window.d.ts +0 -180
- package/dist/types/constants.d.ts +0 -38
- package/dist/types/functions/aggregate.d.ts +0 -236
- package/dist/types/functions/cast.d.ts +0 -26
- package/dist/types/functions/column.d.ts +0 -11
- package/dist/types/functions/datetime.d.ts +0 -45
- package/dist/types/functions/numeric.d.ts +0 -95
- package/dist/types/functions/operators.d.ts +0 -200
- package/dist/types/functions/order-by.d.ts +0 -18
- package/dist/types/functions/spatial.d.ts +0 -38
- package/dist/types/functions/string.d.ts +0 -57
- package/dist/types/functions/table-ref.d.ts +0 -9
- package/dist/types/functions/util.d.ts +0 -8
- package/dist/types/index-types.d.ts +0 -2
- package/dist/types/index.d.ts +0 -59
- package/dist/types/load/create.d.ts +0 -8
- package/dist/types/load/extension.d.ts +0 -1
- package/dist/types/load/load.d.ts +0 -12
- package/dist/types/load/sql-from.d.ts +0 -11
- package/dist/types/transforms/bin-1d.d.ts +0 -15
- package/dist/types/transforms/bin-2d.d.ts +0 -19
- package/dist/types/transforms/bin-date.d.ts +0 -44
- package/dist/types/transforms/bin-histogram.d.ts +0 -51
- package/dist/types/transforms/bin-linear-1d.d.ts +0 -12
- package/dist/types/transforms/bin-linear-2d.d.ts +0 -19
- package/dist/types/transforms/line-density.d.ts +0 -24
- package/dist/types/transforms/m4.d.ts +0 -21
- package/dist/types/transforms/scales.d.ts +0 -1
- package/dist/types/transforms/util/bin-step.d.ts +0 -61
- package/dist/types/transforms/util/time-interval.d.ts +0 -13
- package/dist/types/util/function.d.ts +0 -56
- package/dist/types/util/string.d.ts +0 -3
- package/dist/types/util/type-check.d.ts +0 -22
- package/dist/types/visit/recurse.d.ts +0 -28
- package/dist/types/visit/rewrite.d.ts +0 -10
- package/dist/types/visit/walk.d.ts +0 -10
- package/jsconfig.json +0 -11
- package/src/ast/aggregate.js +0 -167
- package/src/ast/binary-op.js +0 -40
- package/src/ast/column-param.js +0 -40
- package/src/ast/fragment.js +0 -26
- package/src/ast/from.js +0 -40
- package/src/ast/logical-op.js +0 -67
- package/src/ast/node.js +0 -29
- package/src/ast/order-by.js +0 -48
- package/src/ast/sample.js +0 -53
- package/src/ast/window.js +0 -294
- package/src/functions/aggregate.js +0 -347
- package/src/functions/datetime.js +0 -68
- package/src/functions/numeric.js +0 -143
- package/src/functions/operators.js +0 -301
- package/src/functions/order-by.js +0 -27
- package/src/functions/spatial.js +0 -59
- package/src/functions/string.js +0 -85
- package/src/functions/util.js +0 -14
- package/src/index-types.ts +0 -2
- package/src/load/extension.js +0 -3
- package/src/transforms/bin-date.js +0 -37
- package/src/transforms/bin-histogram.js +0 -52
- package/src/transforms/util/bin-step.js +0 -79
- package/src/util/type-check.js +0 -33
- package/src/visit/walk.js +0 -35
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -3
package/src/ast/aggregate.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ExprVarArgs } from '../types.js'
|
|
3
|
-
*/
|
|
4
|
-
import { AGGREGATE } from '../constants.js';
|
|
5
|
-
import { asVerbatim } from '../util/ast.js';
|
|
6
|
-
import { isString } from '../util/type-check.js';
|
|
7
|
-
import { ExprNode } from './node.js';
|
|
8
|
-
import { WindowNode } from './window.js';
|
|
9
|
-
|
|
10
|
-
export class AggregateNode extends ExprNode {
|
|
11
|
-
/**
|
|
12
|
-
* Instantiate an aggregate function node.
|
|
13
|
-
* @param {string} name The aggregate function name.
|
|
14
|
-
* @param {ExprNode[]} args The aggregate function arguments.
|
|
15
|
-
* @param {boolean} [distinct] The distinct flag.
|
|
16
|
-
* @param {ExprNode} [filter] Filter expression.
|
|
17
|
-
*/
|
|
18
|
-
constructor(name, args, distinct, filter) {
|
|
19
|
-
super(AGGREGATE);
|
|
20
|
-
/**
|
|
21
|
-
* The aggregate function name.
|
|
22
|
-
* @type {string}
|
|
23
|
-
* @readonly
|
|
24
|
-
*/
|
|
25
|
-
this.name = name;
|
|
26
|
-
/**
|
|
27
|
-
* The aggregate function arguments.
|
|
28
|
-
* @type {ExprNode[]}
|
|
29
|
-
* @readonly
|
|
30
|
-
*/
|
|
31
|
-
this.args = args;
|
|
32
|
-
/**
|
|
33
|
-
* The distinct flag.
|
|
34
|
-
* @type {boolean}
|
|
35
|
-
* @readonly
|
|
36
|
-
*/
|
|
37
|
-
this.isDistinct = distinct;
|
|
38
|
-
/**
|
|
39
|
-
* Filter criteria.
|
|
40
|
-
* @type {ExprNode}
|
|
41
|
-
* @readonly
|
|
42
|
-
*/
|
|
43
|
-
this.filter = filter;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Return a new derived aggregate over distinct values.
|
|
48
|
-
* @param {boolean} [isDistinct=true] The distinct flag.
|
|
49
|
-
* @returns {AggregateNode} A new aggregate node.
|
|
50
|
-
*/
|
|
51
|
-
distinct(isDistinct = true) {
|
|
52
|
-
return new AggregateNode(this.name, this.args, isDistinct, this.filter);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Return a new derived aggregate function that filters values.
|
|
57
|
-
* @param {ExprNode | string} filter The filter expression.
|
|
58
|
-
* @returns {AggregateNode} A new aggregate node.
|
|
59
|
-
*/
|
|
60
|
-
where(filter) {
|
|
61
|
-
if (isString(filter)) filter = asVerbatim(filter);
|
|
62
|
-
return new AggregateNode(this.name, this.args, this.isDistinct, filter);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Return a new window function over this aggregate.
|
|
67
|
-
* @returns {WindowNode} A new window node.
|
|
68
|
-
*/
|
|
69
|
-
window() {
|
|
70
|
-
return new WindowNode(this);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Return a new window function over this aggregate with the given partitions.
|
|
75
|
-
* @param {...ExprVarArgs} expr The partition by criteria.
|
|
76
|
-
* @returns {WindowNode} A new window node.
|
|
77
|
-
*/
|
|
78
|
-
partitionby(...expr) {
|
|
79
|
-
return this.window().partitionby(...expr);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Return a new window function over this aggregate with the given ordering.
|
|
84
|
-
* @param {...ExprVarArgs} expr The order by criteria.
|
|
85
|
-
* @returns {WindowNode} A new window node.
|
|
86
|
-
*/
|
|
87
|
-
orderby(...expr) {
|
|
88
|
-
return this.window().orderby(...expr);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Generate a SQL query string for this node.
|
|
93
|
-
* @returns {string}
|
|
94
|
-
*/
|
|
95
|
-
toString() {
|
|
96
|
-
const { name, args, isDistinct, filter } = this;
|
|
97
|
-
const dist = isDistinct ? 'DISTINCT ' : '';
|
|
98
|
-
const arg = args?.length ? args.join(', ') : '*';
|
|
99
|
-
const filt = filter ? ` FILTER (WHERE ${filter})` : '';
|
|
100
|
-
return `${name}(${dist}${arg})${filt}`;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* An array of known aggregate function names.
|
|
106
|
-
* From https://duckdb.org/docs/sql/functions/aggregates.html.
|
|
107
|
-
*/
|
|
108
|
-
export const aggregateNames = [
|
|
109
|
-
'any_value',
|
|
110
|
-
'approx_count_distinct',
|
|
111
|
-
'approx_quantile',
|
|
112
|
-
'arbitrary',
|
|
113
|
-
'arg_max',
|
|
114
|
-
'arg_max_null',
|
|
115
|
-
'arg_min',
|
|
116
|
-
'arg_min_null',
|
|
117
|
-
'array_agg',
|
|
118
|
-
'avg',
|
|
119
|
-
'bit_and',
|
|
120
|
-
'bit_or',
|
|
121
|
-
'bit_xor',
|
|
122
|
-
'bitstring_agg',
|
|
123
|
-
'bool_and',
|
|
124
|
-
'bool_or',
|
|
125
|
-
'corr',
|
|
126
|
-
'count',
|
|
127
|
-
'covar_pop',
|
|
128
|
-
'covar_samp',
|
|
129
|
-
'entropy',
|
|
130
|
-
'favg',
|
|
131
|
-
'first',
|
|
132
|
-
'fsum',
|
|
133
|
-
'geomean',
|
|
134
|
-
'kurtosis_pop',
|
|
135
|
-
'kurtosis',
|
|
136
|
-
'last',
|
|
137
|
-
'mad',
|
|
138
|
-
'max',
|
|
139
|
-
'max_by',
|
|
140
|
-
'median',
|
|
141
|
-
'min',
|
|
142
|
-
'min_by',
|
|
143
|
-
'mode',
|
|
144
|
-
'product',
|
|
145
|
-
'quantile',
|
|
146
|
-
'quantile_cont',
|
|
147
|
-
'quantile_disc',
|
|
148
|
-
'regr_avgx',
|
|
149
|
-
'regr_avgy',
|
|
150
|
-
'regr_count',
|
|
151
|
-
'regr_intercept',
|
|
152
|
-
'regr_r2',
|
|
153
|
-
'regr_sxx',
|
|
154
|
-
'regr_sxy',
|
|
155
|
-
'regr_syy',
|
|
156
|
-
'regr_slope',
|
|
157
|
-
'reservoir_quantile',
|
|
158
|
-
'skewness',
|
|
159
|
-
'stddev',
|
|
160
|
-
'stddev_pop',
|
|
161
|
-
'stddev_samp',
|
|
162
|
-
'string_agg',
|
|
163
|
-
'sum',
|
|
164
|
-
'variance',
|
|
165
|
-
'var_pop',
|
|
166
|
-
'var_samp'
|
|
167
|
-
];
|
package/src/ast/binary-op.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { BINARY_OPERATOR } from '../constants.js';
|
|
2
|
-
import { ExprNode } from './node.js';
|
|
3
|
-
|
|
4
|
-
export class BinaryOpNode extends ExprNode {
|
|
5
|
-
/**
|
|
6
|
-
* Instantiate a binary operator node.
|
|
7
|
-
* @param {string} op The operator type.
|
|
8
|
-
* @param {ExprNode} left The left input expression.
|
|
9
|
-
* @param {ExprNode} right The right input expression.
|
|
10
|
-
*/
|
|
11
|
-
constructor(op, left, right) {
|
|
12
|
-
super(BINARY_OPERATOR);
|
|
13
|
-
/**
|
|
14
|
-
* The operator type.
|
|
15
|
-
* @type {string}
|
|
16
|
-
* @readonly
|
|
17
|
-
*/
|
|
18
|
-
this.op = op;
|
|
19
|
-
/**
|
|
20
|
-
* The left input expression.
|
|
21
|
-
* @type {ExprNode}
|
|
22
|
-
* @readonly
|
|
23
|
-
*/
|
|
24
|
-
this.left = left;
|
|
25
|
-
/**
|
|
26
|
-
* The right input expression.
|
|
27
|
-
* @type {ExprNode}
|
|
28
|
-
* @readonly
|
|
29
|
-
*/
|
|
30
|
-
this.right = right;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Generate a SQL query string for this node.
|
|
35
|
-
* @returns {string}
|
|
36
|
-
*/
|
|
37
|
-
toString() {
|
|
38
|
-
return `(${this.left} ${this.op} ${this.right})`;
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/ast/column-param.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ParamNode } from './param.js'
|
|
3
|
-
* @import { TableRefNode } from './table-ref.js'
|
|
4
|
-
*/
|
|
5
|
-
import { COLUMN_PARAM } from '../constants.js';
|
|
6
|
-
import { ColumnRefNode } from './column-ref.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Check if a value is a dynamic column reference node.
|
|
10
|
-
* @param {*} value The value to check.
|
|
11
|
-
* @returns {value is ColumnParamNode}
|
|
12
|
-
*/
|
|
13
|
-
export function isColumnParam(value) {
|
|
14
|
-
return value instanceof ColumnParamNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class ColumnParamNode extends ColumnRefNode {
|
|
18
|
-
/**
|
|
19
|
-
* Instantiate a column param node.
|
|
20
|
-
* @param {ParamNode} param The column name as a parameter node.
|
|
21
|
-
* @param {TableRefNode} [table] The table reference.
|
|
22
|
-
*/
|
|
23
|
-
constructor(param, table) {
|
|
24
|
-
super(COLUMN_PARAM, table);
|
|
25
|
-
/**
|
|
26
|
-
* The column name as a parameter node.
|
|
27
|
-
* @type {ParamNode}
|
|
28
|
-
* @readonly
|
|
29
|
-
*/
|
|
30
|
-
this.param = param;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Returns the column name.
|
|
35
|
-
* @returns {string}
|
|
36
|
-
*/
|
|
37
|
-
get column() {
|
|
38
|
-
return `${this.param.value}`;
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/ast/fragment.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FRAGMENT } from '../constants.js';
|
|
2
|
-
import { ExprNode } from './node.js';
|
|
3
|
-
|
|
4
|
-
export class FragmentNode extends ExprNode {
|
|
5
|
-
/**
|
|
6
|
-
* Instantiate a fragment node with arbitrary content.
|
|
7
|
-
* @param {ExprNode[]} spans The consecutive parts making up the fragment.
|
|
8
|
-
*/
|
|
9
|
-
constructor(spans) {
|
|
10
|
-
super(FRAGMENT);
|
|
11
|
-
/**
|
|
12
|
-
* The consecutive parts making up the fragment.
|
|
13
|
-
* @type {ExprNode[]}
|
|
14
|
-
* @readonly
|
|
15
|
-
*/
|
|
16
|
-
this.spans = spans;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Generate a SQL query string for this node.
|
|
21
|
-
* @returns {string}
|
|
22
|
-
*/
|
|
23
|
-
toString() {
|
|
24
|
-
return this.spans.join('');
|
|
25
|
-
}
|
|
26
|
-
}
|
package/src/ast/from.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { FROM_CLAUSE } from '../constants.js';
|
|
2
|
-
import { quoteIdentifier } from '../util/string.js';
|
|
3
|
-
import { SQLNode } from './node.js';
|
|
4
|
-
import { isQuery } from './query.js';
|
|
5
|
-
import { isTableRef } from './table-ref.js';
|
|
6
|
-
|
|
7
|
-
export class FromClauseNode extends SQLNode {
|
|
8
|
-
/**
|
|
9
|
-
* Instantiate a from node.
|
|
10
|
-
* @param {SQLNode} expr The from expression.
|
|
11
|
-
* @param {string} alias The output name.
|
|
12
|
-
*/
|
|
13
|
-
constructor(expr, alias) {
|
|
14
|
-
super(FROM_CLAUSE);
|
|
15
|
-
/**
|
|
16
|
-
* The from expression.
|
|
17
|
-
* @type {SQLNode}
|
|
18
|
-
* @readonly
|
|
19
|
-
*/
|
|
20
|
-
this.expr = expr;
|
|
21
|
-
/**
|
|
22
|
-
* The output name.
|
|
23
|
-
* @type {string}
|
|
24
|
-
* @readonly
|
|
25
|
-
*/
|
|
26
|
-
this.alias = alias;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Generate a SQL query string for this node.
|
|
31
|
-
* @returns {string}
|
|
32
|
-
*/
|
|
33
|
-
toString() {
|
|
34
|
-
const { expr, alias } = this;
|
|
35
|
-
const ref = isQuery(expr) ? `(${expr})` : `${expr}`;
|
|
36
|
-
return alias && !(isTableRef(expr) && expr.table.join('.') === alias)
|
|
37
|
-
? `${ref} AS ${quoteIdentifier(alias)}`
|
|
38
|
-
: `${ref}`;
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/ast/logical-op.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { LOGICAL_OPERATOR } from '../constants.js';
|
|
2
|
-
import { ExprNode } from './node.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @template {ExprNode} T
|
|
6
|
-
*/
|
|
7
|
-
export class LogicalOpNode extends ExprNode {
|
|
8
|
-
/**
|
|
9
|
-
* Instantiate a logical operator node.
|
|
10
|
-
* @param {string} op The logical operation.
|
|
11
|
-
* @param {T[]} clauses The input clause expressions.
|
|
12
|
-
*/
|
|
13
|
-
constructor(op, clauses) {
|
|
14
|
-
super(LOGICAL_OPERATOR);
|
|
15
|
-
/**
|
|
16
|
-
* The logical operator.
|
|
17
|
-
* @type {string}
|
|
18
|
-
* @readonly
|
|
19
|
-
*/
|
|
20
|
-
this.op = op;
|
|
21
|
-
/**
|
|
22
|
-
* The input clause expressions.
|
|
23
|
-
* @type {T[]}
|
|
24
|
-
* @readonly
|
|
25
|
-
*/
|
|
26
|
-
this.clauses = clauses;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Generate a SQL query string for this node.
|
|
31
|
-
* @returns {string}
|
|
32
|
-
*/
|
|
33
|
-
toString() {
|
|
34
|
-
const c = this.clauses;
|
|
35
|
-
return c.length === 0 ? ''
|
|
36
|
-
: c.length === 1 ? `${c[0]}`
|
|
37
|
-
: `(${c.join(` ${this.op} `)})`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @template {ExprNode} T
|
|
43
|
-
* @extends {LogicalOpNode<T>}
|
|
44
|
-
*/
|
|
45
|
-
export class AndNode extends LogicalOpNode {
|
|
46
|
-
/**
|
|
47
|
-
* Instantiate a logical AND operator node.
|
|
48
|
-
* @param {T[]} clauses The input clause expressions.
|
|
49
|
-
*/
|
|
50
|
-
constructor(clauses) {
|
|
51
|
-
super('AND', clauses);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @template {ExprNode} T
|
|
57
|
-
* @extends {LogicalOpNode<T>}
|
|
58
|
-
*/
|
|
59
|
-
export class OrNode extends LogicalOpNode {
|
|
60
|
-
/**
|
|
61
|
-
* Instantiate a logical OR operator node.
|
|
62
|
-
* @param {T[]} clauses The input clause expressions.
|
|
63
|
-
*/
|
|
64
|
-
constructor(clauses) {
|
|
65
|
-
super('OR', clauses);
|
|
66
|
-
}
|
|
67
|
-
}
|
package/src/ast/node.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if a value is a SQL AST node.
|
|
3
|
-
* @param {*} value The value to check.
|
|
4
|
-
* @returns {value is SQLNode}
|
|
5
|
-
*/
|
|
6
|
-
export function isNode(value) {
|
|
7
|
-
return value instanceof SQLNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class SQLNode {
|
|
11
|
-
/**
|
|
12
|
-
* Instantiate a SQL AST node.
|
|
13
|
-
* @param {string} type The SQL AST node type.
|
|
14
|
-
*/
|
|
15
|
-
constructor(type) {
|
|
16
|
-
/**
|
|
17
|
-
* The SQL AST node type.
|
|
18
|
-
* @type {string}
|
|
19
|
-
* @readonly
|
|
20
|
-
*/
|
|
21
|
-
this.type = type;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* AST node corresponding to an individual expression.
|
|
27
|
-
*/
|
|
28
|
-
export class ExprNode extends SQLNode {
|
|
29
|
-
}
|
package/src/ast/order-by.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ORDER_BY } from '../constants.js';
|
|
2
|
-
import { ExprNode } from './node.js';
|
|
3
|
-
|
|
4
|
-
export class OrderByNode extends ExprNode {
|
|
5
|
-
/**
|
|
6
|
-
* Instantiate an order by entry node.
|
|
7
|
-
* @param {ExprNode} expr The expression to order by.
|
|
8
|
-
* @param {boolean | undefined} [desc] Flag indicating descending order.
|
|
9
|
-
* @param {boolean | undefined} [nullsFirst] Flag indicating if null
|
|
10
|
-
* values should be sorted first.
|
|
11
|
-
*/
|
|
12
|
-
constructor(expr, desc, nullsFirst) {
|
|
13
|
-
super(ORDER_BY);
|
|
14
|
-
/**
|
|
15
|
-
* The expression to order by.
|
|
16
|
-
* @type {ExprNode}
|
|
17
|
-
* @readonly
|
|
18
|
-
*/
|
|
19
|
-
this.expr = expr;
|
|
20
|
-
/**
|
|
21
|
-
* Flag indicating descending order.
|
|
22
|
-
* @type {boolean | undefined}
|
|
23
|
-
* @readonly
|
|
24
|
-
*/
|
|
25
|
-
this.desc = desc;
|
|
26
|
-
/**
|
|
27
|
-
* Flag indicating if null values should be sorted first.
|
|
28
|
-
* @type {boolean | undefined}
|
|
29
|
-
* @readonly
|
|
30
|
-
*/
|
|
31
|
-
this.nullsFirst = nullsFirst;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Generate a SQL query string for this node.
|
|
36
|
-
* @returns {string}
|
|
37
|
-
*/
|
|
38
|
-
toString() {
|
|
39
|
-
const { expr, desc, nullsFirst } = this;
|
|
40
|
-
const dir = desc ? ' DESC'
|
|
41
|
-
: desc === false ? ' ASC'
|
|
42
|
-
: '';
|
|
43
|
-
const nf = nullsFirst ? ' NULLS FIRST'
|
|
44
|
-
: nullsFirst === false ? ' NULLS LAST'
|
|
45
|
-
: '';
|
|
46
|
-
return `${expr}${dir}${nf}`;
|
|
47
|
-
}
|
|
48
|
-
}
|
package/src/ast/sample.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { SAMPLE_CLAUSE } from '../constants.js';
|
|
2
|
-
import { SQLNode } from './node.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {'reservoir' | 'bernoulli' | 'system'} SampleMethod
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export class SampleClauseNode extends SQLNode {
|
|
9
|
-
/**
|
|
10
|
-
* Instantiate a sample clause node.
|
|
11
|
-
* @param {number} size The sample size as either a row count or percentage.
|
|
12
|
-
* @param {boolean} [perc=false] Flag indicating if the sampling unit is
|
|
13
|
-
* rows (`false`) or a percentage (`true`).
|
|
14
|
-
* @param {SampleMethod} [method] The sampling method. If unspecified,
|
|
15
|
-
* a default method is applied based on the sampling unit.
|
|
16
|
-
* @param {number} [seed] The random seed.
|
|
17
|
-
*/
|
|
18
|
-
constructor(size, perc = false, method = undefined, seed = undefined) {
|
|
19
|
-
super(SAMPLE_CLAUSE);
|
|
20
|
-
/**
|
|
21
|
-
* The sample size as either a row count or percentage.
|
|
22
|
-
* @type {number}
|
|
23
|
-
* @readonly
|
|
24
|
-
*/
|
|
25
|
-
this.size = size;
|
|
26
|
-
/**
|
|
27
|
-
* Flag indicating if the sampling unit is rows (`false`) or a
|
|
28
|
-
* percentage (`true`).
|
|
29
|
-
* @type {boolean}
|
|
30
|
-
* @readonly
|
|
31
|
-
*/
|
|
32
|
-
this.perc = perc;
|
|
33
|
-
/**
|
|
34
|
-
* The sampling method.
|
|
35
|
-
* @type {SampleMethod}
|
|
36
|
-
* @readonly
|
|
37
|
-
*/
|
|
38
|
-
this.method = method;
|
|
39
|
-
/**
|
|
40
|
-
* The random seed.
|
|
41
|
-
* @type {number}
|
|
42
|
-
* @readonly
|
|
43
|
-
*/
|
|
44
|
-
this.seed = seed;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
toString() {
|
|
48
|
-
const { size, perc, method, seed } = this;
|
|
49
|
-
const unit = perc ? '%' : ' ROWS';
|
|
50
|
-
const s = seed != null ? `, ${seed}` : '';
|
|
51
|
-
return `${size}${unit}${method ? ` (${method}${s})` : ''}`;
|
|
52
|
-
}
|
|
53
|
-
}
|