@Test public void testGetConnection() throws SQLException, IllegalAccessException { Connection connection = QueryConnection.getConnection("default"); assertNotNull(connection); Map<InternalProperty, Object> properties = dirtyReadProperties(connection); assertEquals(true, properties.get(InternalProperty.CASE_SENSITIVE)); assertEquals(Casing.TO_UPPER, properties.get(InternalProperty.UNQUOTED_CASING)); assertEquals(Quoting.DOUBLE_QUOTE, properties.get(InternalProperty.QUOTING)); ResultSet resultSet = connection.prepareStatement(SQL_WITH_MIXED_CASE).executeQuery(); String columnName = resultSet.getMetaData().getColumnName(1); assertEquals("VALUE_ALIAS", columnName); KylinConfig conf = KylinConfig.getInstanceFromEnv(); conf.setProperty("kylin.query.calcite.extras-props.caseSensitive", "false"); conf.setProperty("kylin.query.calcite.extras-props.unquotedCasing", "UNCHANGED"); conf.setProperty("kylin.query.calcite.extras-props.quoting", "BRACKET"); Connection conn2 = QueryConnection.getConnection("default"); Map<InternalProperty, Object> props = dirtyReadProperties(conn2); assertEquals(false, props.get(InternalProperty.CASE_SENSITIVE)); assertEquals(Casing.UNCHANGED, props.get(InternalProperty.UNQUOTED_CASING)); assertEquals(Quoting.BRACKET, props.get(InternalProperty.QUOTING)); ResultSet resultSet1 = conn2.prepareStatement(SQL_WITH_MIXED_CASE).executeQuery(); assertEquals("value_ALIAS", resultSet1.getMetaData().getColumnName(1)); }
public static Connection getConnection(String project) throws SQLException { if (!isRegister) { try { Class<?> aClass = Thread.currentThread().getContextClassLoader() .loadClass("org.apache.calcite.jdbc.Driver"); Driver o = (Driver) aClass.getDeclaredConstructor().newInstance(); DriverManager.registerDriver(o); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { e.printStackTrace(); } isRegister = true; } File olapTmp = OLAPSchemaFactory.createTempOLAPJson(project, KylinConfig.getInstanceFromEnv()); Properties info = new Properties(); info.putAll(KylinConfig.getInstanceFromEnv().getCalciteExtrasProperties()); info.putAll(BackdoorToggles.getJdbcDriverClientCalciteProps()); info.put("model", olapTmp.getAbsolutePath()); info.put("typeSystem", "org.apache.kylin.query.calcite.KylinRelDataTypeSystem"); return DriverManager.getConnection("jdbc:calcite:", info); }
QueryConnection { public static Connection getConnection(String project) throws SQLException { if (!isRegister) { try { Class<?> aClass = Thread.currentThread().getContextClassLoader() .loadClass("org.apache.calcite.jdbc.Driver"); Driver o = (Driver) aClass.getDeclaredConstructor().newInstance(); DriverManager.registerDriver(o); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { e.printStackTrace(); } isRegister = true; } File olapTmp = OLAPSchemaFactory.createTempOLAPJson(project, KylinConfig.getInstanceFromEnv()); Properties info = new Properties(); info.putAll(KylinConfig.getInstanceFromEnv().getCalciteExtrasProperties()); info.putAll(BackdoorToggles.getJdbcDriverClientCalciteProps()); info.put("model", olapTmp.getAbsolutePath()); info.put("typeSystem", "org.apache.kylin.query.calcite.KylinRelDataTypeSystem"); return DriverManager.getConnection("jdbc:calcite:", info); } }
QueryConnection { public static Connection getConnection(String project) throws SQLException { if (!isRegister) { try { Class<?> aClass = Thread.currentThread().getContextClassLoader() .loadClass("org.apache.calcite.jdbc.Driver"); Driver o = (Driver) aClass.getDeclaredConstructor().newInstance(); DriverManager.registerDriver(o); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { e.printStackTrace(); } isRegister = true; } File olapTmp = OLAPSchemaFactory.createTempOLAPJson(project, KylinConfig.getInstanceFromEnv()); Properties info = new Properties(); info.putAll(KylinConfig.getInstanceFromEnv().getCalciteExtrasProperties()); info.putAll(BackdoorToggles.getJdbcDriverClientCalciteProps()); info.put("model", olapTmp.getAbsolutePath()); info.put("typeSystem", "org.apache.kylin.query.calcite.KylinRelDataTypeSystem"); return DriverManager.getConnection("jdbc:calcite:", info); }  }
QueryConnection { public static Connection getConnection(String project) throws SQLException { if (!isRegister) { try { Class<?> aClass = Thread.currentThread().getContextClassLoader() .loadClass("org.apache.calcite.jdbc.Driver"); Driver o = (Driver) aClass.getDeclaredConstructor().newInstance(); DriverManager.registerDriver(o); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { e.printStackTrace(); } isRegister = true; } File olapTmp = OLAPSchemaFactory.createTempOLAPJson(project, KylinConfig.getInstanceFromEnv()); Properties info = new Properties(); info.putAll(KylinConfig.getInstanceFromEnv().getCalciteExtrasProperties()); info.putAll(BackdoorToggles.getJdbcDriverClientCalciteProps()); info.put("model", olapTmp.getAbsolutePath()); info.put("typeSystem", "org.apache.kylin.query.calcite.KylinRelDataTypeSystem"); return DriverManager.getConnection("jdbc:calcite:", info); }  static Connection getConnection(String project); }
QueryConnection { public static Connection getConnection(String project) throws SQLException { if (!isRegister) { try { Class<?> aClass = Thread.currentThread().getContextClassLoader() .loadClass("org.apache.calcite.jdbc.Driver"); Driver o = (Driver) aClass.getDeclaredConstructor().newInstance(); DriverManager.registerDriver(o); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { e.printStackTrace(); } isRegister = true; } File olapTmp = OLAPSchemaFactory.createTempOLAPJson(project, KylinConfig.getInstanceFromEnv()); Properties info = new Properties(); info.putAll(KylinConfig.getInstanceFromEnv().getCalciteExtrasProperties()); info.putAll(BackdoorToggles.getJdbcDriverClientCalciteProps()); info.put("model", olapTmp.getAbsolutePath()); info.put("typeSystem", "org.apache.kylin.query.calcite.KylinRelDataTypeSystem"); return DriverManager.getConnection("jdbc:calcite:", info); }  static Connection getConnection(String project);  }