Skip to content

Support interval type #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 23, 2023
Merged

Support interval type #228

merged 7 commits into from
May 23, 2023

Conversation

AShiou
Copy link
Contributor

@AShiou AShiou commented May 11, 2023

Support Interval type

We do the following things,

  1. In ExpressionFormatter.java, format query from format INTERVAL -'5' HOUR to INTERVAL '-5' HOUR
  2. In BigQueryRecordIterator.java, convert BigQuery output value format [sign]Y-M [sign]D [sign]H:M:S[.F] to Period
    https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#interval_type
  3. In IntervalType.java, modify type to support pg interval format
  4. Add Interval type to pg_type table
  5. Convert PostgreSQL = ANY to BigQuery IN, because JDBC will query the following sql when resultSet.getObject()
SELECT
  (n.nspname = ANY (SELECT *
FROM
  UNNEST(pg_catalog.current_schemas__bool____varchar(true))
))
, n.nspname
, t.typname
FROM
  (`canner-cml`.pg_catalog.pg_type t
INNER JOIN `canner-cml`.pg_catalog.pg_namespace n ON (t.typnamespace = n.oid))
WHERE (t.oid = 1186)
  1. Modify IntervalType#decodeUTF8Text to support prepared statement

Related Issue

#209

@AShiou AShiou changed the title [WIP] Support interval [WIP] Support interval type May 12, 2023
@AShiou AShiou force-pushed the feature/fix-interval branch 4 times, most recently from 16b218e to ff9688d Compare May 16, 2023 02:12
@AShiou AShiou requested a review from goldmedal May 16, 2023 02:19
@AShiou AShiou marked this pull request as ready for review May 16, 2023 02:19
@AShiou AShiou changed the title [WIP] Support interval type Support interval type May 16, 2023
This was referenced May 18, 2023
@AShiou AShiou force-pushed the feature/fix-interval branch from ff9688d to 5d1143c Compare May 19, 2023 06:07
@AShiou AShiou requested review from goldmedal and removed request for goldmedal May 19, 2023 06:07
@AShiou AShiou force-pushed the feature/fix-interval branch from 5d1143c to 12a11c7 Compare May 22, 2023 01:59
Copy link
Contributor

@goldmedal goldmedal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@goldmedal goldmedal merged commit 57bbcf6 into main May 23, 2023
@goldmedal goldmedal deleted the feature/fix-interval branch May 23, 2023 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants