Repository: phoenix Updated Branches: refs/heads/calcite 483de89a7 -> 1b8aca732
Revert "PHOENIX-3700 Implement getConnectioInfo methods in PhoenixCalciteConnection(Rajeshbabu)" This reverts commit 483de89a7dd0cd5e6e17df0631bb68b6bfa2221d. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1b8aca73 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1b8aca73 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1b8aca73 Branch: refs/heads/calcite Commit: 1b8aca732b344162ad59e2a561cb2e1b6d552026 Parents: 483de89 Author: Rajeshbabu Chintaguntla <[email protected]> Authored: Tue Feb 28 16:15:17 2017 +0530 Committer: Rajeshbabu Chintaguntla <[email protected]> Committed: Tue Feb 28 16:15:17 2017 +0530 ---------------------------------------------------------------------- .../calcite/jdbc/PhoenixCalciteFactory.java | 31 ++------------------ .../apache/phoenix/calcite/CalciteUtils.java | 13 -------- .../apache/phoenix/calcite/PhoenixSchema.java | 15 +--------- 3 files changed, 4 insertions(+), 55 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b8aca73/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 92ad86a..15d8b83 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,42 +297,17 @@ 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; + return phoenixSchema.pc.getMetaData(); } catch (ClassCastException e) { } } - return null; + return super.getMetaData(); } + @SuppressWarnings("unchecked") @Override public <T> T unwrap(Class<T> iface) throws SQLException { http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b8aca73/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java index b49ca28..1b6937b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java @@ -908,19 +908,6 @@ public class CalciteUtils { return new CoalesceFunction(children); } else if (op == SqlStdOperatorTable.MOD) { return new ModulusExpression(children); - } else if (op == SqlStdOperatorTable.CAST) { - PDataType targetType = relDataTypeToPDataType(node.getType()); - Integer maxLength = - (targetType == PChar.INSTANCE - || targetType == PCharArray.INSTANCE - || targetType == PBinary.INSTANCE - || targetType == PBinaryArray.INSTANCE) ? - node.getType().getPrecision() : null; - try { - return cast(targetType, maxLength, children.get(0), implementor); - } catch (SQLException e) { - throw new RuntimeException(e); - } }; } catch (SQLException e) { throw new RuntimeException(e); http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b8aca73/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java index 63f72a2..d88f226 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java @@ -185,10 +185,7 @@ public class PhoenixSchema implements Schema { if(ignoredRegexFunctions.contains(info.getFunc().getName())){ continue; } - List<PhoenixScalarFunction> convertBuiltinFunction = convertBuiltinFunction(info); - if(convertBuiltinFunction!=null) { - builtinFunctions.putAll(info.getName(), convertBuiltinFunction); - } + builtinFunctions.putAll(info.getName(), convertBuiltinFunction(info)); } } // Single depth alias functions only @@ -216,16 +213,6 @@ public class PhoenixSchema implements Schema { Class<? extends FunctionExpression> clazz = functionInfo.getFunc(); try { - if(overloadedArgs.isEmpty()) { - PDataType returnType = null; - try{ - returnType = evaluateReturnType(clazz, new ArrayList<PFunction.FunctionArgument>(1)); - } catch(Exception e) { - return null; - } - functionList.add(new PhoenixScalarFunction(functionInfo, new ArrayList<FunctionParameter>(1), returnType)); - return functionList; - } for (List<FunctionArgument> argumentList : overloadedArgs) { List<FunctionParameter> parameters = Lists.newArrayListWithExpectedSize(argumentList.size()); PDataType returnType = evaluateReturnType(clazz, argumentList);
