Repository: phoenix Updated Branches: refs/heads/calcite 6f23af898 -> efd68ab1d
PHOENIX-3700 Implement getConnectioInfo methods in PhoenixCalciteConnection(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/efd68ab1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/efd68ab1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/efd68ab1 Branch: refs/heads/calcite Commit: efd68ab1d03f00455d89114d2b5379942f37253b Parents: 6f23af8 Author: Rajeshbabu Chintaguntla <[email protected]> Authored: Sun Mar 12 14:29:22 2017 +0530 Committer: Rajeshbabu Chintaguntla <[email protected]> Committed: Sun Mar 12 14:29:22 2017 +0530 ---------------------------------------------------------------------- .../calcite/jdbc/PhoenixCalciteFactory.java | 31 ++++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/efd68ab1/phoenix-core/src/main/java/org/apache/calcite/jdbc/PhoenixCalciteFactory.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/calcite/jdbc/PhoenixCalciteFactory.java b/phoenix-core/src/main/java/org/apache/calcite/jdbc/PhoenixCalciteFactory.java index 7839cb8..5e04281 100644 --- a/phoenix-core/src/main/java/org/apache/calcite/jdbc/PhoenixCalciteFactory.java +++ b/phoenix-core/src/main/java/org/apache/calcite/jdbc/PhoenixCalciteFactory.java @@ -297,17 +297,42 @@ public class PhoenixCalciteFactory extends CalciteFactory { @Override public DatabaseMetaData getMetaData() throws SQLException { + PhoenixConnection pc = getPhoenixConnection(getRootSchema()); + if(pc != null) { + return pc.getMetaData(); + } + return super.getMetaData(); + } + + @Override + public Properties getClientInfo() throws SQLException { + PhoenixConnection pc = getPhoenixConnection(getRootSchema()); + if(pc != null) { + return pc.getClientInfo(); + } + return super.getClientInfo(); + } + + @Override + public String getClientInfo(String name) throws SQLException { + PhoenixConnection pc = getPhoenixConnection(getRootSchema()); + if(pc != null) { + return pc.getClientInfo(name); + } + return super.getClientInfo(name); + } + + private PhoenixConnection getPhoenixConnection(SchemaPlus rootSchema) { for (String subSchemaName : getRootSchema().getSubSchemaNames()) { try { PhoenixSchema phoenixSchema = getRootSchema().getSubSchema(subSchemaName).unwrap(PhoenixSchema.class); - return phoenixSchema.pc.getMetaData(); + return phoenixSchema.pc; } catch (ClassCastException e) { } } - return super.getMetaData(); + return null; } - @SuppressWarnings("unchecked") @Override public <T> T unwrap(Class<T> iface) throws SQLException {
