[
https://issues.apache.org/jira/browse/CALCITE-3778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladimir Sitnikov updated CALCITE-3778:
---------------------------------------
Issue Type: New Feature (was: Wish)
> Provide ways to view the physical SQLs sent to database
> -------------------------------------------------------
>
> Key: CALCITE-3778
> URL: https://issues.apache.org/jira/browse/CALCITE-3778
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Reporter: jerryleooo
> Priority: Minor
> Labels: newbie
>
> I am using Calcite JDBC, when executing a multiple join, I want to check if
> the queries/SQLs sent to databases are right. Currently seems there is no
> easy way to do this.
> I have enabled 'calcite.debug=true' but it just gave me some Java code.
> {code:java}
> val connection = DriverManager.getConnection("jdbc:calcite:")
> val calciteConnection = connection.asInstanceOf[CalciteConnection]
> val rootSchema = calciteConnection.getRootSchema()
> val dsInsightUser =
> JdbcSchema.dataSource("jdbc:mysql://localhost:13306/insight?useSSL=false&serverTimezone=UTC",
> "com.mysql.jdbc.Driver", "insight_admin","xxxxxx")
> val dsPerm =
> JdbcSchema.dataSource("jdbc:mysql://localhost:13307/permission?useSSL=false&serverTimezone=UTC",
> "com.mysql.jdbc.Driver", "perm_admin", "xxxxxx")
> rootSchema.add("insight_user", JdbcSchema.create(rootSchema, "insight_user",
> dsInsightUser, null, null))
> rootSchema.add("perm", JdbcSchema.create(rootSchema, "perm", dsPerm, null,
> null)) val stmt = connection.createStatement()
> val rs = stmt.executeQuery("""explain plan for select "perm"."user_table".*
> from "perm"."user_table" join "insight_user"."user_tab" on
> "perm"."user_table"."id"="insight_user"."user_tab"."id" """)
> val metaData = rs.getMetaData()
> while(rs.next()) {
> for(i <- 1 to metaData.getColumnCount) printf("%s ", rs.getObject(i))
> println()
> }
> {code}
> Tried post the same question on Stackoverflow and mail list but got few
> replies, so tried here, forgive my taking the liberty.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)