exasol / bigquery-virtual-schema

Virtual Schema for connecting Big Query as a data source to Exasol
MIT License
1 stars 1 forks source link

BigQuery date converted to Exasol VARCHAR(10) #7

Closed redcatbear closed 2 years ago

redcatbear commented 2 years ago

Situation

When loading a table from BigQuery that contains a DATE, on the Exasol side it results in a VARCHAR instead of a DATE.

Example: DATE value "09.01.2020" on BigQuery turned to a VARCHAR(10) UTF8 in Exasol.

ckunki commented 2 years ago

Implementation accepts only dates in format YYYY-DD?-DD?, see class BigQueryQueryRewriter:

private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4})-(\\d{1,2})-(\\d{1,2})"); 

Related unit test in BigQueryQueryRewriterTest.java, expects dates using German date pattern to be interpreted as VARCHAR:

    @CsvSource({ "string_col, 12, hello, hello", //
            "string_col, 12, i'm, i\\'m", //
            "time_col, 92, 12:10:09.000, 12:10:09.000", //
            "numeric_col, 2, 22222.2222, 22222.2222", //
            "numeric_col, 2, 11.5, 11.5", //
            "date_col, 91, 1111-01-01, 01.01.1111", //
            "date_col, 91, 2019-12-3, 03.12.2019", //
            "date_col, 91, 2019-5-02, 02.05.2019" //
    })
    @ParameterizedTest
    void testRewriteWithStringValues(final String columnName, final int type, final String columnValue,
            final String resultValue) throws AdapterException, SQLException {
        assertQueryWithOneStringValue(columnName, type, columnValue, "SELECT * FROM VALUES ('" + resultValue + "')");
    }

Recommendation to user:

ckunki commented 2 years ago

According to V' the column format in BigQuery is DATE.

See also

ckunki commented 2 years ago

V' will contact the original requester and will set up an appointment.

ckunki commented 2 years ago

Impression by @kaklakariada and me:

ckunki commented 2 years ago

@redcatbear confirmed the initial impressions. Next steps

kaklakariada commented 2 years ago

Blocked by #9