evidence icon indicating copy to clipboard operation
evidence copied to clipboard

[Bug]: Trino - ZodError on simple query

Open andreapiso opened this issue 1 year ago • 4 comments

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 avatar Nov 20 '24 14:11 andreapiso

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?

andreapiso avatar Nov 20 '24 14:11 andreapiso

Types that should be supported here:

https://github.com/evidence-dev/evidence/blob/next/packages/datasources/trino/index.cjs

archiewood avatar Nov 23 '24 03:11 archiewood

My type is TIMESTAMP(6) Querying it caused the cryptic zod error above

andreapiso avatar Nov 23 '24 04:11 andreapiso

It appears timestamp(6) is not currently supported.

It's not on the list of supported types in the connector.

Can you cast to timestamp also?

Would also accept a PR to add the type!

archiewood avatar Nov 23 '24 05:11 archiewood