Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/healthy-pans-grab.md

This file was deleted.

45 changes: 0 additions & 45 deletions packages/common-utils/src/__tests__/queryParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ describe('CustomSchemaSQLSerializerV2 - json', () => {
return { name: 'SeverityNumber', type: 'UInt8' };
} else if (column === 'foo') {
return { name: 'foo', type: 'String' };
} else if (column === 'bar') {
return { name: 'bar', type: 'String' };
} else if (column === 'MaterializedExample') {
return { name: 'MaterializedExample', type: 'String' };
} else {
Expand Down Expand Up @@ -496,49 +494,6 @@ describe('CustomSchemaSQLSerializerV2 - json', () => {
expect(actualSql).toBe(expectedSql);
});

describe('CustomSchemaSQLSerializerV2: select alias resolution', () => {
// ClickHouse resolves SELECT aliases in WHERE, so a Lucene field matching a
// known alias must resolve to a bare identifier. A field that is neither a
// column nor an alias is genuinely unknown and must not be injected as raw
// SQL (which ClickHouse would reject as an unknown identifier).
const aliasSerializer = new CustomSchemaSQLSerializerV2({
metadata,
databaseName,
tableName,
connectionId,
implicitColumnExpression: 'Body',
selectAliases: new Set(['Content']),
});

it('resolves a known select alias as a column reference', async () => {
const res = await aliasSerializer.getColumnForField('Content', {});
expect(res).toEqual(
expect.objectContaining({ found: true, column: 'Content' }),
);
});

it('renders a select alias reference as a bare identifier', async () => {
const sql = await new SearchQueryBuilder(
'Content:foo',
aliasSerializer,
).build();
expect(sql).toBe("((Content ILIKE '%foo%'))");
});

it('returns not-found for an unknown, non-alias field', async () => {
const res = await serializer.getColumnForField('NotAColumn', {});
expect(res).toEqual(expect.objectContaining({ found: false }));
});

it('renders an unknown, non-alias field as the no-match predicate', async () => {
const sql = await new SearchQueryBuilder(
'NotAColumn:foo',
serializer,
).build();
expect(sql).toBe('((1 = 0))');
});
});

describe('CustomSchemaSQLSerializerV2: implicit column falls back to bodyExpression', () => {
// Symmetric counterpart to the one-way fallback in
// `getEventBody` (packages/app/src/source.ts): a log source admin who
Expand Down
Loading
Loading