Giter Site home page Giter Site logo

Comments (5)

camsaul avatar camsaul commented on May 11, 2024 2

There's a shared implementation you can use for drivers that don't support the new Java 8 types. Just add to your call to driver/register! – see the Redshift driver for example.

(driver/register! :presto, :parent #{:sql-jdbc ::legacy/use-legacy-classes-for-read-and-set})

Implementation is in this namespace.

from metabase-athena-driver.

flamber avatar flamber commented on May 11, 2024 1

I don't like how the "date" format includes the time, but maybe that's to be expected.

That's an oldie Metabase issue - see metabase/metabase#5859 or metabase/metabase#7494, or my catch-all issue that goes through the various date formatting issues and workarounds metabase/metabase#11394

from metabase-athena-driver.

dacort avatar dacort commented on May 11, 2024

Looking at Presto date/time types, we can see that there are a two that fail.

SELECT 
    DATE '2001-08-22' as type_date,
    TIME '01:02:03.456' as type_time,
    TIME '01:02:03.456 America/Los_Angeles' AS type_time_with_timezone,
    TIMESTAMP '2001-08-22 03:04:05.321' AS type_timestamp,
    TIMESTAMP '2001-08-22 03:04:05.321 America/Los_Angeles' AS type_timestamp_with_timezone,
    INTERVAL '3' MONTH AS type_interval_year_to_month,
    INTERVAL '2' DAY AS type_interval_day_to_second

type_date and type_timestamp return empty values.

image

In the console logs, we see a couple corresponding error messages:

For column 1 (DATE data type):

01-03 22:41:20 ERROR sql-jdbc.execute :: Error reading :athena column 1 type_date DATE
java.sql.SQLNonTransientException: [Simba][JDBC](11040) Invalid type for data - parameter: 1, type: java.time.LocalDate.
	at com.simba.athena.exceptions.ExceptionConverter.toSQLException(Unknown Source)
	at com.simba.athena.jdbc.jdbc41.utilities.ResultSetUtilities.getObjectByType(Unknown Source)
	at com.simba.athena.jdbc.jdbc41.S41ForwardResultSet.getObject(Unknown Source)
	at com.mchange.v2.c3p0.impl.NewProxyResultSet.getObject(NewProxyResultSet.java:217)
	at metabase.driver.sql_jdbc.execute$get_object_of_class.invokeStatic(execute.clj:66)

For column 4 (TIMESTAMP data type):

01-03 22:41:20 ERROR sql-jdbc.execute :: Error reading :athena column 4 type_timestamp TIMESTAMP
java.sql.SQLNonTransientException: [Simba][JDBC](11040) Invalid type for data - parameter: 4, type: java.time.LocalDateTime.
	at com.simba.athena.exceptions.ExceptionConverter.toSQLException(Unknown Source)
	at com.simba.athena.jdbc.jdbc41.utilities.ResultSetUtilities.getObjectByType(Unknown Source)
	at com.simba.athena.jdbc.jdbc41.S41ForwardResultSet.getObject(Unknown Source)
	at com.mchange.v2.c3p0.impl.NewProxyResultSet.getObject(NewProxyResultSet.java:217)
	at metabase.driver.sql_jdbc.execute$get_object_of_class.invokeStatic(execute.clj:66)

from metabase-athena-driver.

dacort avatar dacort commented on May 11, 2024

It seems like the Athena JDBC driver doesn't support the java.time.LocalDate or java.time.LocalDateTime types.

It looks like we can switch back to the legacy implementation, but I want to confirm what the differences are.

This might be a good opportunity to write some basic tests that run directly against Athena. I will spend some time on #12.

from metabase-athena-driver.

dacort avatar dacort commented on May 11, 2024

Previous version:
image

New version with "legacy" fix:
image

Looks like we get the same results. I don't like how the "date" format includes the time, but maybe that's to be expected.

from metabase-athena-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.