Skip to content

Commit 7439b94

Browse files
Nest with group_by: repeated-record fix (#2090)
* add failing test * move tests to "right"place in file * maybe throw instead of silently fail? * Revert "maybe throw instead of silently fail?" This reverts commit e50f66f. * try and isolate the problem * lint * see what what fails * find where it fails * fix anyvalueturtle * more precision in queryfield taxonomy * fix test * fix bq anyvalueturtle * maybe trino any value turtle? * maybe iSScalar more correct places? * clean up simple fields * make "scalar" mean "!aggregate,!calc" * get trino to allow nested group by record * fix mysql and postgres for nesting * still wokring on mysql compound * more mysql fixing * normalize to "basic" for "atomic non compound" * to a todo rename "atomic" to "basic"
1 parent f01efc7 commit 7439b94

39 files changed

+331
-301
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"ci-snowflake": "MALLOY_DATABASE=snowflake JEST_SILENT_REPORTER_SHOW_PATHS=true jest --config jest.snowflake.config.ts --reporters jest-silent-reporter --reporters summary",
4343
"ci-trino": "MALLOY_DATABASE=trino JEST_SILENT_REPORTER_SHOW_PATHS=true jest --config jest.trino.config.ts --reporters jest-silent-reporter --reporters summary",
4444
"ci-presto": "MALLOY_DATABASE=presto JEST_SILENT_REPORTER_SHOW_PATHS=true jest --config jest.presto.config.ts --reporters jest-silent-reporter --reporters summary",
45+
"ci-postgres": "MALLOY_DATABASE=postgres JEST_SILENT_REPORTER_SHOW_PATHS=true jest --config jest.postgres.config.ts --reporters jest-silent-reporter --reporters summary",
4546
"test-silent": "JEST_SILENT_REPORTER_SHOW_PATHS=true jest --runInBand --reporters jest-silent-reporter --no-color",
4647
"test-deps": "npm run build && npx jest -t dependencies",
4748
"third-party-licenses": "ts-node scripts/third_party_licenses",

packages/malloy-db-trino/src/trino_connection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import type {
4444
import {
4545
TrinoDialect,
4646
mkFieldDef,
47-
isScalarArray,
47+
isBasicArray,
4848
TinyParser,
4949
isRepeatedRecord,
5050
sqlKey,
@@ -314,7 +314,7 @@ export abstract class TrinoPrestoConnection
314314
return this.convertRow(colSchema.fields, rawRow);
315315
} else if (isRepeatedRecord(colSchema)) {
316316
return this.convertNest(colSchema.fields, rawRow) as QueryValue;
317-
} else if (isScalarArray(colSchema)) {
317+
} else if (isBasicArray(colSchema)) {
318318
const elType = colSchema.elementTypeDef;
319319
let theArray = this.unpackArray([], rawRow);
320320
if (elType.type === 'array') {

packages/malloy-render/src/component/bar-chart/generate-bar_chart-vega-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ export function generateBarChartVegaSpec(
822822
);
823823

824824
const value = rec.y;
825-
return field.isAtomic()
825+
return field.isBasic()
826826
? renderNumericField(field, value)
827827
: String(value);
828828
};

packages/malloy-render/src/component/bar-chart/get-bar_chart-settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function getBarChartSettings(
103103
});
104104

105105
const dimensions = explore.fields.filter(
106-
f => f.isAtomic() && f.wasDimension()
106+
f => f.isBasic() && f.wasDimension()
107107
);
108108

109109
// If still no x or y, attempt to pick the best choice

packages/malloy-render/src/component/chart-layout-settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ export function getChartLayoutSettings(
132132
const maxAxisVal = yScale.domain().at(1);
133133
const minAxisVal = yScale.domain().at(0);
134134
const l = locale();
135-
const formattedMin = yField.isAtomic()
135+
const formattedMin = yField.isBasic()
136136
? renderNumericField(yField, minAxisVal)
137137
: l.format(',')(minAxisVal);
138-
const formattedMax = yField.isAtomic()
138+
const formattedMax = yField.isBasic()
139139
? renderNumericField(yField, maxAxisVal)
140140
: l.format(',')(maxAxisVal);
141141
// const formattedMin = l.format(',')(minAxisVal);

packages/malloy-render/src/component/chart/chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function Chart(props: ChartProps) {
160160
// Pass relevant brushes from store into the vega view
161161
createEffect(() => {
162162
const fieldRefIds = field.fields.map(f =>
163-
f.isAtomic() ? f.referenceId : null
163+
f.isBasic() ? f.referenceId : null
164164
);
165165
const relevantBrushes = metadata.store.store.brushes.filter(brush =>
166166
fieldRefIds.includes(brush.fieldRefId)

packages/malloy-render/src/component/dashboard/dashboard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function Dashboard(props: {
102102

103103
const dimensions = () =>
104104
field.fields.filter(f => {
105-
return !f.isHidden() && f.isAtomic() && f.wasDimension();
105+
return !f.isHidden() && f.isBasic() && f.wasDimension();
106106
});
107107

108108
const nonDimensions = () => {
@@ -111,9 +111,9 @@ export function Dashboard(props: {
111111

112112
for (const f of field.fields) {
113113
if (f.isHidden()) continue;
114-
if (f.isAtomic() && f.wasCalculation()) {
114+
if (f.isBasic() && f.wasCalculation()) {
115115
measureFields.push(f);
116-
} else if (!f.isAtomic() || !f.wasDimension()) otherFields.push(f);
116+
} else if (!f.isBasic() || !f.wasDimension()) otherFields.push(f);
117117
}
118118
return [...measureFields, ...otherFields];
119119
};

packages/malloy-render/src/component/line-chart/generate-line_chart-vega-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ export function generateLineChartVegaSpec(explore: NestField): VegaChartProps {
787787
);
788788

789789
const value = rec.y;
790-
return field.isAtomic()
790+
return field.isBasic()
791791
? renderNumericField(field, value)
792792
: String(value);
793793
};

packages/malloy-render/src/component/line-chart/get-line_chart-settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function getLineChartSettings(
103103
});
104104

105105
const dimensions = explore.fields.filter(
106-
f => f.isAtomic() && f.wasDimension()
106+
f => f.isBasic() && f.wasDimension()
107107
);
108108

109109
// If still no x or y, attempt to pick the best choice

packages/malloy-render/src/component/render-image.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {RendererProps} from './types';
33
export function renderImage(props: RendererProps) {
44
const imgTag = props.tag.tag('image');
55
if (!imgTag) throw new Error('Missing tag for Image renderer');
6-
if (!props.dataColumn.field.isAtomic())
6+
if (!props.dataColumn.field.isBasic())
77
throw new Error('Image renderer: Field must be AtomicField');
88
if (!props.dataColumn.isString() && !props.dataColumn.isNull())
99
throw new Error('Image renderer: DataColumn must be StringCell');

0 commit comments

Comments
 (0)