Skip to content

Commit e1b4769

Browse files
authored
Revert "fix: unknown lucene field falls through in search" (#2447)
Reverts #2422
1 parent e492280 commit e1b4769

5 files changed

Lines changed: 7 additions & 543 deletions

File tree

‎.changeset/healthy-pans-grab.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎packages/common-utils/src/__tests__/queryParser.test.ts‎

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ describe('CustomSchemaSQLSerializerV2 - json', () => {
3535
return { name: 'SeverityNumber', type: 'UInt8' };
3636
} else if (column === 'foo') {
3737
return { name: 'foo', type: 'String' };
38-
} else if (column === 'bar') {
39-
return { name: 'bar', type: 'String' };
4038
} else if (column === 'MaterializedExample') {
4139
return { name: 'MaterializedExample', type: 'String' };
4240
} else {
@@ -496,49 +494,6 @@ describe('CustomSchemaSQLSerializerV2 - json', () => {
496494
expect(actualSql).toBe(expectedSql);
497495
});
498496

499-
describe('CustomSchemaSQLSerializerV2: select alias resolution', () => {
500-
// ClickHouse resolves SELECT aliases in WHERE, so a Lucene field matching a
501-
// known alias must resolve to a bare identifier. A field that is neither a
502-
// column nor an alias is genuinely unknown and must not be injected as raw
503-
// SQL (which ClickHouse would reject as an unknown identifier).
504-
const aliasSerializer = new CustomSchemaSQLSerializerV2({
505-
metadata,
506-
databaseName,
507-
tableName,
508-
connectionId,
509-
implicitColumnExpression: 'Body',
510-
selectAliases: new Set(['Content']),
511-
});
512-
513-
it('resolves a known select alias as a column reference', async () => {
514-
const res = await aliasSerializer.getColumnForField('Content', {});
515-
expect(res).toEqual(
516-
expect.objectContaining({ found: true, column: 'Content' }),
517-
);
518-
});
519-
520-
it('renders a select alias reference as a bare identifier', async () => {
521-
const sql = await new SearchQueryBuilder(
522-
'Content:foo',
523-
aliasSerializer,
524-
).build();
525-
expect(sql).toBe("((Content ILIKE '%foo%'))");
526-
});
527-
528-
it('returns not-found for an unknown, non-alias field', async () => {
529-
const res = await serializer.getColumnForField('NotAColumn', {});
530-
expect(res).toEqual(expect.objectContaining({ found: false }));
531-
});
532-
533-
it('renders an unknown, non-alias field as the no-match predicate', async () => {
534-
const sql = await new SearchQueryBuilder(
535-
'NotAColumn:foo',
536-
serializer,
537-
).build();
538-
expect(sql).toBe('((1 = 0))');
539-
});
540-
});
541-
542497
describe('CustomSchemaSQLSerializerV2: implicit column falls back to bodyExpression', () => {
543498
// Symmetric counterpart to the one-way fallback in
544499
// `getEventBody` (packages/app/src/source.ts): a log source admin who

0 commit comments

Comments
 (0)