diff --git a/drizzle-orm/src/singlestore-core/query-builders/select.ts b/drizzle-orm/src/singlestore-core/query-builders/select.ts index a7652412e..8c1c015f0 100644 --- a/drizzle-orm/src/singlestore-core/query-builders/select.ts +++ b/drizzle-orm/src/singlestore-core/query-builders/select.ts @@ -494,48 +494,6 @@ export abstract class SingleStoreSelectQueryBuilderBase< */ intersect = this.createSetOperator('intersect', false); - /** - * Adds `intersect all` set operator to the query. - * - * Calling this method will retain only the rows that are present in both result sets including all duplicates. - * - * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all} - * - * @example - * - * ```ts - * // Select all products and quantities that are ordered by both regular and VIP customers - * await db.select({ - * productId: regularCustomerOrders.productId, - * quantityOrdered: regularCustomerOrders.quantityOrdered - * }) - * .from(regularCustomerOrders) - * .intersectAll( - * db.select({ - * productId: vipCustomerOrders.productId, - * quantityOrdered: vipCustomerOrders.quantityOrdered - * }) - * .from(vipCustomerOrders) - * ); - * // or - * import { intersectAll } from 'drizzle-orm/pg-core' - * - * await intersectAll( - * db.select({ - * productId: regularCustomerOrders.productId, - * quantityOrdered: regularCustomerOrders.quantityOrdered - * }) - * .from(regularCustomerOrders), - * db.select({ - * productId: vipCustomerOrders.productId, - * quantityOrdered: vipCustomerOrders.quantityOrdered - * }) - * .from(vipCustomerOrders) - * ); - * ``` - */ - intersectAll = this.createSetOperator('intersect', true); - /** * Adds `except` set operator to the query. * @@ -1027,7 +985,6 @@ const getSingleStoreSetOperators = () => ({ union, unionAll, intersect, - intersectAll, except, exceptAll, minus, @@ -1114,48 +1071,6 @@ export const unionAll = createSetOperator('union', true); */ export const intersect = createSetOperator('intersect', false); -/** - * Adds `intersect all` set operator to the query. - * - * Calling this method will retain only the rows that are present in both result sets including all duplicates. - * - * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all} - * - * @example - * - * ```ts - * // Select all products and quantities that are ordered by both regular and VIP customers - * import { intersectAll } from 'drizzle-orm/mysql-core' - * - * await intersectAll( - * db.select({ - * productId: regularCustomerOrders.productId, - * quantityOrdered: regularCustomerOrders.quantityOrdered - * }) - * .from(regularCustomerOrders), - * db.select({ - * productId: vipCustomerOrders.productId, - * quantityOrdered: vipCustomerOrders.quantityOrdered - * }) - * .from(vipCustomerOrders) - * ); - * // or - * await db.select({ - * productId: regularCustomerOrders.productId, - * quantityOrdered: regularCustomerOrders.quantityOrdered - * }) - * .from(regularCustomerOrders) - * .intersectAll( - * db.select({ - * productId: vipCustomerOrders.productId, - * quantityOrdered: vipCustomerOrders.quantityOrdered - * }) - * .from(vipCustomerOrders) - * ); - * ``` - */ -export const intersectAll = createSetOperator('intersect', true); - /** * Adds `except` set operator to the query. * diff --git a/drizzle-orm/type-tests/singlestore/set-operators.ts b/drizzle-orm/type-tests/singlestore/set-operators.ts index 8bd434262..5e6fd3046 100644 --- a/drizzle-orm/type-tests/singlestore/set-operators.ts +++ b/drizzle-orm/type-tests/singlestore/set-operators.ts @@ -4,7 +4,6 @@ import { except, exceptAll, intersect, - intersectAll, type SingleStoreSetOperator, union, unionAll, @@ -51,18 +50,6 @@ const intersectTest = await db Expect>; -const intersectAllTest = await db - .select({ id: users.id, homeCity: users.class }) - .from(users) - .intersect( - db - .select({ id: users.id, homeCity: users.class }) - .from(users) - .leftJoin(cities, eq(users.id, cities.id)), - ); - -Expect>; - const exceptTest = await db .select({ id: users.id, homeCity: users.homeCity }) .from(users) @@ -120,24 +107,6 @@ const intersect2Test = await intersect( Expect>; -const intersectAll2Test = await intersectAll( - union( - db.select({ - id: cities.id, - }).from(cities), - db.select({ - id: cities.id, - }) - .from(cities).where(sql``), - ), - db.select({ - id: cities.id, - }) - .from(cities), -).orderBy(desc(cities.id)).limit(23); - -Expect>; - const except2Test = await except( db.select({ userId: newYorkers.userId, diff --git a/integration-tests/tests/singlestore/singlestore-common.ts b/integration-tests/tests/singlestore/singlestore-common.ts index ade2452bb..3ea3ecd5e 100644 --- a/integration-tests/tests/singlestore/singlestore-common.ts +++ b/integration-tests/tests/singlestore/singlestore-common.ts @@ -39,7 +39,6 @@ import { getViewConfig, int, intersect, - intersectAll, json, mediumint, primaryKey, @@ -2709,77 +2708,6 @@ export function tests(driver?: string) { })()).rejects.toThrowError(); }); - test('set operations (intersect all) from query builder', async (ctx) => { - const { db } = ctx.singlestore; - - await setupSetOperationTest(db); - - const sq = await db - .select({ id: citiesTable.id, name: citiesTable.name }) - .from(citiesTable).limit(2).intersectAll( - db - .select({ id: citiesTable.id, name: citiesTable.name }) - .from(citiesTable).limit(2), - ).as('sq'); - - const result = await db.select().from(sq) - - expect(result).toHaveLength(2); - - expect(result).toEqual([ - { id: 1, name: 'New York' }, - { id: 2, name: 'London' }, - ]); - - await expect((async () => { - db - .select({ id: citiesTable.id, name: citiesTable.name }) - .from(citiesTable).limit(2).intersectAll( - db - .select({ name: citiesTable.name, id: citiesTable.id }) - .from(citiesTable).limit(2), - ).orderBy(asc(sql`id`)); - })()).rejects.toThrowError(); - }); - - test('set operations (intersect all) as function', async (ctx) => { - const { db } = ctx.singlestore; - - await setupSetOperationTest(db); - - const result = await intersectAll( - db - .select({ id: users2Table.id, name: users2Table.name }) - .from(users2Table).where(eq(users2Table.id, 1)), - db - .select({ id: users2Table.id, name: users2Table.name }) - .from(users2Table).where(eq(users2Table.id, 1)), - db - .select({ id: users2Table.id, name: users2Table.name }) - .from(users2Table).where(eq(users2Table.id, 1)), - ); - - expect(result).toHaveLength(1); - - expect(result).toEqual([ - { id: 1, name: 'John' }, - ]); - - await expect((async () => { - intersectAll( - db - .select({ name: users2Table.name, id: users2Table.id }) - .from(users2Table).where(eq(users2Table.id, 1)), - db - .select({ id: users2Table.id, name: users2Table.name }) - .from(users2Table).where(eq(users2Table.id, 1)), - db - .select({ id: users2Table.id, name: users2Table.name }) - .from(users2Table).where(eq(users2Table.id, 1)), - ); - })()).rejects.toThrowError(); - }); - test('set operations (except) from query builder', async (ctx) => { const { db } = ctx.singlestore;