Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

update typeAliases #8

Merged
merged 1 commit into from
Mar 5, 2021
Merged

Conversation

JLDLaughlin
Copy link
Contributor

A user surfaced the following Metabase error (using our pgjdbc fork):

03-05 17:03:44 ERROR sync.util :: Error syncing Fields for Table X: Unable to find type name for double precision
("io.materialize.jdbc.TypeInfoCache.getSQLType(TypeInfoCache.java:206)"
 "io.materialize.jdbc.PgDatabaseMetaData.getColumns(PgDatabaseMetaData.java:1503)"
 "com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getColumns(NewProxyDatabaseMetaData.java:3140)"
 "--> driver.sql_jdbc.sync$describe_table_fields.invokeStatic(sync.clj:152)"
 "driver.sql_jdbc.sync$describe_table_fields.doInvoke(sync.clj:149)"
 "driver.sql_jdbc.sync$describe_table.invokeStatic(sync.clj:198)"

It turns out our typeAliases info didn't include all of the available aliases for Materialize's built-in types.

@JLDLaughlin JLDLaughlin requested a review from quodlibetor March 5, 2021 17:52

typeAliases.put("boolean", "bool");
typeAliases.put("decimal", "numeric");
typeAliases.put("json", "jsonb");
Copy link
Contributor

Choose a reason for hiding this comment

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

these (json/jsonb) aren't technically identical but they should behave similarly enough for metabase purposes so it's probably fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah--it's definitely sort of weird! but we do technically list it as an alias here.

@JLDLaughlin
Copy link
Contributor Author

For posterity, I tested this locally by:

  1. Building the updated pgjdbc jar
  2. Rebuilding the metabase-materialize-driver
  3. Spinning up Materialize & Metabase
  4. Creating the following view in my materialized instance: create view viewy as select 1::double precision as col;
  5. Making sure I could SELECT col FROM viewy and SELECT col::double precision FROM viewy

@@ -117,7 +117,11 @@ protected void finalize() throws IOException {
// forcibly close it because super.finalize() may keep the FD open, which may prevent
// file deletion
close();
super.finalize();
try {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to make this change to build the jar locally!

@JLDLaughlin JLDLaughlin merged commit a4ca545 into MaterializeInc:master Mar 5, 2021
@JLDLaughlin JLDLaughlin deleted the types branch March 5, 2021 20:50
JLDLaughlin added a commit that referenced this pull request Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants