Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore empty order by #392

Merged
merged 1 commit into from
Dec 20, 2023
Merged
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
2 changes: 1 addition & 1 deletion hana/lib/HANAService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs')
const path = require('path')
const { Readable } = require('stream')

Check warning on line 3 in hana/lib/HANAService.js

View workflow job for this annotation

GitHub Actions / HANA Node.js 18

'Readable' is assigned a value but never used

Check warning on line 3 in hana/lib/HANAService.js

View workflow job for this annotation

GitHub Actions / Node.js 18

'Readable' is assigned a value but never used

const { SQLService } = require('@cap-js/db-service')
const drivers = require('./drivers')
Expand Down Expand Up @@ -275,7 +275,7 @@
q.as = alias
const src = q

const { limit, one, orderBy, expand, columns, localized, count, from, parent } = q.SELECT

Check warning on line 278 in hana/lib/HANAService.js

View workflow job for this annotation

GitHub Actions / HANA Node.js 18

'from' is assigned a value but never used

Check warning on line 278 in hana/lib/HANAService.js

View workflow job for this annotation

GitHub Actions / Node.js 18

'from' is assigned a value but never used

// When one of these is defined wrap the query in a sub query
if (expand || (parent && (limit || one || orderBy))) {
Expand Down Expand Up @@ -315,7 +315,7 @@
const over = { xpr: [] }
// TODO: replace with full path partitioning
if (parent) over.xpr.push(`PARTITION BY ${this.ref({ ref: ['_parent_path_'] })}`)
if (orderBy) over.xpr.push(` ORDER BY ${this.orderBy(orderBy, localized)}`)
if (orderBy?.length) over.xpr.push(` ORDER BY ${this.orderBy(orderBy, localized)}`)
const rn = { xpr: [{ func: 'ROW_NUMBER', args: [] }, 'OVER', over], as: '$$RN$$' }
q.as = q.SELECT.from.as

Expand Down
Loading