Skip to content

Commit 2421b0d

Browse files
committed
Merge branch 'main' into feat/pinned-headers
2 parents 0f607b7 + bb1013f commit 2421b0d

37 files changed

+569
-215
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"useNx": false,
4-
"version": "0.0.104",
4+
"version": "0.0.105",
55
"command": {
66
"version": {
77
"allowBranch": "main"

package-lock.json

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/malloy-db-bigquery/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/db-bigquery",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -25,8 +25,8 @@
2525
"@google-cloud/bigquery": "^7.3.0",
2626
"@google-cloud/common": "^5.0.1",
2727
"@google-cloud/paginator": "^5.0.0",
28-
"@malloydata/malloy": "^0.0.104",
29-
"@malloydata/malloy-interfaces": "^0.0.104",
28+
"@malloydata/malloy": "^0.0.105",
29+
"@malloydata/malloy-interfaces": "^0.0.105",
3030
"gaxios": "^4.2.0"
3131
}
3232
}

packages/malloy-db-duckdb/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/db-duckdb",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -41,8 +41,8 @@
4141
},
4242
"dependencies": {
4343
"@malloydata/duckdb-wasm": "0.0.6",
44-
"@malloydata/malloy": "^0.0.104",
45-
"@malloydata/malloy-interfaces": "^0.0.104",
44+
"@malloydata/malloy": "^0.0.105",
45+
"@malloydata/malloy-interfaces": "^0.0.105",
4646
"apache-arrow": "^13.0.0",
4747
"duckdb": "0.9.2",
4848
"web-worker": "^1.2.0"

packages/malloy-db-postgres/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/db-postgres",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -22,8 +22,8 @@
2222
"prepublishOnly": "npm run build"
2323
},
2424
"dependencies": {
25-
"@malloydata/malloy": "^0.0.104",
26-
"@malloydata/malloy-interfaces": "^0.0.104",
25+
"@malloydata/malloy": "^0.0.105",
26+
"@malloydata/malloy-interfaces": "^0.0.105",
2727
"@types/pg": "^8.6.1",
2828
"pg": "^8.7.1",
2929
"pg-query-stream": "4.2.3"

packages/malloy-interfaces/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/malloy-interfaces",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/malloy-lint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/eslint-plugin-lint",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/malloy-malloy-sql/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/malloy-sql",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
2424
"prepublishOnly": "npm run build"
2525
},
2626
"dependencies": {
27-
"@malloydata/malloy": "^0.0.104"
27+
"@malloydata/malloy": "^0.0.105"
2828
},
2929
"devDependencies": {
3030
"peggy": "^3.0.2"

packages/malloy-render/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/render",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@lit/context": "^1.1.0",
27-
"@malloydata/malloy": "^0.0.104",
27+
"@malloydata/malloy": "^0.0.105",
2828
"@types/luxon": "^2.4.0",
2929
"lit": "^3.0.2",
3030
"lodash": "^4.17.20",

packages/malloy-render/src/drill.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {timeToString} from './html/utils';
3434
type FilterItem = {key: string; value: string | undefined};
3535

3636
function filterQuote(s: string): string {
37-
return `'${s.replace("'", "\\'")}'`;
37+
return `'${s.replace(/(['\\])/g, '\\$1')}'`;
3838
}
3939

4040
function timestampToDateFilter(
@@ -69,8 +69,12 @@ function getRowFilters(row: DataRecord): FilterItem[] {
6969
for (const dim of dimensions) {
7070
const cell = row.cell(dim);
7171
// if we have an expression, use it instead of the name of the field.
72-
const key =
72+
let key =
7373
dim.isAtomicField() || dim.isQueryField() ? dim.expression : undefined;
74+
// Multi word column names.
75+
if (key !== undefined && key.includes(' ') && key === dim.name) {
76+
key = '`' + key + '`';
77+
}
7478
if (key && !cell.isArray()) {
7579
if (cell.isNull()) {
7680
filters.push({key, value: 'null'});
@@ -79,9 +83,12 @@ function getRowFilters(row: DataRecord): FilterItem[] {
7983
} else if (cell.isNumber() || cell.isBoolean()) {
8084
filters.push({key, value: cell.value.toString()});
8185
} else if (cell.isTimestamp() || cell.isDate()) {
82-
filters.push(
83-
timestampToDateFilter(key, cell.value, cell.field.timeframe)
84-
);
86+
let timeframe = cell.field.timeframe;
87+
// Dont let the timeframe for Date go down to seconds.
88+
if (cell.isDate() && timeframe === undefined) {
89+
timeframe = DateTimeframe.Day;
90+
}
91+
filters.push(timestampToDateFilter(key, cell.value, timeframe));
8592
}
8693
}
8794
}
@@ -113,7 +120,7 @@ export function getDrillFilters(data: DataArrayOrRecord): {
113120
const formattedFilters: string[] = [];
114121
for (const {key, value} of filters) {
115122
if (value !== undefined) {
116-
formattedFilters.push(`${key}: ${value}`);
123+
formattedFilters.push(`${key} = ${value}`);
117124
} else {
118125
formattedFilters.push(key);
119126
}
@@ -137,10 +144,11 @@ export function getDrillQuery(data: DataArrayOrRecord): {
137144
drillFilters: string[];
138145
} {
139146
const {formattedFilters, source} = getDrillFilters(data);
140-
let ret = `run: ${source?.name || '"unable to compute source"'} `;
147+
let ret = `run: ${source?.name || '"unable to compute source"'} -> `;
141148
if (formattedFilters.length) {
142-
ret += `{ \n where: \n ${formattedFilters.join(',\n ')}\n \n}\n`;
149+
ret += `{ \n select: *\n where: \n ${formattedFilters.join(
150+
',\n '
151+
)}\n \n}\n`;
143152
}
144-
const drillQuery = ret + '-> ';
145-
return {drillQuery, drillFilters: formattedFilters};
153+
return {drillQuery: ret, drillFilters: formattedFilters};
146154
}

packages/malloy-syntax-highlight/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/syntax-highlight",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"description": "A package to simplify the process of developing, testing, and syncnig Malloy syntax highlighting grammars",
55
"files": [
66
"grammars/**/*.tmGrammar.json",

packages/malloy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@malloydata/malloy",
3-
"version": "0.0.104",
3+
"version": "0.0.105",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/malloy/src/lang/ast/elements/pipeline-desc.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
import {FieldName, FieldSpace} from '../types/field-space';
3535
import {MalloyElement} from '../types/malloy-element';
3636
import {QOPDesc} from '../query-properties/qop-desc';
37-
import {QueryInputSpace} from '../field-space/query-input-space';
37+
import {QuerySpace} from '../field-space/query-spaces';
3838
import {ViewFieldReference} from '../query-items/field-references';
3939
import {Refinement} from '../query-properties/refinements';
4040
import {StaticSpace} from '../field-space/static-space';
@@ -53,7 +53,21 @@ interface AppendResult {
5353
export abstract class PipelineDesc extends MalloyElement {
5454
protected refinements?: Refinement[];
5555
protected qops: QOPDesc[] = [];
56-
nestedInQuerySpace?: QueryInputSpace;
56+
private isNestIn?: QuerySpace;
57+
58+
/**
59+
* This pipeline is actually a nest statement, and the passed query space
60+
* is the space for the query which contains the nest statement. This is
61+
* used so that nest queries can walk up a nest chain to check
62+
* "ungrouping" expressions.
63+
*
64+
* This is only here so that it can be used when a Builder is created
65+
* so the query space created by the builder can also know that it is
66+
* nested.
67+
*/
68+
declareAsNestInside(qs: QuerySpace) {
69+
this.isNestIn = qs;
70+
}
5771

5872
alreadyRefined(): boolean {
5973
return this.refinements !== undefined;
@@ -75,8 +89,7 @@ export abstract class PipelineDesc extends MalloyElement {
7589
modelPipe: PipeSegment[]
7690
): AppendResult {
7791
const returnPipe: PipeSegment[] = [...modelPipe];
78-
const nestedIn =
79-
modelPipe.length === 0 ? this.nestedInQuerySpace : undefined;
92+
const nestedIn = modelPipe.length === 0 ? this.isNestIn : undefined;
8093
let nextFS = () => pipelineOutput;
8194
for (const qop of this.qops) {
8295
const next = qop.getOp(nextFS(), nestedIn);
@@ -104,7 +117,7 @@ export abstract class PipelineDesc extends MalloyElement {
104117
}
105118
pipeline.push(...modelPipe.pipeline);
106119
for (const refinement of this.refinements) {
107-
pipeline = refinement.refine(fs, pipeline);
120+
pipeline = refinement.refine(fs, pipeline, this.isNestIn);
108121
}
109122
return {pipeline};
110123
}

packages/malloy/src/lang/ast/expressions/constant-sub-expression.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ class ConstantFieldSpace implements FieldSpace {
6060
dialectObj(): undefined {
6161
return undefined;
6262
}
63-
whenComplete(step: () => void): void {
64-
step();
65-
}
6663
isQueryFieldSpace(): this is QueryFieldSpace {
6764
return false;
6865
}

0 commit comments

Comments
 (0)