You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/03/21 01:28:24 UTC

[20/29] incubator-kylin git commit: KYLIN-650 category resting pages to different topics

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/5acdcd23/docs/Test/Run Kylin test case with HBase Mini Cluster.md
----------------------------------------------------------------------
diff --git a/docs/Test/Run Kylin test case with HBase Mini Cluster.md b/docs/Test/Run Kylin test case with HBase Mini Cluster.md
new file mode 100644
index 0000000..6088eb9
--- /dev/null
+++ b/docs/Test/Run Kylin test case with HBase Mini Cluster.md	
@@ -0,0 +1,15 @@
+## Run test case with HBase Mini Cluster
+
+Kylin is moving as many as possible unit test cases from sandbox to HBase mini cluster, so that user can run tests easily in local without a hadoop sandbox; Two maven profiles are created in the root pom.xml, "default" and "sandbox"; The default profile will startup a HBase Mini Cluster to prepare the test data and run the unit tests (the test cases that are not supported by Mini cluster have been added in the "exclude" list); If you want to keep using Sandbox to run test, just run:
+mvn test -P sandbox
+
+
+### When use the "default" profile, Kylin will:
+
+* 	Startup a HBase minicluster and update KylinConfig with the dynamic HBase configurations;
+* 	Create Kylin metadata tables and import six example cube tables;
+* 	Import the hbase data from a tar ball from local: examples/test_case_data/minicluster/hbase-export.tar.gz (the hbase-export.tar.gz will be updated on complete of running BuildCubeWithEngineTest)
+* 	After all test cases be completed, shutdown minicluster and cleanup KylinConfig cache;
+
+### To ensure Mini cluster can run successfully, you need:
+* 	Make sure JAVA_HOME is properly set; 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/5acdcd23/docs/Tutorial/How to use kylin remote jdbc driver.md
----------------------------------------------------------------------
diff --git a/docs/Tutorial/How to use kylin remote jdbc driver.md b/docs/Tutorial/How to use kylin remote jdbc driver.md
new file mode 100644
index 0000000..45de447
--- /dev/null
+++ b/docs/Tutorial/How to use kylin remote jdbc driver.md	
@@ -0,0 +1,83 @@
+### Authentication
+Build on kylin authentication restful service. Supported parameters:
+* user : username 
+* password : password
+* ssl: true/false. Default be false; If true, all the services call will use https.
+
+### Connection URL format:
+```
+jdbc:kylin://<hostname>:<port>/<kylin_project_name>
+```
+* If "ssl" = true, the "port" should be Kylin server's HTTPS port; 
+* If "port" is not specified, the driver will use default port: HTTP 80, HTTPS 443;
+* The "kylin_project_name" must be specified and user need ensure it exists in Kylin server;
+
+### 1. Query with Statement
+```
+        Driver driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
+
+        Properties info = new Properties();
+        info.put("user", "ADMIN");
+        info.put("password", "KYLIN");
+        Connection conn = driver.connect("jdbc:kylin://localhost:7070/kylin_project_name", info);
+        Statement state = conn.createStatement();
+        ResultSet resultSet = state.executeQuery("select * from test_table");
+
+        while (resultSet.next()) {
+            assertEquals("foo", resultSet.getString(1));
+            assertEquals("bar", resultSet.getString(2));
+            assertEquals("tool", resultSet.getString(3));
+        }
+```
+
+### 2. Query with PreparedStatement
+Supported prepared statement parameters:
+* setString
+* setInt
+* setShort
+* setLong
+* setFloat
+* setDouble
+* setBoolean
+* setByte
+* setDate
+* setTime
+* setTimestamp
+
+```
+        Driver driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
+        Properties info = new Properties();
+        info.put("user", "ADMIN");
+        info.put("password", "KYLIN");
+        Connection conn = driver.connect("jdbc:kylin://localhost:7070/kylin_project_name", info);
+        PreparedStatement state = conn.prepareStatement("select * from test_table where id=?");
+        state.setInt(1, 10);
+        ResultSet resultSet = state.executeQuery();
+
+        while (resultSet.next()) {
+            assertEquals("foo", resultSet.getString(1));
+            assertEquals("bar", resultSet.getString(2));
+            assertEquals("tool", resultSet.getString(3));
+        }
+```
+
+### 3. Get query result metadata
+Kylin jdbc driver supports metadata list methods:
+List catalog, schema, table and column with sql pattern filters(such as %).
+
+```
+        Driver driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
+        Properties info = new Properties();
+        info.put("user", "ADMIN");
+        info.put("password", "KYLIN");
+        Connection conn = driver.connect("jdbc:kylin://localhost:7070/kylin_project_name", info);
+        Statement state = conn.createStatement();
+        ResultSet resultSet = state.executeQuery("select * from test_table");
+
+        ResultSet tables = conn.getMetaData().getTables(null, null, "dummy", null);
+        while (tables.next()) {
+            for (int i = 0; i < 10; i++) {
+                assertEquals("dummy", tables.getString(i + 1));
+            }
+        }
+```