Skip to content
Open
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
15 changes: 13 additions & 2 deletions packages/nosql-language-service/docs/test-suite.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ Some fixtures are marked with `knownLimitation` in their definition. These tests
| ID | Query feature | Reason |
| ------ | ------------------ | ------------------------------------------------------------------- |
| STR-12 | `TRIM()` | Not implemented in vnext-preview |
| M-07 | `LOG(0)` | Produces `-Infinity` → JSON error 4001 |
| M-13 | `LOG10(0)` | Produces `-Infinity` → JSON error 4001 |
| SQ-02 | `FIRST()` subquery | Not supported in vnext-preview |
| UDF-01 | UDF in SELECT | "Server-side scripts are not supported in this emulator" (HTTP 400) |
| UDF-02 | UDF in WHERE | "Server-side scripts are not supported in this emulator" (HTTP 400) |
Expand All @@ -107,6 +105,19 @@ When Microsoft ships a stable Linux emulator that supports these features, remov

---

## Cosmos DB language limitations (not emulator-specific)

These fixtures fail on **both production Azure Cosmos DB and the emulator**. The parser accepts the query, but the service rejects it at execution time. These are not emulator gaps — do **not** remove the `knownLimitation` when the emulator stabilizes.

| ID | Query feature | Reason |
| ---- | ------------- | --------------------------------------------------------------------------------------------------------------------------- |
| M-07 | `LOG(0)` | `LOG(0)` / negative argument → `-Infinity`, which is not valid JSON. Service returns HTTP 400 error 4001. See issue #310. |
| M-13 | `LOG10(0)` | `LOG10(0)` / negative argument → `-Infinity`, which is not valid JSON. Service returns HTTP 400 error 4001. See issue #310. |

> **Workaround:** guard the argument so it is always greater than 0, e.g. `WHERE c.value > 0` or `c.value > 0 ? LOG(c.value) : null`. This is data-dependent (only rows with a 0/negative value fail), so no static diagnostic is emitted — see the LOG/LOG10 hover documentation for details.

---

## Seed data

| Container | Documents | Size |
Expand Down
4 changes: 4 additions & 0 deletions packages/nosql-language-service/src/docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,8 @@ Returns the natural logarithm of the specified numeric expression, or the logari

Returns a numeric value.

> ⚠️ **The argument must be greater than 0.** \`LOG(0)\` (or a negative value) evaluates to \`-Infinity\`, which is not representable in JSON. Azure Cosmos DB rejects such a result with **HTTP 400, error code 4001** (both on production and the emulator). Guard the input, e.g. \`WHERE c.value > 0\` or \`c.value > 0 ? LOG(c.value) : null\`.

---

📖 **Documentation:** [LOG](https://learn.microsoft.com/en-us/cosmos-db/query/log)`],
Expand All @@ -1862,6 +1864,8 @@ Returns the base-10 logarithm of the specified numeric expression.

Returns a numeric value.

> ⚠️ **The argument must be greater than 0.** \`LOG10(0)\` (or a negative value) evaluates to \`-Infinity\`, which is not representable in JSON. Azure Cosmos DB rejects such a result with **HTTP 400, error code 4001** (both on production and the emulator). Guard the input, e.g. \`WHERE c.value > 0\` or \`c.value > 0 ? LOG10(c.value) : null\`.

---

📖 **Documentation:** [LOG10](https://learn.microsoft.com/en-us/cosmos-db/query/log10)`],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export const fixtures: QueryFixture[] = [
query: 'SELECT LOG(c.price) FROM c',
container: 'products',
expectAst: fn('LOG'),
knownLimitation: 'LOG(0) produces -Infinity which is not valid JSON (error 4001 in vnext-preview)',
knownLimitation:
'LOG(0) (or a negative argument) produces -Infinity, which is not valid JSON. Azure Cosmos DB rejects it with HTTP 400 error 4001 on both production and the emulator.',
},
{
id: 'M-08',
Expand Down Expand Up @@ -527,7 +528,8 @@ export const fixtures: QueryFixture[] = [
query: 'SELECT LOG10(c.price) FROM c',
container: 'products',
expectAst: fn('LOG10'),
knownLimitation: 'LOG10(0) produces -Infinity which is not valid JSON (error 4001 in vnext-preview)',
knownLimitation:
'LOG10(0) (or a negative argument) produces -Infinity, which is not valid JSON. Azure Cosmos DB rejects it with HTTP 400 error 4001 on both production and the emulator.',
},
{
id: 'M-14',
Expand Down
Loading