evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.47k stars 215 forks source link

[Bug]: Trino - ZodError on simple query #2823

Open andreapiso opened 1 day ago

andreapiso commented 1 day ago

Describe the bug

Running a simple query select * from table and getting a validation error from Zod. `count(*) on the same table succeeds, so it is not a connection issue.

{
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "code": "invalid_union",
            "unionErrors": [
              {
                "issues": [
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      8,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      9,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      10,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      11,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "code": "invalid_type",
                    "expected": "string",
                    "received": "undefined",
                    "path": [
                      "url"
                    ],
                    "message": "Required"
                  }
                ],
                "name": "ZodError"
              },
              {
                "issues": [
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      8,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      9,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      10,
                      "evidenceType"
                    ],
                    "message": "Required"
                  },
                  {
                    "expected": "'boolean' | 'number' | 'string' | 'date'",
                    "received": "undefined",
                    "code": "invalid_type",
                    "path": [
                      "columnTypes",
                      11,
                      "evidenceType"
                    ],
                    "message": "Required"
                  }
                ],
                "name": "ZodError"
              }
            ],
            "path": [],
            "message": "Invalid input"
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "code": "invalid_type",
            "expected": "null",
            "received": "object",
            "path": [],
            "message": "Expected null, received object"
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": [],
    "message": "Invalid input"
  }
]

First time using evidence, is there any way to understand what's going on here? Or any verbose mode to help me debug the issue? Running npm run sources -- --debug produces exactly the same output.

Steps to Reproduce

Just querying my fairly large table. The query succeeds according to starburst galaxy "Query Insights"

Logs

System Info

Severity

blocking all usage of Evidence

Additional Information, or Workarounds

No response

andreapiso commented 1 day ago

I isolated the bug to my timestamp column ie if I query that column it breaks, but if i cast to DATE it works. Is TIMESTAMP not supported? Where can we see the supported types?