diff --git a/adapters/jdbc/dev.local.configuration.json b/adapters/jdbc/dev.local.configuration.json index 0a286f9..b01bc26 100644 --- a/adapters/jdbc/dev.local.configuration.json +++ b/adapters/jdbc/dev.local.configuration.json @@ -8,7 +8,7 @@ { "type": "jdbc", "name": "DEFAULT", - "jdbcUrl": "jdbc:redshift://default-workgroup.528956693660.us-east-2.redshift-serverless.amazonaws.com:5439/dev?user=redshiftdev&password=#Hasura2024!" + "jdbcUrl": "jdbc:redshift://default-workgroup.528956693660.us-east-2.redshift-serverless.amazonaws.com:5439/dev?user=redshiftdev&password=#Hasura2024!¤tSchema=crm" } ] }, diff --git a/calcite-rs-jni/src/main/java/org/kenstott/CalciteQuery.java b/calcite-rs-jni/src/main/java/org/kenstott/CalciteQuery.java index a6e08c8..f63ec6f 100644 --- a/calcite-rs-jni/src/main/java/org/kenstott/CalciteQuery.java +++ b/calcite-rs-jni/src/main/java/org/kenstott/CalciteQuery.java @@ -253,11 +253,24 @@ private Map getTableColumnInfo(TableMetadata table) { entry("TIMESTAMP(3) NOT NULL", "TIMESTAMP"), entry("TIMESTAMP(3)", "TIMESTAMP"), entry("TIMESTAMP NOT NULL", "TIMESTAMPTZ"), - entry("TIMESTAMP", "TIMESTAMPTZ") + entry("TIMESTAMP", "TIMESTAMPTZ"), + entry("DECIMAL(10,2)", "FLOAT"), + entry("DECIMAL(12,2)", "FLOAT") ); String mappedType = remapTypes.get(dataTypeName); if (mappedType == null) { - mappedType = "VARCHAR"; + if (dataTypeName.toLowerCase().contains("varchar")) { + mappedType = "VARCHAR"; + } + else if (dataTypeName.toLowerCase().contains("timestamp")) { + mappedType = "TIMESTAMP"; + } + else if (dataTypeName.toLowerCase().contains("decimal")) { + mappedType = "FLOAT"; + } + else { + mappedType = "VARCHAR"; + } } if (dataTypeName.startsWith("VARCHAR(65536)") && sqliteFlag) { if (columnName.toLowerCase().contains("date")) { diff --git a/calcite-rs-jni/src/main/java/org/kenstott/Main.java b/calcite-rs-jni/src/main/java/org/kenstott/Main.java index 00c5165..80a29a5 100644 --- a/calcite-rs-jni/src/main/java/org/kenstott/Main.java +++ b/calcite-rs-jni/src/main/java/org/kenstott/Main.java @@ -25,18 +25,11 @@ public static void main(String[] args) { String x = query.getModels(); System.out.println(x); String zz = query.queryPlanModels(""" - SELECT COUNT(*) as "count", JSON_ARRAYAGG("TrackId") as "tracks", "c"."FirstName", "c"."LastName" FROM "TEST"."invoice_items" - JOIN "TEST"."invoices" as "i" USING("InvoiceId") - JOIN "TEST"."customers" as "c" USING("CustomerId") - GROUP BY "c"."FirstName", "c"."LastName", "i"."InvoiceId" """); System.out.println(zz); String z1 = query.queryModels(""" - SELECT COUNT(*) as "count", JSON_ARRAYAGG("TrackId") as "tracks", "c"."FirstName", "c"."LastName" FROM "TEST"."invoice_items" - JOIN "TEST"."invoices" as "i" USING("InvoiceId") - JOIN "TEST"."customers" as "c" USING("CustomerId") - GROUP BY "c"."FirstName", "c"."LastName", "i"."InvoiceId" + SELECT * from "DEFAULT"."orders" LIMIT 10 """ );