Repository: taozhi8833998/node-sql-parser

Issue:
sqlify (sqlite) exception: unknown over type
**Describe the bug**
Given snippet of sql parses "correctly" (without error), but then results in an error when ast is passed back to sqlify.

**Database Engine**
sqlite

**To Reproduce**
```
const sql_orig = "SELECT \n    b.brand_name,\n    p.prompt_text,\n    m.model_name,\n    mr.brand_visibility_score,\n    AVG(mr.brand_visibility_score) OVER (PARTITION BY b.brand_name) as avg_brand_visibility,\n    AVG(mr.brand_visibility_score) OVER (PARTITION BY m.model_name) as avg_model_visibility,\n    AVG(mr.brand_visibility_score) OVER (PARTITION BY p.prompt_id) as avg_prompt_visibility\nFROM model_responses mr\nINNER JOIN experiment_runs er ON mr.run_id = er.run_id\nINNER JOIN brands b ON er.brand_id = b.brand_id\nINNER JOIN models m ON mr.model_id = m.model_id\nINNER JOIN prompts p ON mr.prompt_id = p.prompt_id\nWHERE b.brand_name IN ('prod1', 'prod2', 'prod3')\n    AND mr.error_occurred = 0\nORDER BY b.brand_name, mr.brand_visibility_score DESC, m.model_name, p.prompt_text\nLIMIT 100";

const SqlParse = require('node-sql-parser');
const parser = new SqlParse.Parser();
const ast = parser.astify(sql_orig, {database: 'sqlite'});

const sql = parser.sqlify(ast, {database: 'sqlite'});

```

-the node version: 20

**sqlify exception**
Exception: unknown over type

Discussion:

Solution patch:
diff --git a/src/over.js b/src/over.js
index f337359..43f6ed7 100644
--- a/src/over.js
+++ b/src/over.js
@@ -1,5 +1,5 @@
-import { toUpper } from './util'
-import { exprToSQL } from './expr'
+import { hasVal, toUpper } from './util'
+import { exprToSQL, orderOrPartitionByToSQL } from './expr'
 import { asWindowSpecToSQL } from './window'
 
 function overToSQL(over) {
@@ -13,6 +13,9 @@ function overToSQL(over) {
     if (parentheses) onUpdate = `${onUpdate}(${args.join(', ')})`
     return onUpdate
   }
+  if (over.partitionby) {
+    return ['OVER', `(${orderOrPartitionByToSQL(over.partitionby, 'partition by')}`, `${orderOrPartitionByToSQL(over.orderby, 'order by')})`].filter(hasVal).join(' ')
+  }
   throw new Error('unknown over type')
 }
 



Test patch:
diff --git a/test/sqlite.spec.js b/test/sqlite.spec.js
index 544a257..113bae1 100644
--- a/test/sqlite.spec.js
+++ b/test/sqlite.spec.js
@@ -163,6 +163,24 @@ describe('sqlite', () => {
     sql = ' CREATE TABLE `Test` (  `id` int(11) NOT NULL,  `name` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,  PRIMARY KEY (`id`),  UNIQUE KEY `name` (`name`));'
     ast = parser.astify(sql, { database: 'mariadb' })
     expect(parser.sqlify(ast, DEFAULT_OPT)).to.be.equal('CREATE TABLE "Test" ("id" INT(11) NOT NULL, "name" VARCHAR(255) NOT NULL, PRIMARY KEY ("id"), UNIQUE ("name"))')
+    sql = `SELECT 
+          b.brand_name,
+          p.prompt_text,
+          m.model_name,
+          mr.brand_visibility_score,
+          AVG(mr.brand_visibility_score) OVER (PARTITION BY b.brand_name) as avg_brand_visibility,
+          AVG(mr.brand_visibility_score) OVER (PARTITION BY m.model_name) as avg_model_visibility,
+          AVG(mr.brand_visibility_score) OVER (PARTITION BY p.prompt_id) as avg_prompt_visibility
+      FROM model_responses mr
+      INNER JOIN experiment_runs er ON mr.run_id = er.run_id
+      INNER JOIN brands b ON er.brand_id = b.brand_id
+      INNER JOIN models m ON mr.model_id = m.model_id
+      INNER JOIN prompts p ON mr.prompt_id = p.prompt_id
+      WHERE b.brand_name IN ('prod1', 'prod2', 'prod3')
+          AND mr.error_occurred = 0
+      ORDER BY b.brand_name, mr.brand_visibility_score DESC, m.model_name, p.prompt_text
+      LIMIT 100`
+    expect(getParsedSql(sql)).to.be.equal(`SELECT "b"."brand_name", "p"."prompt_text", "m"."model_name", "mr"."brand_visibility_score", AVG("mr"."brand_visibility_score") OVER (PARTITION BY "b"."brand_name" ) AS "avg_brand_visibility", AVG("mr"."brand_visibility_score") OVER (PARTITION BY "m"."model_name" ) AS "avg_model_visibility", AVG("mr"."brand_visibility_score") OVER (PARTITION BY "p"."prompt_id" ) AS "avg_prompt_visibility" FROM "model_responses" AS "mr" INNER JOIN "experiment_runs" AS "er" ON "mr"."run_id" = "er"."run_id" INNER JOIN "brands" AS "b" ON "er"."brand_id" = "b"."brand_id" INNER JOIN "models" AS "m" ON "mr"."model_id" = "m"."model_id" INNER JOIN "prompts" AS "p" ON "mr"."prompt_id" = "p"."prompt_id" WHERE "b"."brand_name" IN ('prod1', 'prod2', 'prod3') AND "mr"."error_occurred" = 0 ORDER BY "b"."brand_name" ASC, "mr"."brand_visibility_score" DESC, "m"."model_name" ASC, "p"."prompt_text" ASC LIMIT 100`)
   })
 
   it('should support create or drop view', () => {