diff --git a/adapters/cassandra/dev.local.configuration.json b/adapters/cassandra/dev.local.configuration.json
index 4121fbd..f4747b6 100644
--- a/adapters/cassandra/dev.local.configuration.json
+++ b/adapters/cassandra/dev.local.configuration.json
@@ -1,6 +1,330 @@
{
"version": "5",
"$schema": "schema.json",
+ "model": {
+ "version": "1.0",
+ "defaultSchema": "twissandra",
+ "schemas": [
+ {
+ "type": "custom",
+ "name": "twissandra",
+ "sqlDialectFactory": null,
+ "jdbcUser": null,
+ "jdbcPassword": null,
+ "jdbcUrl": null,
+ "jdbcCatalog": null,
+ "jdbcSchema": null,
+ "factory": "org.apache.calcite.adapter.cassandra.CassandraSchemaFactory",
+ "operand": {
+ "host": "cassandra.us-west-1.amazonaws.com",
+ "port": 9142,
+ "password": "thfXHbP4KMRH8Je//SsoISZyOq/SNE3ltg40WIreGhcfGNVKsLqFwZwSQfc=",
+ "username": "athenauser-at-528956693660",
+ "keyspace": "content_data",
+ "ssl": true,
+ "dc": "us-west-1",
+ "pathToRootCert": "/Users/kennethstott/Documents/GitHub/calcite-connector/adapters/cassandra/root.crt"
+ }
+ }
+ ]
+ },
"model_file_path": "/Users/kennethstott/Documents/GitHub/calcite-connector/adapters/cassandra/model.json",
- "fixes": true
+ "fixes": true,
+ "metadata": {
+ "news_articles_by_source": {
+ "physicalSchema": "twissandra",
+ "catalog": "",
+ "schema": "twissandra",
+ "name": "news_articles_by_source",
+ "columns": {
+ "metadata": {
+ "name": "metadata",
+ "scalarType": "MAP",
+ "nullable": true
+ },
+ "publish_date": {
+ "name": "publish_date",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ },
+ "title": {
+ "name": "title",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "content": {
+ "name": "content",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "tags": {
+ "name": "tags",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "article_id": {
+ "name": "article_id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "comments": {
+ "name": "comments",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "alias": {
+ "name": "alias",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "author_id": {
+ "name": "author_id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "source": {
+ "name": "source",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ },
+ "all_data_types_example": {
+ "physicalSchema": "twissandra",
+ "catalog": "",
+ "schema": "twissandra",
+ "name": "all_data_types_example",
+ "columns": {
+ "is_active": {
+ "name": "is_active",
+ "scalarType": "BOOLEAN",
+ "nullable": true
+ },
+ "coordinates": {
+ "name": "coordinates",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "scalarType": "VARBINARY",
+ "nullable": true
+ },
+ "tags": {
+ "name": "tags",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "serial_no": {
+ "name": "serial_no",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "rank": {
+ "name": "rank",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "birth_date": {
+ "name": "birth_date",
+ "scalarType": "DATE",
+ "nullable": true
+ },
+ "large_number": {
+ "name": "large_number",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "properties": {
+ "name": "properties",
+ "scalarType": "MAP",
+ "nullable": true
+ },
+ "height": {
+ "name": "height",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "weight": {
+ "name": "weight",
+ "scalarType": "DOUBLE",
+ "nullable": true
+ },
+ "random_bytes": {
+ "name": "random_bytes",
+ "scalarType": "VARBINARY",
+ "nullable": true
+ },
+ "name": {
+ "name": "name",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "event_timeuuid": {
+ "name": "event_timeuuid",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "indicator": {
+ "name": "indicator",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "id": {
+ "name": "id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "frozen_list": {
+ "name": "frozen_list",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "preferences": {
+ "name": "preferences",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "registration_timestamp": {
+ "name": "registration_timestamp",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ },
+ "birth_time": {
+ "name": "birth_time",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "score": {
+ "name": "score",
+ "scalarType": "DOUBLE",
+ "nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ },
+ "news_articles_by_id": {
+ "physicalSchema": "twissandra",
+ "catalog": "",
+ "schema": "twissandra",
+ "name": "news_articles_by_id",
+ "columns": {
+ "metadata": {
+ "name": "metadata",
+ "scalarType": "MAP",
+ "nullable": true
+ },
+ "comments": {
+ "name": "comments",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "source": {
+ "name": "source",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "content": {
+ "name": "content",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "tags": {
+ "name": "tags",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "author_id": {
+ "name": "author_id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "article_id": {
+ "name": "article_id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "alias": {
+ "name": "alias",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "title": {
+ "name": "title",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "publish_date": {
+ "name": "publish_date",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ },
+ "news_articles": {
+ "physicalSchema": "twissandra",
+ "catalog": "",
+ "schema": "twissandra",
+ "name": "news_articles",
+ "columns": {
+ "article_id": {
+ "name": "article_id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "comments": {
+ "name": "comments",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "author_id": {
+ "name": "author_id",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "scalarType": "MAP",
+ "nullable": true
+ },
+ "source": {
+ "name": "source",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "title": {
+ "name": "title",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "publish_date": {
+ "name": "publish_date",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ },
+ "content": {
+ "name": "content",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "tags": {
+ "name": "tags",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "alias": {
+ "name": "alias",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ }
+ }
}
\ No newline at end of file
diff --git a/adapters/cassandra/model.json b/adapters/cassandra/model.json
index 49f0ed6..1e6a312 100644
--- a/adapters/cassandra/model.json
+++ b/adapters/cassandra/model.json
@@ -14,7 +14,7 @@
"port": 9142,
"ssl": true,
"dc": "us-west-1",
- "pathToRootCert": "./root.crt"
+ "pathToRootCert": "/Users/kennethstott/Documents/GitHub/calcite-connector/adapters/cassandra/root.crt"
}
}
]
diff --git a/adapters/file/dev.local.configuration.json b/adapters/file/dev.local.configuration.json
index a26bc22..c9dac13 100644
--- a/adapters/file/dev.local.configuration.json
+++ b/adapters/file/dev.local.configuration.json
@@ -24,25 +24,50 @@
"model_file_path": "./model.json",
"fixes": true,
"metadata": {
- "WACKY_COLUMN_NAMES": {
+ "2022CbpOceanEconomyTable__Notes": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "WACKY_COLUMN_NAMES",
+ "name": "2022CbpOceanEconomyTable__Notes",
"columns": {
- "EMPID": {
- "name": "EMPID",
+ "County Business Patterns (CBP) Ocean Economy Table: 2022": {
+ "name": "County Business Patterns (CBP) Ocean Economy Table: 2022",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ },
+ "EMPS": {
+ "physicalSchema": "default",
+ "catalog": "",
+ "schema": "default",
+ "name": "EMPS",
+ "columns": {
+ "EMPNO": {
+ "name": "EMPNO",
"scalarType": "INTEGER",
"nullable": true
},
+ "NAME": {
+ "name": "NAME",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "GENDER": {
+ "name": "GENDER",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
"SLACKER": {
"name": "SLACKER",
"scalarType": "BOOLEAN",
"nullable": true
},
- "EMPNO": {
- "name": "EMPNO",
- "scalarType": "INTEGER",
+ "MANAGER": {
+ "name": "MANAGER",
+ "scalarType": "BOOLEAN",
"nullable": true
},
"DEPTNO": {
@@ -50,20 +75,40 @@
"scalarType": "INTEGER",
"nullable": true
},
- "MANAGER": {
- "name": "MANAGER",
- "scalarType": "BOOLEAN",
+ "AGE": {
+ "name": "AGE",
+ "scalarType": "INTEGER",
"nullable": true
},
- "2gender": {
- "name": "2gender",
- "scalarType": "VARCHAR",
+ "JOINEDAT": {
+ "name": "JOINEDAT",
+ "scalarType": "DATE",
+ "nullable": true
+ },
+ "EMPID": {
+ "name": "EMPID",
+ "scalarType": "INTEGER",
"nullable": true
},
"CITY": {
"name": "CITY",
"scalarType": "VARCHAR",
"nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ },
+ "WACKY_COLUMN_NAMES": {
+ "physicalSchema": "default",
+ "catalog": "",
+ "schema": "default",
+ "name": "WACKY_COLUMN_NAMES",
+ "columns": {
+ "DEPTNO": {
+ "name": "DEPTNO",
+ "scalarType": "INTEGER",
+ "nullable": true
},
"AGE": {
"name": "AGE",
@@ -75,21 +120,56 @@
"scalarType": "DATE",
"nullable": true
},
+ "EMPNO": {
+ "name": "EMPNO",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "2gender": {
+ "name": "2gender",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
"naME": {
"name": "naME",
"scalarType": "VARCHAR",
"nullable": true
+ },
+ "MANAGER": {
+ "name": "MANAGER",
+ "scalarType": "BOOLEAN",
+ "nullable": true
+ },
+ "CITY": {
+ "name": "CITY",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "SLACKER": {
+ "name": "SLACKER",
+ "scalarType": "BOOLEAN",
+ "nullable": true
+ },
+ "EMPID": {
+ "name": "EMPID",
+ "scalarType": "INTEGER",
+ "nullable": true
}
},
"primaryKeys": [],
"exportedKeys": []
},
- "yaml": {
+ "ARCHERS": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "yaml",
+ "name": "ARCHERS",
"columns": {
+ "g": {
+ "name": "g",
+ "scalarType": "LIST",
+ "nullable": true
+ },
"object": {
"name": "object",
"scalarType": "MAP",
@@ -100,18 +180,23 @@
"scalarType": "LIST",
"nullable": true
},
+ "b": {
+ "name": "b",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
"id": {
"name": "id",
"scalarType": "INTEGER",
"nullable": true
},
- "f": {
- "name": "f",
+ "a": {
+ "name": "a",
"scalarType": "VARCHAR",
"nullable": true
},
- "c": {
- "name": "c",
+ "f": {
+ "name": "f",
"scalarType": "VARCHAR",
"nullable": true
},
@@ -120,18 +205,28 @@
"scalarType": "VARCHAR",
"nullable": true
},
- "g": {
- "name": "g",
- "scalarType": "LIST",
- "nullable": true
- },
- "a": {
- "name": "a",
+ "c": {
+ "name": "c",
"scalarType": "VARCHAR",
"nullable": true
+ }
+ },
+ "primaryKeys": [],
+ "exportedKeys": []
+ },
+ "DEPTS": {
+ "physicalSchema": "default",
+ "catalog": "",
+ "schema": "default",
+ "name": "DEPTS",
+ "columns": {
+ "DEPTNO": {
+ "name": "DEPTNO",
+ "scalarType": "INTEGER",
+ "nullable": true
},
- "b": {
- "name": "b",
+ "NAME": {
+ "name": "NAME",
"scalarType": "VARCHAR",
"nullable": true
}
@@ -139,60 +234,55 @@
"primaryKeys": [],
"exportedKeys": []
},
- "Connections_2": {
+ "yaml": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "Connections_2",
+ "name": "yaml",
"columns": {
- "Connected On": {
- "name": "Connected On",
- "scalarType": "VARCHAR",
- "nullable": false
+ "g": {
+ "name": "g",
+ "scalarType": "LIST",
+ "nullable": true
},
- "Email Address": {
- "name": "Email Address",
+ "e": {
+ "name": "e",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
- "Last Name": {
- "name": "Last Name",
+ "a": {
+ "name": "a",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
- "First Name": {
- "name": "First Name",
+ "c": {
+ "name": "c",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
- "URL": {
- "name": "URL",
+ "b": {
+ "name": "b",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
- "Company": {
- "name": "Company",
+ "f": {
+ "name": "f",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
- "Position": {
- "name": "Position",
- "scalarType": "VARCHAR",
- "nullable": false
- }
- },
- "primaryKeys": [],
- "exportedKeys": []
- },
- "2022CbpOceanEconomyTable__2022CbpIaOceanEconomy": {
- "physicalSchema": "default",
- "catalog": "",
- "schema": "default",
- "name": "2022CbpOceanEconomyTable__2022CbpIaOceanEconomy",
- "columns": {
- "2022 CBP Island Areas Ocean Economy Tabulation": {
- "name": "2022 CBP Island Areas Ocean Economy Tabulation",
- "scalarType": "VARCHAR",
+ "d": {
+ "name": "d",
+ "scalarType": "LIST",
+ "nullable": true
+ },
+ "id": {
+ "name": "id",
+ "scalarType": "INTEGER",
+ "nullable": true
+ },
+ "object": {
+ "name": "object",
+ "scalarType": "MAP",
"nullable": true
}
},
@@ -219,61 +309,16 @@
"primaryKeys": [],
"exportedKeys": []
},
- "LONG_EMPS": {
+ "2022CbpOceanEconomyTable__2022CbpIaOceanEconomy": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "LONG_EMPS",
+ "name": "2022CbpOceanEconomyTable__2022CbpIaOceanEconomy",
"columns": {
- "JOINEDAT": {
- "name": "JOINEDAT",
- "scalarType": "DATE",
- "nullable": true
- },
- "EMPID": {
- "name": "EMPID",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "CITY": {
- "name": "CITY",
- "scalarType": "VARCHAR",
- "nullable": true
- },
- "DEPTNO": {
- "name": "DEPTNO",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "SLACKER": {
- "name": "SLACKER",
- "scalarType": "BOOLEAN",
- "nullable": true
- },
- "NAME": {
- "name": "NAME",
- "scalarType": "VARCHAR",
- "nullable": true
- },
- "MANAGER": {
- "name": "MANAGER",
- "scalarType": "BOOLEAN",
- "nullable": true
- },
- "EMPNO": {
- "name": "EMPNO",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "GENDER": {
- "name": "GENDER",
+ "2022 CBP Island Areas Ocean Economy Tabulation": {
+ "name": "2022 CBP Island Areas Ocean Economy Tabulation",
"scalarType": "VARCHAR",
"nullable": true
- },
- "AGE": {
- "name": "AGE",
- "scalarType": "INTEGER",
- "nullable": true
}
},
"primaryKeys": [],
@@ -285,11 +330,6 @@
"schema": "default",
"name": "DATES",
"columns": {
- "JOINTIMES": {
- "name": "JOINTIMES",
- "scalarType": "TIMESTAMP",
- "nullable": true
- },
"EMPNO": {
"name": "EMPNO",
"scalarType": "INTEGER",
@@ -300,6 +340,11 @@
"scalarType": "VARCHAR",
"nullable": true
},
+ "JOINTIMES": {
+ "name": "JOINTIMES",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ },
"JOINEDAT": {
"name": "JOINEDAT",
"scalarType": "DATE",
@@ -309,89 +354,59 @@
"primaryKeys": [],
"exportedKeys": []
},
- "DEPTS": {
+ "LONG_EMPS": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "DEPTS",
+ "name": "LONG_EMPS",
"columns": {
- "NAME": {
- "name": "NAME",
- "scalarType": "VARCHAR",
+ "MANAGER": {
+ "name": "MANAGER",
+ "scalarType": "BOOLEAN",
"nullable": true
},
- "DEPTNO": {
- "name": "DEPTNO",
- "scalarType": "INTEGER",
- "nullable": true
- }
- },
- "primaryKeys": [],
- "exportedKeys": []
- },
- "2022CbpOceanEconomyTable__Notes": {
- "physicalSchema": "default",
- "catalog": "",
- "schema": "default",
- "name": "2022CbpOceanEconomyTable__Notes",
- "columns": {
- "County Business Patterns (CBP) Ocean Economy Table: 2022": {
- "name": "County Business Patterns (CBP) Ocean Economy Table: 2022",
+ "GENDER": {
+ "name": "GENDER",
"scalarType": "VARCHAR",
"nullable": true
- }
- },
- "primaryKeys": [],
- "exportedKeys": []
- },
- "ARCHERS": {
- "physicalSchema": "default",
- "catalog": "",
- "schema": "default",
- "name": "ARCHERS",
- "columns": {
- "id": {
- "name": "id",
- "scalarType": "INTEGER",
- "nullable": true
},
- "g": {
- "name": "g",
- "scalarType": "LIST",
+ "EMPNO": {
+ "name": "EMPNO",
+ "scalarType": "INTEGER",
"nullable": true
},
- "object": {
- "name": "object",
- "scalarType": "MAP",
+ "JOINEDAT": {
+ "name": "JOINEDAT",
+ "scalarType": "DATE",
"nullable": true
},
- "d": {
- "name": "d",
- "scalarType": "LIST",
+ "DEPTNO": {
+ "name": "DEPTNO",
+ "scalarType": "INTEGER",
"nullable": true
},
- "a": {
- "name": "a",
- "scalarType": "VARCHAR",
+ "AGE": {
+ "name": "AGE",
+ "scalarType": "INTEGER",
"nullable": true
},
- "e": {
- "name": "e",
- "scalarType": "VARCHAR",
+ "SLACKER": {
+ "name": "SLACKER",
+ "scalarType": "BOOLEAN",
"nullable": true
},
- "f": {
- "name": "f",
+ "NAME": {
+ "name": "NAME",
"scalarType": "VARCHAR",
"nullable": true
},
- "c": {
- "name": "c",
- "scalarType": "VARCHAR",
+ "EMPID": {
+ "name": "EMPID",
+ "scalarType": "INTEGER",
"nullable": true
},
- "b": {
- "name": "b",
+ "CITY": {
+ "name": "CITY",
"scalarType": "VARCHAR",
"nullable": true
}
@@ -399,61 +414,46 @@
"primaryKeys": [],
"exportedKeys": []
},
- "EMPS": {
+ "Connections_2": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "EMPS",
+ "name": "Connections_2",
"columns": {
- "EMPID": {
- "name": "EMPID",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "SLACKER": {
- "name": "SLACKER",
- "scalarType": "BOOLEAN",
- "nullable": true
- },
- "AGE": {
- "name": "AGE",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "NAME": {
- "name": "NAME",
+ "Company": {
+ "name": "Company",
"scalarType": "VARCHAR",
- "nullable": true
+ "nullable": false
},
- "CITY": {
- "name": "CITY",
+ "Last Name": {
+ "name": "Last Name",
"scalarType": "VARCHAR",
- "nullable": true
+ "nullable": false
},
- "GENDER": {
- "name": "GENDER",
+ "Email Address": {
+ "name": "Email Address",
"scalarType": "VARCHAR",
- "nullable": true
+ "nullable": false
},
- "MANAGER": {
- "name": "MANAGER",
- "scalarType": "BOOLEAN",
- "nullable": true
+ "Position": {
+ "name": "Position",
+ "scalarType": "VARCHAR",
+ "nullable": false
},
- "EMPNO": {
- "name": "EMPNO",
- "scalarType": "INTEGER",
- "nullable": true
+ "Connected On": {
+ "name": "Connected On",
+ "scalarType": "VARCHAR",
+ "nullable": false
},
- "JOINEDAT": {
- "name": "JOINEDAT",
- "scalarType": "DATE",
- "nullable": true
+ "URL": {
+ "name": "URL",
+ "scalarType": "VARCHAR",
+ "nullable": false
},
- "DEPTNO": {
- "name": "DEPTNO",
- "scalarType": "INTEGER",
- "nullable": true
+ "First Name": {
+ "name": "First Name",
+ "scalarType": "VARCHAR",
+ "nullable": false
}
},
"primaryKeys": [],
diff --git a/adapters/graphql/model.json b/adapters/graphql/model.json
new file mode 100644
index 0000000..0593707
--- /dev/null
+++ b/adapters/graphql/model.json
@@ -0,0 +1,15 @@
+{
+ "version": "1.0",
+ "defaultSchema": "graphql",
+ "schemas": [
+ {
+ "name": "graphql",
+ "type": "custom",
+ "factory": "org.apache.calcite.adapter.graphql.GraphQLSchemaFactory",
+ "operand": {
+ "endpoint": "http://localhost:3000/graphql",
+ "role": "admin"
+ }
+ }
+ ]
+}
diff --git a/adapters/jdbc/configuration.json b/adapters/jdbc/configuration.json
index 8259620..3238bd6 100644
--- a/adapters/jdbc/configuration.json
+++ b/adapters/jdbc/configuration.json
@@ -1,7 +1,7 @@
{
"version": "5",
"$schema": "schema.json",
- "model_file_path": "./model.yaml",
+ "model_file_path": "./model.json",
"fixes": true,
"supportJsonObject": true
}
\ No newline at end of file
diff --git a/adapters/jdbc/dev.local.configuration.json b/adapters/jdbc/dev.local.configuration.json
index 9ce11d2..4586366 100644
--- a/adapters/jdbc/dev.local.configuration.json
+++ b/adapters/jdbc/dev.local.configuration.json
@@ -12,101 +12,194 @@
"sqlDialectFactory": "com.hasura.SQLiteSqlDialectFactory",
"jdbcUser": null,
"jdbcPassword": null,
- "jdbcUrl": "jdbc:sqlite:/Users/kennethstott/Documents/GitHub/ndc-calcite3/adapters/jdbc/chinook.db",
+ "jdbcUrl": "jdbc:sqlite:/Users/kennethstott/Documents/GitHub/calcite-connector/adapters/jdbc/chinook.db",
"jdbcCatalog": null,
"jdbcSchema": null,
"factory": null
}
]
},
- "model_file_path": "./model.yaml",
+ "model_file_path": "./model.json",
"fixes": true,
- "supportJsonObject": true,
"metadata": {
- "customers": {
+ "tracks": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "customers",
+ "name": "tracks",
"columns": {
- "SupportRepId": {
- "name": "SupportRepId",
+ "Bytes": {
+ "name": "Bytes",
"scalarType": "INTEGER",
"nullable": true
},
- "Email": {
- "name": "Email",
+ "Name": {
+ "name": "Name",
"scalarType": "VARCHAR",
"nullable": false
},
- "Address": {
- "name": "Address",
- "scalarType": "VARCHAR",
+ "GenreId": {
+ "name": "GenreId",
+ "scalarType": "INTEGER",
"nullable": true
},
- "PostalCode": {
- "name": "PostalCode",
- "scalarType": "VARCHAR",
+ "MediaTypeId": {
+ "name": "MediaTypeId",
+ "scalarType": "INTEGER",
+ "nullable": false
+ },
+ "UnitPrice": {
+ "name": "UnitPrice",
+ "scalarType": "FLOAT",
+ "nullable": false
+ },
+ "AlbumId": {
+ "name": "AlbumId",
+ "scalarType": "INTEGER",
"nullable": true
},
- "CustomerId": {
- "name": "CustomerId",
+ "Milliseconds": {
+ "name": "Milliseconds",
"scalarType": "INTEGER",
"nullable": false
},
- "Company": {
- "name": "Company",
+ "Composer": {
+ "name": "Composer",
"scalarType": "VARCHAR",
"nullable": true
},
- "Country": {
- "name": "Country",
- "scalarType": "VARCHAR",
- "nullable": true
+ "TrackId": {
+ "name": "TrackId",
+ "scalarType": "INTEGER",
+ "nullable": false
+ }
+ },
+ "primaryKeys": [
+ "TrackId"
+ ],
+ "exportedKeys": [
+ {
+ "pkTableSchema": "default",
+ "pkTableName": "tracks",
+ "pkColumnName": "TrackId",
+ "pkName": "",
+ "fkTableSchema": "default",
+ "fkTableName": "invoice_items",
+ "fkColumnName": "TrackId",
+ "fkName": ""
},
- "Phone": {
- "name": "Phone",
- "scalarType": "VARCHAR",
- "nullable": true
+ {
+ "pkTableSchema": "default",
+ "pkTableName": "tracks",
+ "pkColumnName": "TrackId",
+ "pkName": "",
+ "fkTableSchema": "default",
+ "fkTableName": "playlist_track",
+ "fkColumnName": "TrackId",
+ "fkName": ""
+ }
+ ]
+ },
+ "albums": {
+ "physicalSchema": "default",
+ "catalog": "",
+ "schema": "default",
+ "name": "albums",
+ "columns": {
+ "AlbumId": {
+ "name": "AlbumId",
+ "scalarType": "INTEGER",
+ "nullable": false
},
- "LastName": {
- "name": "LastName",
+ "Title": {
+ "name": "Title",
"scalarType": "VARCHAR",
"nullable": false
},
- "Fax": {
- "name": "Fax",
+ "ArtistId": {
+ "name": "ArtistId",
+ "scalarType": "INTEGER",
+ "nullable": false
+ }
+ },
+ "primaryKeys": [
+ "AlbumId"
+ ],
+ "exportedKeys": [
+ {
+ "pkTableSchema": "default",
+ "pkTableName": "albums",
+ "pkColumnName": "AlbumId",
+ "pkName": "",
+ "fkTableSchema": "default",
+ "fkTableName": "tracks",
+ "fkColumnName": "AlbumId",
+ "fkName": ""
+ }
+ ]
+ },
+ "artists": {
+ "physicalSchema": "default",
+ "catalog": "",
+ "schema": "default",
+ "name": "artists",
+ "columns": {
+ "Name": {
+ "name": "Name",
"scalarType": "VARCHAR",
"nullable": true
},
- "City": {
- "name": "City",
- "scalarType": "VARCHAR",
- "nullable": true
+ "ArtistId": {
+ "name": "ArtistId",
+ "scalarType": "INTEGER",
+ "nullable": false
+ }
+ },
+ "primaryKeys": [
+ "ArtistId"
+ ],
+ "exportedKeys": [
+ {
+ "pkTableSchema": "default",
+ "pkTableName": "artists",
+ "pkColumnName": "ArtistId",
+ "pkName": "",
+ "fkTableSchema": "default",
+ "fkTableName": "albums",
+ "fkColumnName": "ArtistId",
+ "fkName": ""
+ }
+ ]
+ },
+ "genres": {
+ "physicalSchema": "default",
+ "catalog": "",
+ "schema": "default",
+ "name": "genres",
+ "columns": {
+ "GenreId": {
+ "name": "GenreId",
+ "scalarType": "INTEGER",
+ "nullable": false
},
- "State": {
- "name": "State",
+ "Name": {
+ "name": "Name",
"scalarType": "VARCHAR",
"nullable": true
- },
- "FirstName": {
- "name": "FirstName",
- "scalarType": "VARCHAR",
- "nullable": false
}
},
"primaryKeys": [
- "CustomerId"
+ "GenreId"
],
"exportedKeys": [
{
"pkTableSchema": "default",
- "pkTableName": "customers",
- "pkColumnName": "CustomerId",
+ "pkTableName": "genres",
+ "pkColumnName": "GenreId",
"pkName": "",
"fkTableSchema": "default",
- "fkTableName": "invoices",
- "fkColumnName": "CustomerId",
+ "fkTableName": "tracks",
+ "fkColumnName": "GenreId",
"fkName": ""
}
]
@@ -117,15 +210,15 @@
"schema": "default",
"name": "invoices",
"columns": {
- "BillingCountry": {
- "name": "BillingCountry",
+ "BillingAddress": {
+ "name": "BillingAddress",
"scalarType": "VARCHAR",
"nullable": true
},
- "InvoiceId": {
- "name": "InvoiceId",
- "scalarType": "INTEGER",
- "nullable": false
+ "BillingPostalCode": {
+ "name": "BillingPostalCode",
+ "scalarType": "VARCHAR",
+ "nullable": true
},
"BillingState": {
"name": "BillingState",
@@ -137,28 +230,28 @@
"scalarType": "INTEGER",
"nullable": false
},
- "BillingAddress": {
- "name": "BillingAddress",
+ "BillingCity": {
+ "name": "BillingCity",
"scalarType": "VARCHAR",
"nullable": true
},
+ "Total": {
+ "name": "Total",
+ "scalarType": "FLOAT",
+ "nullable": false
+ },
"InvoiceDate": {
"name": "InvoiceDate",
"scalarType": "TIMESTAMP",
"nullable": false
},
- "Total": {
- "name": "Total",
- "scalarType": "FLOAT",
+ "InvoiceId": {
+ "name": "InvoiceId",
+ "scalarType": "INTEGER",
"nullable": false
},
- "BillingPostalCode": {
- "name": "BillingPostalCode",
- "scalarType": "VARCHAR",
- "nullable": true
- },
- "BillingCity": {
- "name": "BillingCity",
+ "BillingCountry": {
+ "name": "BillingCountry",
"scalarType": "VARCHAR",
"nullable": true
}
@@ -179,49 +272,44 @@
}
]
},
- "employees": {
+ "customers": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "employees",
+ "name": "customers",
"columns": {
- "Title": {
- "name": "Title",
+ "CustomerId": {
+ "name": "CustomerId",
+ "scalarType": "INTEGER",
+ "nullable": false
+ },
+ "State": {
+ "name": "State",
"scalarType": "VARCHAR",
"nullable": true
},
- "BirthDate": {
- "name": "BirthDate",
- "scalarType": "TIMESTAMP",
+ "Phone": {
+ "name": "Phone",
+ "scalarType": "VARCHAR",
"nullable": true
},
- "City": {
- "name": "City",
+ "Address": {
+ "name": "Address",
"scalarType": "VARCHAR",
"nullable": true
},
"Email": {
"name": "Email",
"scalarType": "VARCHAR",
- "nullable": true
- },
- "EmployeeId": {
- "name": "EmployeeId",
- "scalarType": "INTEGER",
"nullable": false
},
- "ReportsTo": {
- "name": "ReportsTo",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "Address": {
- "name": "Address",
+ "LastName": {
+ "name": "LastName",
"scalarType": "VARCHAR",
- "nullable": true
+ "nullable": false
},
- "State": {
- "name": "State",
+ "City": {
+ "name": "City",
"scalarType": "VARCHAR",
"nullable": true
},
@@ -230,30 +318,25 @@
"scalarType": "VARCHAR",
"nullable": false
},
- "Phone": {
- "name": "Phone",
- "scalarType": "VARCHAR",
- "nullable": true
- },
- "Country": {
- "name": "Country",
+ "Fax": {
+ "name": "Fax",
"scalarType": "VARCHAR",
"nullable": true
},
- "HireDate": {
- "name": "HireDate",
- "scalarType": "TIMESTAMP",
+ "SupportRepId": {
+ "name": "SupportRepId",
+ "scalarType": "INTEGER",
"nullable": true
},
- "Fax": {
- "name": "Fax",
+ "Company": {
+ "name": "Company",
"scalarType": "VARCHAR",
"nullable": true
},
- "LastName": {
- "name": "LastName",
+ "Country": {
+ "name": "Country",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
"PostalCode": {
"name": "PostalCode",
@@ -262,27 +345,17 @@
}
},
"primaryKeys": [
- "EmployeeId"
+ "CustomerId"
],
"exportedKeys": [
{
"pkTableSchema": "default",
- "pkTableName": "employees",
- "pkColumnName": "EmployeeId",
- "pkName": "",
- "fkTableSchema": "default",
- "fkTableName": "customers",
- "fkColumnName": "SupportRepId",
- "fkName": ""
- },
- {
- "pkTableSchema": "default",
- "pkTableName": "employees",
- "pkColumnName": "EmployeeId",
+ "pkTableName": "customers",
+ "pkColumnName": "CustomerId",
"pkName": "",
"fkTableSchema": "default",
- "fkTableName": "employees",
- "fkColumnName": "ReportsTo",
+ "fkTableName": "invoices",
+ "fkColumnName": "CustomerId",
"fkName": ""
}
]
@@ -293,28 +366,28 @@
"schema": "default",
"name": "invoice_items",
"columns": {
- "InvoiceLineId": {
- "name": "InvoiceLineId",
+ "InvoiceId": {
+ "name": "InvoiceId",
"scalarType": "INTEGER",
"nullable": false
},
- "Quantity": {
- "name": "Quantity",
+ "TrackId": {
+ "name": "TrackId",
"scalarType": "INTEGER",
"nullable": false
},
- "UnitPrice": {
- "name": "UnitPrice",
- "scalarType": "FLOAT",
- "nullable": false
- },
- "InvoiceId": {
- "name": "InvoiceId",
+ "InvoiceLineId": {
+ "name": "InvoiceLineId",
"scalarType": "INTEGER",
"nullable": false
},
- "TrackId": {
- "name": "TrackId",
+ "UnitPrice": {
+ "name": "UnitPrice",
+ "scalarType": "FLOAT",
+ "nullable": false
+ },
+ "Quantity": {
+ "name": "Quantity",
"scalarType": "INTEGER",
"nullable": false
}
@@ -324,35 +397,35 @@
],
"exportedKeys": []
},
- "artists": {
+ "playlists": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "artists",
+ "name": "playlists",
"columns": {
- "ArtistId": {
- "name": "ArtistId",
- "scalarType": "INTEGER",
- "nullable": false
- },
"Name": {
"name": "Name",
"scalarType": "VARCHAR",
"nullable": true
+ },
+ "PlaylistId": {
+ "name": "PlaylistId",
+ "scalarType": "INTEGER",
+ "nullable": false
}
},
"primaryKeys": [
- "ArtistId"
+ "PlaylistId"
],
"exportedKeys": [
{
"pkTableSchema": "default",
- "pkTableName": "artists",
- "pkColumnName": "ArtistId",
+ "pkTableName": "playlists",
+ "pkColumnName": "PlaylistId",
"pkName": "",
"fkTableSchema": "default",
- "fkTableName": "albums",
- "fkColumnName": "ArtistId",
+ "fkTableName": "playlist_track",
+ "fkColumnName": "PlaylistId",
"fkName": ""
}
]
@@ -380,99 +453,21 @@
],
"exportedKeys": []
},
- "tracks": {
+ "media_types": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "tracks",
+ "name": "media_types",
"columns": {
- "Bytes": {
- "name": "Bytes",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "Milliseconds": {
- "name": "Milliseconds",
- "scalarType": "INTEGER",
- "nullable": false
- },
"MediaTypeId": {
"name": "MediaTypeId",
"scalarType": "INTEGER",
"nullable": false
},
- "AlbumId": {
- "name": "AlbumId",
- "scalarType": "INTEGER",
- "nullable": true
- },
- "TrackId": {
- "name": "TrackId",
- "scalarType": "INTEGER",
- "nullable": false
- },
- "UnitPrice": {
- "name": "UnitPrice",
- "scalarType": "FLOAT",
- "nullable": false
- },
- "Composer": {
- "name": "Composer",
- "scalarType": "VARCHAR",
- "nullable": true
- },
- "Name": {
- "name": "Name",
- "scalarType": "VARCHAR",
- "nullable": false
- },
- "GenreId": {
- "name": "GenreId",
- "scalarType": "INTEGER",
- "nullable": true
- }
- },
- "primaryKeys": [
- "TrackId"
- ],
- "exportedKeys": [
- {
- "pkTableSchema": "default",
- "pkTableName": "tracks",
- "pkColumnName": "TrackId",
- "pkName": "",
- "fkTableSchema": "default",
- "fkTableName": "invoice_items",
- "fkColumnName": "TrackId",
- "fkName": ""
- },
- {
- "pkTableSchema": "default",
- "pkTableName": "tracks",
- "pkColumnName": "TrackId",
- "pkName": "",
- "fkTableSchema": "default",
- "fkTableName": "playlist_track",
- "fkColumnName": "TrackId",
- "fkName": ""
- }
- ]
- },
- "media_types": {
- "physicalSchema": "default",
- "catalog": "",
- "schema": "default",
- "name": "media_types",
- "columns": {
"Name": {
"name": "Name",
"scalarType": "VARCHAR",
"nullable": true
- },
- "MediaTypeId": {
- "name": "MediaTypeId",
- "scalarType": "INTEGER",
- "nullable": false
}
},
"primaryKeys": [
@@ -491,106 +486,110 @@
}
]
},
- "albums": {
+ "employees": {
"physicalSchema": "default",
"catalog": "",
"schema": "default",
- "name": "albums",
+ "name": "employees",
"columns": {
+ "PostalCode": {
+ "name": "PostalCode",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "BirthDate": {
+ "name": "BirthDate",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ },
"Title": {
"name": "Title",
"scalarType": "VARCHAR",
- "nullable": false
+ "nullable": true
},
- "AlbumId": {
- "name": "AlbumId",
+ "ReportsTo": {
+ "name": "ReportsTo",
"scalarType": "INTEGER",
- "nullable": false
+ "nullable": true
},
- "ArtistId": {
- "name": "ArtistId",
+ "State": {
+ "name": "State",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "HireDate": {
+ "name": "HireDate",
+ "scalarType": "TIMESTAMP",
+ "nullable": true
+ },
+ "EmployeeId": {
+ "name": "EmployeeId",
"scalarType": "INTEGER",
"nullable": false
- }
- },
- "primaryKeys": [
- "AlbumId"
- ],
- "exportedKeys": [
- {
- "pkTableSchema": "default",
- "pkTableName": "albums",
- "pkColumnName": "AlbumId",
- "pkName": "",
- "fkTableSchema": "default",
- "fkTableName": "tracks",
- "fkColumnName": "AlbumId",
- "fkName": ""
- }
- ]
- },
- "playlists": {
- "physicalSchema": "default",
- "catalog": "",
- "schema": "default",
- "name": "playlists",
- "columns": {
- "PlaylistId": {
- "name": "PlaylistId",
- "scalarType": "INTEGER",
+ },
+ "FirstName": {
+ "name": "FirstName",
+ "scalarType": "VARCHAR",
"nullable": false
},
- "Name": {
- "name": "Name",
+ "Email": {
+ "name": "Email",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "City": {
+ "name": "City",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "Phone": {
+ "name": "Phone",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "Fax": {
+ "name": "Fax",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "Country": {
+ "name": "Country",
+ "scalarType": "VARCHAR",
+ "nullable": true
+ },
+ "LastName": {
+ "name": "LastName",
+ "scalarType": "VARCHAR",
+ "nullable": false
+ },
+ "Address": {
+ "name": "Address",
"scalarType": "VARCHAR",
"nullable": true
}
},
"primaryKeys": [
- "PlaylistId"
+ "EmployeeId"
],
"exportedKeys": [
{
"pkTableSchema": "default",
- "pkTableName": "playlists",
- "pkColumnName": "PlaylistId",
+ "pkTableName": "employees",
+ "pkColumnName": "EmployeeId",
"pkName": "",
"fkTableSchema": "default",
- "fkTableName": "playlist_track",
- "fkColumnName": "PlaylistId",
+ "fkTableName": "customers",
+ "fkColumnName": "SupportRepId",
"fkName": ""
- }
- ]
- },
- "genres": {
- "physicalSchema": "default",
- "catalog": "",
- "schema": "default",
- "name": "genres",
- "columns": {
- "GenreId": {
- "name": "GenreId",
- "scalarType": "INTEGER",
- "nullable": false
},
- "Name": {
- "name": "Name",
- "scalarType": "VARCHAR",
- "nullable": true
- }
- },
- "primaryKeys": [
- "GenreId"
- ],
- "exportedKeys": [
{
"pkTableSchema": "default",
- "pkTableName": "genres",
- "pkColumnName": "GenreId",
+ "pkTableName": "employees",
+ "pkColumnName": "EmployeeId",
"pkName": "",
"fkTableSchema": "default",
- "fkTableName": "tracks",
- "fkColumnName": "GenreId",
+ "fkTableName": "employees",
+ "fkColumnName": "ReportsTo",
"fkName": ""
}
]
diff --git a/adapters/jdbc/model.json b/adapters/jdbc/model.json
index 3d4961d..beeda7f 100644
--- a/adapters/jdbc/model.json
+++ b/adapters/jdbc/model.json
@@ -8,7 +8,7 @@
"type": "jdbc",
"jdbcDriver": "org.sqlite.JDBC",
"sqlDialectFactory": "com.hasura.SQLiteSqlDialectFactory",
- "jdbcUrl": "jdbc:sqlite:/Users/kennethstott/Documents/GitHub/ndc-calcite3/adapters/jdbc/chinook.db"
+ "jdbcUrl": "jdbc:sqlite:/Users/kennethstott/Documents/GitHub/calcite-connector/adapters/jdbc/chinook.db"
}
]
}
\ No newline at end of file
diff --git a/calcite-rs-jni/bigquery/pom.xml b/calcite-rs-jni/bigquery/pom.xml
index ba5e892..113fcac 100644
--- a/calcite-rs-jni/bigquery/pom.xml
+++ b/calcite-rs-jni/bigquery/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.kenstott
+ com.hasura
bigquery-jdbc
1.0-SNAPSHOT
diff --git a/calcite-rs-jni/calcite b/calcite-rs-jni/calcite
index ca4decf..4f7db81 160000
--- a/calcite-rs-jni/calcite
+++ b/calcite-rs-jni/calcite
@@ -1 +1 @@
-Subproject commit ca4decfd4aa9270c9a8ccdd0c3d90ac468999c09
+Subproject commit 4f7db81c6cde945ea05bf95477139864c74ba4f1
diff --git a/calcite-rs-jni/jdbc/pom.xml b/calcite-rs-jni/jdbc/pom.xml
new file mode 100644
index 0000000..c3a2471
--- /dev/null
+++ b/calcite-rs-jni/jdbc/pom.xml
@@ -0,0 +1,269 @@
+
+
+ 4.0.0
+
+
+ com.hasura
+ ndc-calcite
+ 1.0.0
+
+
+ graphql-jdbc-driver
+ jar
+
+
+ UTF-8
+ 11
+ 11
+ 1.38.0-SNAPSHOT
+
+
+
+
+ org.apache.calcite.avatica
+ avatica-core
+ 1.25.0
+
+
+ com.graphql-java
+ graphql-java
+ 22.3
+
+
+ com.graphql-java-kickstart
+ graphql-java-tools
+ 11.0.1
+
+
+ com.squareup.okhttp3
+ okhttp
+ 4.12.0
+
+
+ commons-codec
+ commons-codec
+ 1.15
+
+
+ com.jayway.jsonpath
+ json-path
+ 2.3.0
+
+
+ com.google.guava
+ guava
+ 33.0.0-jre
+
+
+ org.locationtech.jts
+ jts-core
+ 1.18.1
+
+
+ org.codehaus.janino
+ janino
+ 3.1.6
+
+
+ org.apache.commons
+ commons-math3
+ 3.6.1
+
+
+
+ org.apache.commons
+ commons-text
+ 1.9
+
+
+
+ org.apache.calcite
+ calcite-core
+ ${calcite.version}
+
+
+ org.apache.calcite
+ calcite-graphql
+ ${calcite.version}
+
+
+ org.apache.calcite
+ calcite-linq4j
+ ${calcite.version}
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.14.1
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.14.1
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
+
+
+
+ src/main/resources
+ false
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+
+ install-calcite-core
+ initialize
+
+ exec
+
+
+ mvn
+
+ install:install-file
+ -Dfile=${project.basedir}/../calcite/core/build/libs/calcite-core-${calcite.version}.jar
+ -DgroupId=org.apache.calcite
+ -DartifactId=calcite-core
+ -Dversion=${calcite.version}
+ -Dpackaging=jar
+
+
+
+
+ install-calcite-graphql
+ initialize
+
+ exec
+
+
+ mvn
+
+ install:install-file
+ -Dfile=${project.basedir}/../calcite/graphql/build/libs/calcite-graphql-${calcite.version}.jar
+ -DgroupId=org.apache.calcite
+ -DartifactId=calcite-graphql
+ -Dversion=${calcite.version}
+ -Dpackaging=jar
+
+
+
+
+ install-calcite-linq4j
+ initialize
+
+ exec
+
+
+ mvn
+
+ install:install-file
+ -Dfile=${project.basedir}/../calcite/linq4j/build/libs/calcite-linq4j-${calcite.version}.jar
+ -DgroupId=org.apache.calcite
+ -DartifactId=calcite-linq4j
+ -Dversion=${calcite.version}
+ -Dpackaging=jar
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+
+ false
+
+
+
+
+ maven-assembly-plugin
+ 3.6.0
+
+
+ jar-with-dependencies
+
+
+
+ true
+
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calcite-rs-jni/jdbc/src/main/java/com/hasura/GraphQLDriver.java b/calcite-rs-jni/jdbc/src/main/java/com/hasura/GraphQLDriver.java
new file mode 100644
index 0000000..b33e858
--- /dev/null
+++ b/calcite-rs-jni/jdbc/src/main/java/com/hasura/GraphQLDriver.java
@@ -0,0 +1,96 @@
+package com.hasura;
+
+import org.apache.calcite.adapter.graphql.GraphQLSchemaFactory;
+import org.apache.calcite.avatica.AvaticaConnection;
+import org.apache.calcite.avatica.DriverVersion;
+import org.apache.calcite.avatica.Meta;
+import org.apache.calcite.avatica.UnregisteredDriver;
+import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.schema.SchemaPlus;
+
+import java.sql.*;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.logging.Logger;
+
+public class GraphQLDriver extends UnregisteredDriver implements Driver {
+ private static final String PREFIX = "jdbc:graphql:";
+
+ static {
+ try {
+ Class.forName("org.apache.calcite.avatica.remote.Driver");
+ Class.forName("org.apache.calcite.jdbc.Driver");
+ DriverManager.registerDriver(new GraphQLDriver());
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to register GraphQL JDBC driver", e);
+ }
+ }
+
+ @Override
+ protected String getConnectStringPrefix() {
+ return PREFIX;
+ }
+
+ @Override
+ protected DriverVersion createDriverVersion() {
+ return new DriverVersion(
+ "Hasura GraphQL JDBC Driver", // productName
+ "1.0", // productVersion
+ "Hasura GraphQL", // productName
+ "1.0", // driverVersion
+ true, // jdbcCompliant
+ 1, // majorVersion
+ 0, // minorVersion
+ 0, // buildVersion
+ 0 // serialVersionUID
+ );
+ }
+
+ @Override
+ public Connection connect(String url, Properties info) throws SQLException {
+ if (!acceptsURL(url)) {
+ return null;
+ }
+
+ String connectionUrl = url.substring(PREFIX.length());
+
+ Map operand = new HashMap<>();
+ operand.put("endpoint", connectionUrl);
+
+ if (info.containsKey("user")) {
+ operand.put("user", info.getProperty("user"));
+ }
+ if (info.containsKey("role")) {
+ operand.put("role", info.getProperty("role"));
+ }
+ if (info.containsKey("auth")) {
+ operand.put("auth", info.getProperty("auth"));
+ }
+
+ Properties calciteProps = new Properties();
+ calciteProps.setProperty("fun", "standard");
+
+ Connection connection = DriverManager.getConnection("jdbc:calcite:", calciteProps);
+ CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
+
+ SchemaPlus rootSchema = calciteConnection.getRootSchema();
+ GraphQLSchemaFactory factory = new GraphQLSchemaFactory();
+ SchemaPlus graphqlSchema = rootSchema.add("GRAPHQL",
+ factory.create(rootSchema, "GRAPHQL", operand));
+
+ calciteConnection.setSchema("GRAPHQL");
+
+ return connection;
+ }
+
+ @Override
+ public Logger getParentLogger() {
+ return null;
+ }
+
+ @Override
+ public Meta createMeta(AvaticaConnection connection) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/calcite-rs-jni/jdbc/src/main/resources/META-INF/services/java.sql.Driver b/calcite-rs-jni/jdbc/src/main/resources/META-INF/services/java.sql.Driver
new file mode 100644
index 0000000..944d0d5
--- /dev/null
+++ b/calcite-rs-jni/jdbc/src/main/resources/META-INF/services/java.sql.Driver
@@ -0,0 +1,3 @@
+com.hasura.GraphQLDriver
+org.apache.calcite.jdbc.Driver
+org.apache.calcite.avatica.remote.Driver
diff --git a/calcite-rs-jni/jdbc/src/main/resources/i18n/Parsing_en_US.properties b/calcite-rs-jni/jdbc/src/main/resources/i18n/Parsing_en_US.properties
new file mode 100644
index 0000000..d815181
--- /dev/null
+++ b/calcite-rs-jni/jdbc/src/main/resources/i18n/Parsing_en_US.properties
@@ -0,0 +1,29 @@
+#
+# This resource bundle is used for the query parsing code to produce i18n messages
+#
+# The keys have the format of rule class name and then message type within that. Most rules
+# will only have 1 or 2 message keys
+#
+# Please try and keep this sorted within rule class and use # between sections so the IDEA Ctrl-Alt-L reformat does not bunch
+# them too tightly.
+#
+# REMEMBER - a single quote ' in MessageFormat means things that are never replaced within them
+# so use 2 '' characters to make it one ' on output. This will take for the form ''{0}''
+#
+InvalidSyntax.noMessage=Invalid syntax at line {0} column {1}
+InvalidSyntax.full=Invalid syntax with ANTLR error ''{0}'' at line {1} column {2}
+
+InvalidSyntaxBail.noToken=Invalid syntax at line {0} column {1}
+InvalidSyntaxBail.full=Invalid syntax with offending token ''{0}'' at line {1} column {2}
+#
+InvalidSyntaxMoreTokens.noMessage=Invalid syntax encountered. There are extra tokens in the text that have not been consumed. Offending token at line {0} column {1}
+InvalidSyntaxMoreTokens.full=Invalid syntax encountered. There are extra tokens in the text that have not been consumed. Offending token ''{0}'' at line {1} column {2}
+#
+ParseCancelled.full=More than {0} ''{1}'' tokens have been presented. To prevent Denial Of Service attacks, parsing has been cancelled.
+ParseCancelled.tooDeep=More than {0} deep ''{1}'' rules have been entered. To prevent Denial Of Service attacks, parsing has been cancelled.
+ParseCancelled.tooManyChars=More than {0} characters have been presented. To prevent Denial Of Service attacks, parsing has been cancelled.
+#
+InvalidUnicode.trailingLeadingSurrogate=Invalid unicode encountered. Trailing surrogate must be preceded with a leading surrogate. Offending token ''{0}'' at line {1} column {2}
+InvalidUnicode.leadingTrailingSurrogate=Invalid unicode encountered. Leading surrogate must be followed by a trailing surrogate. Offending token ''{0}'' at line {1} column {2}
+InvalidUnicode.invalidCodePoint=Invalid unicode encountered. Not a valid code point. Offending token ''{0}'' at line {1} column {2}
+InvalidUnicode.incorrectEscape=Invalid unicode encountered. Incorrectly formatted escape sequence. Offending token ''{0}'' at line {1} column {2}
\ No newline at end of file
diff --git a/calcite-rs-jni/jdbc/src/test/java/JdbcTest.java b/calcite-rs-jni/jdbc/src/test/java/JdbcTest.java
new file mode 100644
index 0000000..9def04f
--- /dev/null
+++ b/calcite-rs-jni/jdbc/src/test/java/JdbcTest.java
@@ -0,0 +1,33 @@
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+public class JdbcTest {
+ public static void main(String[] args) {
+ // Database URL, username, and password
+ String url = "jdbc:graphql:http://localhost:3000/graphql";
+ String role = "admin";
+
+ try {
+ // Register JDBC driver
+ Class.forName("com.hasura.GraphQLDriver");
+
+ // Open a connection
+ System.out.println("Attempting to connect to database...");
+ Connection conn = DriverManager.getConnection(url);
+
+ if (conn != null) {
+ System.out.println("Database connection successful!");
+ System.out.println("Driver: " + conn.getMetaData().getDriverName());
+ System.out.println("Driver Version: " + conn.getMetaData().getDriverVersion());
+ conn.close();
+ }
+
+ } catch (ClassNotFoundException e) {
+ System.out.println("JDBC Driver not found.");
+ e.printStackTrace();
+ } catch (Exception e) {
+ System.out.println("Database connection failed!");
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/calcite-rs-jni/jni/logging.properties b/calcite-rs-jni/jni/logging.properties
new file mode 100644
index 0000000..e466c77
--- /dev/null
+++ b/calcite-rs-jni/jni/logging.properties
@@ -0,0 +1,24 @@
+# Global settings
+handlers = java.util.logging.ConsoleHandler
+.level = INFO
+
+# Calcite specific settings
+org.apache.calcite.level = FINE
+org.apache.calcite.plan.RelOptPlanner.level = FINE
+org.apache.calcite.sql.level = INFO
+org.apache.calcite.jdbc.level = INFO
+org.apache.calcite.prepare.level = INFO
+
+# Your GraphQL implementation logging
+com.hasura.graphql.level = INFO
+
+# Console handler settings
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+java.util.logging.SimpleFormatter.format = %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n
+
+# Suppress code generation output
+org.apache.calcite.adapter.enumerable.level = WARNING
+org.apache.calcite.rel.rel2sql.level = WARNING
+org.apache.calcite.prepare.Prepare.level = WARNING
+org.apache.calcite.sql2rel.level = WARNING
\ No newline at end of file
diff --git a/calcite-rs-jni/jni/pom.xml b/calcite-rs-jni/jni/pom.xml
index afb8f89..88e5a74 100644
--- a/calcite-rs-jni/jni/pom.xml
+++ b/calcite-rs-jni/jni/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
jar
- org.kenstott
+ com.hasura
calcite-rs-jni
1.0-SNAPSHOT
@@ -18,9 +18,9 @@
- org.kenstott
+ org.apache.calcite
calcite
- 1.0-SNAPSHOT
+ 1.38.0-SNAPSHOT
@@ -202,7 +202,7 @@
${project.basedir}/jars/jconn4.jar
- org.kenstott
+ com.hasura
bigquery-jdbc
1.0-SNAPSHOT
diff --git a/calcite-rs-jni/jni/src/main/java/com/hasura/CalciteModelPlanner.java b/calcite-rs-jni/jni/src/main/java/com/hasura/CalciteModelPlanner.java
new file mode 100644
index 0000000..e782952
--- /dev/null
+++ b/calcite-rs-jni/jni/src/main/java/com/hasura/CalciteModelPlanner.java
@@ -0,0 +1,176 @@
+package com.hasura;
+
+import org.apache.calcite.adapter.enumerable.EnumerableConvention;
+import org.apache.calcite.adapter.enumerable.EnumerableRules;
+import org.apache.calcite.adapter.graphql.GraphQLRules;
+import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.plan.RelOptPlanner;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.plan.hep.HepMatchOrder;
+import org.apache.calcite.plan.hep.HepProgramBuilder;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelRoot;
+import org.apache.calcite.rel.rules.CoreRules;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.parser.SqlParser;
+import org.apache.calcite.tools.*;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * CalciteModelPlanner is responsible for displaying query plans with optimization rules applied.
+ */
+public class CalciteModelPlanner {
+ /**
+ * Display the query plan for the given SQL statement using Calcite framework.
+ *
+ * @param modelPath the path to the model JSON file
+ * @param sql the SQL statement for which to generate the query plan
+ * @throws Exception if an error occurs during query plan generation
+ */
+ public static void displayQueryPlan(String modelPath, String sql) throws Exception {
+ Properties info = new Properties();
+ info.put("model", modelPath);
+
+ Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
+ CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
+ SchemaPlus rootSchema = calciteConnection.getRootSchema();
+
+ // Create rules list
+ List rules = new ArrayList<>();
+
+ // Add GraphQL rules
+ rules.add(GraphQLRules.TO_ENUMERABLE);
+ rules.addAll(GraphQLRules.RULES);
+
+ // Add core conversion rules
+ rules.add(CoreRules.FILTER_INTO_JOIN);
+ rules.add(CoreRules.JOIN_CONDITION_PUSH);
+ rules.add(CoreRules.PROJECT_MERGE);
+ rules.add(CoreRules.PROJECT_SET_OP_TRANSPOSE);
+
+ // Add Enumerable conversion rules
+ rules.add(EnumerableRules.ENUMERABLE_PROJECT_RULE);
+ rules.add(EnumerableRules.ENUMERABLE_FILTER_RULE);
+ rules.add(EnumerableRules.ENUMERABLE_JOIN_RULE);
+ rules.add(EnumerableRules.ENUMERABLE_SORT_RULE);
+ rules.add(EnumerableRules.ENUMERABLE_TABLE_SCAN_RULE);
+ rules.add(EnumerableRules.ENUMERABLE_VALUES_RULE);
+
+ // Create RuleSet
+ RuleSet ruleSet = RuleSets.ofList(rules);
+
+ // Create program builder for transformation rules
+ HepProgramBuilder hepProgramBuilder = new HepProgramBuilder();
+ hepProgramBuilder.addMatchOrder(HepMatchOrder.TOP_DOWN);
+ rules.forEach(hepProgramBuilder::addRuleInstance);
+
+ // Create planner configuration
+ FrameworkConfig config = Frameworks.newConfigBuilder()
+ .defaultSchema(rootSchema)
+ .parserConfig(SqlParser.Config.DEFAULT)
+ .programs(Programs.sequence(
+ Programs.ofRules(rules),
+ Programs.ofRules(GraphQLRules.PROJECT_RULE),
+ Programs.ofRules(GraphQLRules.TO_ENUMERABLE)
+ ))
+ .build();
+
+ try {
+ // Parse and validate SQL
+ Planner planner = Frameworks.getPlanner(config);
+ SqlNode parsed = planner.parse(sql);
+ SqlNode validated = planner.validate(parsed);
+ RelRoot root = planner.rel(validated);
+ RelNode relNode = root.rel;
+
+ System.out.println("Initial plan:");
+ System.out.println(RelOptUtil.toString(relNode));
+
+ // Get the planner and add rules
+ RelOptPlanner planner2 = relNode.getCluster().getPlanner();
+ rules.forEach(planner2::addRule);
+
+ System.out.println("\nApplying rules...");
+
+ try {
+ // Log initial state
+ System.out.println("\nInitial RelNode traits: " + relNode.getTraitSet());
+ System.out.println("Initial RelNode digest: " + relNode.getDigest());
+
+ // Try optimization steps one at a time
+ RelNode currentNode = relNode;
+ RelTraitSet targetTraits = currentNode.getTraitSet()
+ .replace(EnumerableConvention.INSTANCE);
+
+ System.out.println("Target traits: " + targetTraits);
+
+ try {
+ // Attempt to change traits
+ currentNode = planner2.changeTraits(currentNode, targetTraits);
+ System.out.println("\nAfter trait change:");
+ System.out.println(RelOptUtil.toString(currentNode));
+ } catch (Exception e) {
+ System.out.println("Error during trait change: " + e.getMessage());
+ }
+
+ try {
+ // Set as root and optimize
+ System.out.println("\nSetting root node...");
+ planner2.setRoot(currentNode);
+ System.out.println("Root set successfully");
+ } catch (Exception e) {
+ System.out.println("Error setting root: " + e.getMessage());
+ throw e;
+ }
+
+ try {
+ // Find best expression
+ System.out.println("\nFinding best expression...");
+ RelNode optimized = planner2.findBestExp();
+ System.out.println("\nOptimized plan:");
+ System.out.println(RelOptUtil.toString(optimized));
+
+ // Check for GraphQLProject
+ String plan = RelOptUtil.toString(optimized);
+ if (plan.contains("GraphQLProject")) {
+ System.out.println("\nSuccess: Plan contains GraphQLProject");
+ } else {
+ System.out.println("\nWarning: Plan does not contain GraphQLProject");
+ System.out.println("Available rules:");
+ planner2.getRules().forEach(rule ->
+ System.out.println(" - " + rule.toString())
+ );
+ }
+ } catch (Exception e) {
+ System.out.println("Error finding best expression: " + e.getMessage());
+ throw e;
+ }
+
+ } catch (Exception e) {
+ System.out.println("Error during optimization:");
+ e.printStackTrace();
+
+ // Print planner state
+ System.out.println("\nPlanner rules:");
+ planner2.getRules().forEach(rule ->
+ System.out.println(" - " + rule.toString())
+ );
+
+ System.out.println("\nCurrent RelNode:");
+ System.out.println(RelOptUtil.toString(relNode));
+ }
+
+ } catch (Exception e) {
+ System.out.println("Error during initialization:");
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/calcite-rs-jni/jni/src/main/java/com/hasura/CalciteVerboseDebugger.java b/calcite-rs-jni/jni/src/main/java/com/hasura/CalciteVerboseDebugger.java
new file mode 100644
index 0000000..7a05910
--- /dev/null
+++ b/calcite-rs-jni/jni/src/main/java/com/hasura/CalciteVerboseDebugger.java
@@ -0,0 +1,51 @@
+package com.hasura;
+import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.schema.Table;
+import java.sql.*;
+import java.util.Properties;
+
+public class CalciteVerboseDebugger {
+ public static void debugVerbose(String modelPath) throws Exception {
+ Properties info = new Properties();
+ info.put("model", modelPath);
+
+ try (Connection connection = DriverManager.getConnection("jdbc:calcite:", info)) {
+ CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
+ SchemaPlus rootSchema = calciteConnection.getRootSchema();
+
+ System.out.println("=== Calcite Configuration Debug ===");
+ System.out.println("Model path: " + modelPath);
+
+ // Print connection info
+ System.out.println("\nConnection Properties:");
+ info.forEach((k, v) -> System.out.println(k + ": " + v));
+
+ // Print schema details
+ System.out.println("\nSchema Structure:");
+ rootSchema.getSubSchemaNames().forEach(schemaName -> {
+ System.out.println("\nSchema: " + schemaName);
+ SchemaPlus schema = rootSchema.getSubSchema(schemaName);
+
+ System.out.println("Tables:");
+ schema.getTableNames().forEach(tableName -> {
+ Table table = schema.getTable(tableName);
+ System.out.println(" - " + tableName);
+ System.out.println(" Type: " + table.getClass().getName());
+ System.out.println(" Rowtype: " + table.getRowType(calciteConnection.getTypeFactory()));
+ });
+ });
+
+ // Try to get database metadata
+ DatabaseMetaData metaData = connection.getMetaData();
+ System.out.println("\nDatabase Metadata:");
+ try (ResultSet tables = metaData.getTables(null, null, null, new String[]{"TABLE"})) {
+ while (tables.next()) {
+ String tableSchema = tables.getString("TABLE_SCHEM");
+ String tableName = tables.getString("TABLE_NAME");
+ System.out.println("Found table: " + tableSchema + "." + tableName);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/calcite-rs-jni/jni/src/main/java/com/hasura/JdbcTest.java b/calcite-rs-jni/jni/src/main/java/com/hasura/JdbcTest.java
new file mode 100644
index 0000000..b078b87
--- /dev/null
+++ b/calcite-rs-jni/jni/src/main/java/com/hasura/JdbcTest.java
@@ -0,0 +1,143 @@
+package com.hasura;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class JdbcTest {
+ public static void printDatabaseMetadata(Connection conn) throws SQLException {
+ // Previous metadata code remains the same
+ DatabaseMetaData metaData = conn.getMetaData();
+
+ System.out.println("\n=== Schemas ===");
+ ResultSet schemas = metaData.getSchemas();
+ while (schemas.next()) {
+ String schemaName = schemas.getString("TABLE_SCHEM");
+ System.out.println("\nSchema: " + schemaName);
+
+ ResultSet tables = metaData.getTables(null, schemaName, null, new String[]{"TABLE"});
+ while (tables.next()) {
+ String tableName = tables.getString("TABLE_NAME");
+ System.out.println("\n Table: " + tableName);
+
+ ResultSet columns = metaData.getColumns(null, schemaName, tableName, null);
+ System.out.println(" Columns:");
+ while (columns.next()) {
+ String columnName = columns.getString("COLUMN_NAME");
+ String dataType = columns.getString("TYPE_NAME");
+ int size = columns.getInt("COLUMN_SIZE");
+ boolean nullable = columns.getInt("NULLABLE") == DatabaseMetaData.columnNullable;
+
+ System.out.printf(" - %s (%s, size: %d, nullable: %s)%n",
+ columnName, dataType, size, nullable);
+ }
+
+ ResultSet primaryKeys = metaData.getPrimaryKeys(null, schemaName, tableName);
+ System.out.println(" Primary Keys:");
+ while (primaryKeys.next()) {
+ String columnName = primaryKeys.getString("COLUMN_NAME");
+ String pkName = primaryKeys.getString("PK_NAME");
+ System.out.printf(" - %s (constraint: %s)%n", columnName, pkName);
+ }
+
+ ResultSet foreignKeys = metaData.getImportedKeys(null, schemaName, tableName);
+ System.out.println(" Foreign Keys:");
+ while (foreignKeys.next()) {
+ String fkColumnName = foreignKeys.getString("FKCOLUMN_NAME");
+ String pkTableName = foreignKeys.getString("PKTABLE_NAME");
+ String pkColumnName = foreignKeys.getString("PKCOLUMN_NAME");
+ System.out.printf(" - %s -> %s.%s%n",
+ fkColumnName, pkTableName, pkColumnName);
+ }
+ }
+ }
+ }
+
+ public static void printAlbumsTable(Connection conn) throws SQLException {
+ System.out.println("\n=== Albums Table Data ===");
+
+ try (Statement stmt = conn.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT * FROM \"Albums\"")) {
+
+ // Get metadata for columns
+ ResultSetMetaData rsMetaData = rs.getMetaData();
+ int columnCount = rsMetaData.getColumnCount();
+
+ // Store column names and initialize widths
+ String[] columnNames = new String[columnCount];
+ int[] columnWidths = new int[columnCount];
+ for (int i = 1; i <= columnCount; i++) {
+ columnNames[i-1] = rsMetaData.getColumnName(i);
+ columnWidths[i-1] = columnNames[i-1].length();
+ }
+
+ // Store all rows while calculating column widths
+ List rows = new ArrayList<>();
+ while (rs.next()) {
+ String[] row = new String[columnCount];
+ for (int i = 1; i <= columnCount; i++) {
+ String value = rs.getString(i);
+ row[i-1] = (value != null ? value : "NULL");
+ columnWidths[i-1] = Math.max(columnWidths[i-1], row[i-1].length());
+ }
+ rows.add(row);
+ }
+
+ // Print headers
+ for (int i = 0; i < columnCount; i++) {
+ System.out.printf("| %-" + columnWidths[i] + "s ", columnNames[i]);
+ }
+ System.out.println("|");
+
+ // Print separator line
+ for (int width : columnWidths) {
+ System.out.print("+");
+ System.out.print("-".repeat(width + 2));
+ }
+ System.out.println("+");
+
+ // Print data
+ for (String[] row : rows) {
+ for (int i = 0; i < columnCount; i++) {
+ System.out.printf("| %-" + columnWidths[i] + "s ", row[i]);
+ }
+ System.out.println("|");
+ }
+ }
+ }
+
+ public static void test() {
+ String url = "jdbc:graphql:http://localhost:3000/graphql";
+ String role = "admin";
+
+ try {
+ Class.forName("com.hasura.GraphQLDriver");
+
+ Properties properties = new Properties();
+ properties.setProperty("role", role);
+
+ System.out.println("Attempting to connect to database...");
+ try (Connection conn = DriverManager.getConnection(url, properties)) {
+ if (conn != null) {
+ System.out.println("Database connection successful!");
+ System.out.println("Driver: " + conn.getMetaData().getDriverName());
+ System.out.println("Driver Version: " + conn.getMetaData().getDriverVersion());
+
+ // Print database metadata
+ printDatabaseMetadata(conn);
+
+ // Print albums table data
+ printAlbumsTable(conn);
+ }
+ }
+
+ } catch (ClassNotFoundException e) {
+ System.out.println("JDBC Driver not found.");
+ e.printStackTrace();
+ } catch (Exception e) {
+ System.out.println("Database connection failed!");
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/calcite-rs-jni/jni/src/main/java/com/hasura/Main.java b/calcite-rs-jni/jni/src/main/java/com/hasura/Main.java
index 88282c4..8ffc35d 100644
--- a/calcite-rs-jni/jni/src/main/java/com/hasura/Main.java
+++ b/calcite-rs-jni/jni/src/main/java/com/hasura/Main.java
@@ -12,24 +12,43 @@
public class Main {
public static void main(String[] args) throws IOException, SQLException, ClassNotFoundException {
- String modelPath = "../../adapters/file/model.json";
+ JdbcTest.test();
+
+ String modelPath = "../../adapters/graphql/model.json";
String username = "";
String password = "";
Connection calciteConnection = null;
try {
+ String sql = "SELECT al.\"albumId\", al.\"title\"\n" +
+ ", COUNT(tr.\"trackId\") AS trackCount\n" +
+ "FROM \"graphql\".\"Albums\" al\n" +
+ "JOIN \"graphql\".\"Tracks\" tr ON al.\"albumId\" = tr.\"albumId\"\n" +
+ "WHERE al.\"albumId\" > 200\n" +
+ "GROUP BY al.\"albumId\", al.\"title\"\n" +
+ "ORDER BY trackCount\n" +
+ "OFFSET 1 ROWS\n" +
+ "FETCH NEXT 150 ROWS ONLY\n";
+ CalciteVerboseDebugger.debugVerbose(modelPath);
+ try {
+ System.out.println("************QUERY PLANNER************");
+ CalciteModelPlanner.displayQueryPlan(modelPath, sql);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("************EXECUTE QUERY************");
CalciteQuery query = new CalciteQuery();
- calciteConnection = query.createCalciteConnection(modelPath);
+ try {
+ calciteConnection = query.createCalciteConnection(modelPath);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
String x = query.getModels();
System.out.println(x);
- String q1 = "SELECT \"default\".\"LONG_EMPS\".\"AGE\" AS \"AGE\",\"default\".\"LONG_EMPS\".\"CITY\" AS \"CITY\",\"default\".\"LONG_EMPS\".\"DEPTNO\" AS \"DEPTNO\",\"default\".\"LONG_EMPS\".\"EMPID\" AS \"EMPID\",\"default\".\"LONG_EMPS\".\"EMPNO\" AS \"EMPNO\",\"default\".\"LONG_EMPS\".\"GENDER\" AS \"GENDER\",\"default\".\"LONG_EMPS\".\"JOINEDAT\" AS \"JOINEDAT\",\"default\".\"LONG_EMPS\".\"MANAGER\" AS \"MANAGER\",\"default\".\"LONG_EMPS\".\"NAME\" AS \"NAME\",\"default\".\"LONG_EMPS\".\"SLACKER\" AS \"SLACKER\" FROM \"default\".\"LONG_EMPS\" WHERE \"JOINEDAT\" IN (__UTF8__1996-08-03__UTF8__,__UTF8__2001-01-01__UTF8__) LIMIT 10";
- String z1 = query.queryModels(q1);
+
+ String z1 = query.queryModels(sql);
System.out.println(z1);
-// String z2 = query.queryModels("""
-// SELECT "CustomerId" from "FILE"."TEST"
-// """
-// );
-// System.out.println(z2);
calciteConnection.close();
calciteConnection = null;
} catch (Exception e) {
diff --git a/calcite-rs-jni/jni/src/main/resources/log4j.xml b/calcite-rs-jni/jni/src/main/resources/log4j.xml
index 5013bd2..b17b610 100644
--- a/calcite-rs-jni/jni/src/main/resources/log4j.xml
+++ b/calcite-rs-jni/jni/src/main/resources/log4j.xml
@@ -14,13 +14,13 @@
-
+
-
+
\ No newline at end of file
diff --git a/calcite-rs-jni/jni/src/main/resources/log4j2.xml b/calcite-rs-jni/jni/src/main/resources/log4j2.xml
index b92b95b..92d430e 100644
--- a/calcite-rs-jni/jni/src/main/resources/log4j2.xml
+++ b/calcite-rs-jni/jni/src/main/resources/log4j2.xml
@@ -8,9 +8,9 @@
-
+
-
+
diff --git a/calcite-rs-jni/pom.xml b/calcite-rs-jni/pom.xml
index 24c79a0..01b1b85 100644
--- a/calcite-rs-jni/pom.xml
+++ b/calcite-rs-jni/pom.xml
@@ -4,9 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
ndc-calcite
- org.kenstott
+ com.hasura
1.0.0
pom
+
@@ -16,10 +17,12 @@
+
./jni
./bigquery
./calcite
+ ./jdbc
diff --git a/crates/cli/assets/models/model.json b/crates/cli/assets/models/model.json
index 897980e..77bec2d 100644
--- a/crates/cli/assets/models/model.json
+++ b/crates/cli/assets/models/model.json
@@ -6,7 +6,7 @@
"name": "default",
"cache": true,
"type": "jdbc",
- "sqlDialectFactory": "org.kenstott.SQLiteSqlDialectFactory",
+ "sqlDialectFactory": "com.hasura.SQLiteSqlDialectFactory",
"jdbcUrl": "jdbc:sqlite:/etc/connector/data/chinook.db"
}
]
diff --git a/crates/cli/assets/models/model.sqlite.json b/crates/cli/assets/models/model.sqlite.json
index 44bb3c1..bdcbcaf 100644
--- a/crates/cli/assets/models/model.sqlite.json
+++ b/crates/cli/assets/models/model.sqlite.json
@@ -6,7 +6,7 @@
"name": "default",
"cache": true,
"type": "jdbc",
- "sqlDialectFactory": "org.kenstott.SQLiteSqlDialectFactory",
+ "sqlDialectFactory": "com.hasura.SQLiteSqlDialectFactory",
"jdbcUrl": "jdbc:sqlite:./data/chinook.db"
}
]
diff --git a/grafana/compose.yaml b/grafana/compose.yaml
index e6103e7..ada7a65 100644
--- a/grafana/compose.yaml
+++ b/grafana/compose.yaml
@@ -15,6 +15,8 @@ services:
tempo:
image: *tempoImage
command: [ "-config.file=/etc/tempo.yaml" ]
+ environment:
+ - TEMPO_QUERY_FRONTEND_SEARCH_MAX_QUERY_DEPTH=10
volumes:
- ../shared/tempo.yaml:/etc/tempo.yaml
- ./tempo-data:/var/tempo
diff --git a/shared/tempo.yaml b/shared/tempo.yaml
index bfd6e7f..51a877f 100644
--- a/shared/tempo.yaml
+++ b/shared/tempo.yaml
@@ -57,7 +57,5 @@ storage:
path: /var/tempo/blocks
overrides:
- defaults:
- metrics_generator:
- processors: [service-graphs, span-metrics, local-blocks] # enables metrics generator
- generate_native_histograms: both
\ No newline at end of file
+ metrics_generator_processors: [service-graphs, span-metrics, local-blocks]
+ metrics_generator_generate_native_histograms: both
\ No newline at end of file