tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [3/6] tajo git commit: TAJO-1284: Add alter partition method to CatalogStore. (jaehwa)
Date Fri, 27 Mar 2015 03:01:04 GMT
http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
index a0bd9cd..1e60d15 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
@@ -151,21 +151,30 @@
 			<tns:Object name="PARTITIONS" type="table" order="18">
 				<tns:sql><![CDATA[
 				CREATE TABLE PARTITIONS (
-  				PID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  				PARTITION_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY
1),
   				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
-  				PARTITION_NAME VARCHAR(255),
-  				ORDINAL_POSITION INT NOT NULL,
-  				PARTITION_VALUE VARCHAR(1024),
+  				PARTITION_NAME VARCHAR(767),
   				PATH VARCHAR(1024),
-  				CONSTRAINT C_PARTITION_PK PRIMARY KEY (PID),
-  				CONSTRAINT C_PARTITION_UNIQUE UNIQUE (TID, PARTITION_NAME)
+  				CONSTRAINT C_PARTITION_PK PRIMARY KEY (PARTITION_ID)
 				)]]>
 				</tns:sql>
 			</tns:Object>
-			<tns:Object name="IDX_PARTITIONS_TABLE_NAME" type="index" dependsOn="PARTITIONS" order="19">
-				<tns:sql><![CDATA[CREATE INDEX idx_partitions_table_name ON PARTITIONS(TID)]]></tns:sql>
+			<tns:Object name="PARTITIONS_IDX" type="index" dependsOn="PARTITIONS" order="19">
+				<tns:sql><![CDATA[CREATE INDEX PARTITIONS_IDX ON PARTITIONS(PARTITION_ID, TID,
PARTITION_NAME)]]></tns:sql>
 			</tns:Object>
-		</tns:objects>
+      <tns:Object name="PARTITION_KEYS" type="table" order="20">
+        <tns:sql><![CDATA[
+				CREATE TABLE PARTITION_KEYS (
+  				PARTITION_ID INT NOT NULL REFERENCES PARTITIONS (PARTITION_ID) ON DELETE CASCADE,
+  				COLUMN_NAME VARCHAR(128) NOT NULL,
+  				PARTITION_VALUE VARCHAR(255)
+				)]]>
+        </tns:sql>
+      </tns:Object>
+      <tns:Object name="PARTITION_KEYS_IDX" type="index" dependsOn="PARTITION_KEYS" order="21">
+        <tns:sql><![CDATA[CREATE INDEX PARTITION_KEYS_IDX ON PARTITION_KEYS(PARTITION_ID,
COLUMN_NAME, PARTITION_VALUE)]]></tns:sql>
+      </tns:Object>
+    </tns:objects>
 	</tns:base>
 	<tns:existQueries>
 	  <tns:existQuery type="trigger">

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partition_keys.sql
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partition_keys.sql
b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partition_keys.sql
new file mode 100644
index 0000000..dd7f2b5
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partition_keys.sql
@@ -0,0 +1,6 @@
+CREATE TABLE PARTITION_KEYS (
+  PARTITION_ID INT NOT NULL,
+  COLUMN_NAME VARCHAR(255) BINARY NOT NULL,
+  PARTITION_VALUE VARCHAR(255) NOT NULL,
+  UNIQUE INDEX PARTITION_KEYS_IDX (PID, COLUMN_NAME, PARTITION_VALUE),
+  FOREIGN KEY (PID) REFERENCES PARTITIONS (PARTITION_ID) ON DELETE CASCADE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partitions.sql
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partitions.sql
b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partitions.sql
index c2672a5..7b279af 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partitions.sql
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/partitions.sql
@@ -1,12 +1,7 @@
 CREATE TABLE PARTITIONS (
-  PID INT NOT NULL PRIMARY KEY,
+  PARTITION_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
   TID INT NOT NULL,
-  PARTITION_NAME VARCHAR(128) BINARY,
-  ORDINAL_POSITION INT NOT NULL,
-  PARTITION_VALUE VARCHAR(1024),
+  PARTITION_NAME VARCHAR(767) BINARY,
   PATH VARCHAR(4096),
-  FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE,
-  CONSTRAINT C_PARTITION_UNIQUE UNIQUE (TID, PARTITION_NAME),
-  INDEX IDX_TID (TID),
-  UNIQUE INDEX IDX_TID_NAME (TID, PARTITION_NAME)
-)
+  UNIQUE INDEX PARTITIONS_IDX (PARTITION_ID, TID, PARTITION_NAME),
+  FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partition_keys.sql
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partition_keys.sql
b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partition_keys.sql
new file mode 100644
index 0000000..a85b12f
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partition_keys.sql
@@ -0,0 +1,6 @@
+CREATE TABLE PARTITION_KEYS (
+  PARTITION_ID INT NOT NULL,
+  COLUMN_NAME VARCHAR(255) BINARY NOT NULL,
+  PARTITION_VALUE VARCHAR(255) NOT NULL,
+  UNIQUE INDEX PARTITION_KEYS_IDX (PARTITION_ID, COLUMN_NAME, PARTITION_VALUE),
+  FOREIGN KEY (PID) REFERENCES PARTITIONS (PARTITION_ID) ON DELETE CASCADE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partitions.sql
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partitions.sql
b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partitions.sql
index c2672a5..7b279af 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partitions.sql
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/partitions.sql
@@ -1,12 +1,7 @@
 CREATE TABLE PARTITIONS (
-  PID INT NOT NULL PRIMARY KEY,
+  PARTITION_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
   TID INT NOT NULL,
-  PARTITION_NAME VARCHAR(128) BINARY,
-  ORDINAL_POSITION INT NOT NULL,
-  PARTITION_VALUE VARCHAR(1024),
+  PARTITION_NAME VARCHAR(767) BINARY,
   PATH VARCHAR(4096),
-  FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE,
-  CONSTRAINT C_PARTITION_UNIQUE UNIQUE (TID, PARTITION_NAME),
-  INDEX IDX_TID (TID),
-  UNIQUE INDEX IDX_TID_NAME (TID, PARTITION_NAME)
-)
+  UNIQUE INDEX PARTITIONS_IDX (PARTITION_ID, TID, PARTITION_NAME),
+  FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
index 880a14e..84a92fb 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
@@ -186,20 +186,47 @@
   		<tns:Object order="18" type="table" name="PARTITIONS">
   			<tns:sql><![CDATA[
   			CREATE TABLE PARTITIONS (
-					PID INT NOT NULL PRIMARY KEY,
+					PARTITION_ID INT NOT NULL PRIMARY KEY,
 					TID INT NOT NULL,
-					PARTITION_NAME VARCHAR2(128),
-					ORDINAL_POSITION INT NOT NULL,
-					PARTITION_VALUE VARCHAR2(1024),
+					PARTITION_NAME VARCHAR2(767),
 					PATH VARCHAR2(4000),
-					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE,
-					CONSTRAINT C_PARTITION_UNIQUE UNIQUE (TID, PARTITION_NAME)
+					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
 				)]]>
 				</tns:sql>
   		</tns:Object>
-  		<tns:Object order="19" type="index" name="PARTITIONS_IDX_TID" dependsOn="PARTITIONS">
-  			<tns:sql><![CDATA[CREATE INDEX PARTITIONS_IDX_TID on PARTITIONS (TID)]]></tns:sql>
-  		</tns:Object>
+      <tns:Object order="19" type="sequence" name="PARTITIONS_SEQ">
+        <tns:sql><![CDATA[
+  			CREATE SEQUENCE PARTITIONS_SEQ
+  			]]>
+        </tns:sql>
+      </tns:Object>
+      <tns:Object order="20" type="trigger" name="PARTITIONS_AUTOINC">
+        <tns:sql><![CDATA[
+  			CREATE OR REPLACE TRIGGER PARTITIONS_AUTOINC
+				BEFORE INSERT ON TABLES
+				FOR EACH ROW
+				WHEN (new.PARTITION_ID IS NULL)
+				BEGIN
+				  SELECT PARTITIONS_SEQ.NEXTVAL INTO :new.TID FROM DUAL;
+				END;]]>
+        </tns:sql>
+      </tns:Object>
+  		<tns:Object order="21" type="index" name="PARTITIONS_IDX" dependsOn="PARTITIONS">
+  			<tns:sql><![CDATA[CREATE INDEX PARTITIONS_IDX on PARTITIONS (PARTITION_ID,
TID, PARTITION_NAME)]]></tns:sql>
+  		</tns:Object>
+      <tns:Object order="22" type="table" name="PARTITION_KEYS">
+        <tns:sql><![CDATA[
+          CREATE TABLE PARTITION_KEYS (
+            PARTITION_ID INT NOT NULL,
+            COLUMN_NAME VARCHAR2(255) NOT NULL,
+            PARTITION_VALUE VARCHAR(255) NULL,
+            FOREIGN KEY (PARTITION_ID) REFERENCES PARTITIONS (PARTITION_ID) ON DELETE CASCADE)
+				)]]>
+        </tns:sql>
+      </tns:Object>
+      <tns:Object order="23" type="index" name="PARTITION_KEYS_IDX" dependsOn="PARTITION_KEYS">
+        <tns:sql><![CDATA[CREATE INDEX PARTITION_KEYS_IDX on PARTITION_KEYS (PARTITION_ID,
COLUMN_NAME, PARTITION_VALUE)]]></tns:sql>
+      </tns:Object>
     </tns:objects>
   </tns:base>
   <tns:existQueries>

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
index 821527b..0f49f83 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
@@ -148,10 +148,9 @@ xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.
 			<tns:Object name="PARTITIONS" type="table" order="15">
 				<tns:sql><![CDATA[
 				CREATE TABLE PARTITIONS (
-  				PID INT NOT NULL PRIMARY KEY,
+  				PARTITION_ID SERIAL NOT NULL PRIMARY KEY,
   				TID INT NOT NULL,
   				PARTITION_NAME VARCHAR(128),
-  				ORDINAL_POSITION INT NOT NULL,
   				PARTITION_VALUE VARCHAR(1024),
   				PATH VARCHAR(4096),
   				FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE,
@@ -165,6 +164,19 @@ xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.
 			<tns:Object name="IDX_TID_NAME" type="index" order="17" dependsOn="PARTITIONS">
 				<tns:sql><![CDATA[CREATE UNIQUE INDEX IDX_TID_NAME on PARTITIONS (TID, PARTITION_NAME)]]></tns:sql>
 			</tns:Object>
+      <tns:Object name="PARTITION_KEYS" type="table" order="18">
+        <tns:sql><![CDATA[
+          CREATE TABLE PARTITION_KEYS (
+            PARTITION_ID INT NOT NULL,
+            COLUMN_NAME VARCHAR2(255) NOT NULL,
+            PARTITION_VALUE VARCHAR(255) NULL,
+            FOREIGN KEY (PARTITION_ID) REFERENCES PARTITIONS (PARTITION_ID) ON DELETE CASCADE)
+				)]]>
+        </tns:sql>
+      </tns:Object>
+      <tns:Object name="PARTITION_KEYS_IDX" type="index" order="19" dependsOn="PARTITION_KEYS">
+        <tns:sql><![CDATA[CREATE INDEX PARTITION_KEYS_IDX on PARTITION_KEYS (PARTITION_ID,
COLUMN_NAME, PARTITION_VALUE)]]></tns:sql>
+      </tns:Object>
 		</tns:objects>
 	</tns:base>
 	<tns:existQueries>

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
index c3bfc99..48a11ee 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
@@ -25,6 +25,8 @@ import org.apache.tajo.TajoConstants;
 import org.apache.tajo.catalog.dictionary.InfoSchemaMetadataDictionary;
 import org.apache.tajo.catalog.exception.CatalogException;
 import org.apache.tajo.catalog.exception.NoSuchFunctionException;
+import org.apache.tajo.catalog.partition.PartitionDesc;
+import org.apache.tajo.catalog.partition.PartitionKey;
 import org.apache.tajo.catalog.store.PostgreSQLStore;
 import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 import org.apache.tajo.catalog.proto.CatalogProtos;
@@ -57,7 +59,7 @@ import static org.apache.tajo.catalog.proto.CatalogProtos.AlterTablespaceProto.S
 import static org.junit.Assert.*;
 
 public class TestCatalog {
-	static final String FieldName1="f1";
+  static final String FieldName1="f1";
 	static final String FieldName2="f2";
 	static final String FieldName3="f3";	
 
@@ -886,15 +888,16 @@ public class TestCatalog {
 
     Schema partSchema = new Schema();
     partSchema.addColumn("id", Type.INT4);
+    partSchema.addColumn("name", Type.TEXT);
 
-    PartitionMethodDesc partitionDesc =
+    PartitionMethodDesc partitionMethodDesc =
         new PartitionMethodDesc(DEFAULT_DATABASE_NAME, tableName,
-            CatalogProtos.PartitionType.COLUMN, "id", partSchema);
+            CatalogProtos.PartitionType.COLUMN, "id,name", partSchema);
 
     TableDesc desc =
         new TableDesc(tableName, schema, meta,
             new Path(CommonTestingUtil.getTestDir(), "addedtable").toUri());
-    desc.setPartitionMethod(partitionDesc);
+    desc.setPartitionMethod(partitionMethodDesc);
     assertFalse(catalog.existsTable(tableName));
     catalog.createTable(desc);
     assertTrue(catalog.existsTable(tableName));
@@ -905,10 +908,72 @@ public class TestCatalog {
     assertEquals(retrieved.getPartitionMethod().getPartitionType(), CatalogProtos.PartitionType.COLUMN);
     assertEquals(retrieved.getPartitionMethod().getExpressionSchema().getColumn(0).getSimpleName(),
"id");
 
+    testAddPartition(tableName, "id=10/name=aaa");
+    testAddPartition(tableName, "id=20/name=bbb");
+
+    List<CatalogProtos.PartitionDescProto> partitions = catalog.getPartitions(DEFAULT_DATABASE_NAME,
"addedtable");
+    assertNotNull(partitions);
+    assertEquals(partitions.size(), 2);
+
+    testDropPartition(tableName, "id=10/name=aaa");
+    testDropPartition(tableName, "id=20/name=bbb");
+
+    partitions = catalog.getPartitions(DEFAULT_DATABASE_NAME, "addedtable");
+    assertNotNull(partitions);
+    assertEquals(partitions.size(), 0);
+
     catalog.dropTable(tableName);
     assertFalse(catalog.existsTable(tableName));
   }
 
+  private void testAddPartition(String tableName, String partitionName) throws Exception
{
+    AlterTableDesc alterTableDesc = new AlterTableDesc();
+    alterTableDesc.setTableName(tableName);
+    alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
+
+    PartitionDesc partitionDesc = new PartitionDesc();
+    partitionDesc.setPartitionName(partitionName);
+
+    String[] partitionNames = partitionName.split("/");
+
+    List<PartitionKey> partitionKeyList = new ArrayList<PartitionKey>();
+    for(int i = 0; i < partitionNames.length; i++) {
+      String columnName = partitionNames[i].split("=")[0];
+      partitionKeyList.add(new PartitionKey(partitionNames[i], columnName));
+    }
+
+    partitionDesc.setPartitionKeys(partitionKeyList);
+
+    partitionDesc.setPath("hdfs://xxx.com/warehouse/" + partitionName);
+
+    alterTableDesc.setPartitionDesc(partitionDesc);
+
+    catalog.alterTable(alterTableDesc);
+
+    CatalogProtos.PartitionDescProto resultDesc = catalog.getPartition(DEFAULT_DATABASE_NAME,
+      "addedtable", partitionName);
+
+    assertNotNull(resultDesc);
+    assertEquals(resultDesc.getPartitionName(), partitionName);
+    assertEquals(resultDesc.getPath(), "hdfs://xxx.com/warehouse/" + partitionName);
+
+    assertEquals(resultDesc.getPartitionKeysCount(), 2);
+  }
+
+
+  private void testDropPartition(String tableName, String partitionName) throws Exception
{
+    AlterTableDesc alterTableDesc = new AlterTableDesc();
+    alterTableDesc.setTableName(tableName);
+    alterTableDesc.setAlterTableType(AlterTableType.DROP_PARTITION);
+
+    PartitionDesc partitionDesc = new PartitionDesc();
+    partitionDesc.setPartitionName(partitionName);
+
+    alterTableDesc.setPartitionDesc(partitionDesc);
+
+    catalog.alterTable(alterTableDesc);
+  }
+
   @Test
   public void testAlterTableName () throws Exception {
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
b/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
index e44d8be..c2ccf34 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
@@ -413,8 +413,8 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
       for (int fieldId = 0; fieldId < columns.size(); fieldId++) {
         Column column = columns.get(fieldId);
         
-        if ("pid".equalsIgnoreCase(column.getSimpleName())) {
-          aTuple.put(fieldId, DatumFactory.createInt4(partition.getPid()));
+        if ("partition_id".equalsIgnoreCase(column.getSimpleName())) {
+          aTuple.put(fieldId, DatumFactory.createInt4(partition.getPartitionId()));
         } else if ("tid".equalsIgnoreCase(column.getSimpleName())) {
           aTuple.put(fieldId, DatumFactory.createInt4(partition.getTid()));
         } else if ("partition_name".equalsIgnoreCase(column.getSimpleName())) {
@@ -423,8 +423,6 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
           } else {
             aTuple.put(fieldId, DatumFactory.createNullDatum());
           }
-        } else if ("ordinal_position".equalsIgnoreCase(column.getSimpleName())) {
-          aTuple.put(fieldId, DatumFactory.createInt4(partition.getOrdinalPosition()));
         } else if ("path".equalsIgnoreCase(column.getSimpleName())) {
           aTuple.put(fieldId, DatumFactory.createText(partition.getPath()));
         }

http://git-wip-us.apache.org/repos/asf/tajo/blob/cad54428/tajo-jdbc/src/test/java/org/apache/tajo/jdbc/util/TestQueryStringDecoder.java
----------------------------------------------------------------------
diff --git a/tajo-jdbc/src/test/java/org/apache/tajo/jdbc/util/TestQueryStringDecoder.java
b/tajo-jdbc/src/test/java/org/apache/tajo/jdbc/util/TestQueryStringDecoder.java
index 31a09d5..ca60fdb 100644
--- a/tajo-jdbc/src/test/java/org/apache/tajo/jdbc/util/TestQueryStringDecoder.java
+++ b/tajo-jdbc/src/test/java/org/apache/tajo/jdbc/util/TestQueryStringDecoder.java
@@ -50,13 +50,13 @@ public class TestQueryStringDecoder {
     QueryStringDecoder decoder = null;
     String rawUriStr = "";
     
-    rawUriStr = "http://127.0.0.1:26200/?qid=1234&tid=2345&pid=4567";
+    rawUriStr = "http://127.0.0.1:26200/?qid=1234&tid=2345&partition_id=4567";
     decoder = new QueryStringDecoder(rawUriStr);
-    assertThat(decoder.getQueries(), is("qid=1234&tid=2345&pid=4567"));
+    assertThat(decoder.getQueries(), is("qid=1234&tid=2345&partition_id=4567"));
     assertThat(decoder.getParameters(), is(notNullValue()));
     assertThat(decoder.getParameters().size(), is(3));
     assertThat(decoder.getParameters().get("qid").get(0), is("1234"));
-    assertThat(decoder.getParameters().get("pid").get(0), is("4567"));
+    assertThat(decoder.getParameters().get("partition_id").get(0), is("4567"));
     
     rawUriStr = "http://127.0.0.1:26200/?tid=2345";
     decoder = new QueryStringDecoder(rawUriStr);
@@ -71,9 +71,9 @@ public class TestQueryStringDecoder {
     QueryStringDecoder decoder = null;
     String rawUriStr = "";
     
-    rawUriStr = "http://127.0.0.1:26200/?qid=1234&tid=2345&pid=4567&tid=4890";
+    rawUriStr = "http://127.0.0.1:26200/?qid=1234&tid=2345&partition_id=4567&tid=4890";
     decoder = new QueryStringDecoder(rawUriStr);
-    assertThat(decoder.getQueries(), is("qid=1234&tid=2345&pid=4567&tid=4890"));
+    assertThat(decoder.getQueries(), is("qid=1234&tid=2345&partition_id=4567&tid=4890"));
     assertThat(decoder.getParameters(), is(notNullValue()));
     assertThat(decoder.getParameters().size(), is(3));
     assertThat(decoder.getParameters().get("tid").size(), is(2));
@@ -86,9 +86,9 @@ public class TestQueryStringDecoder {
     QueryStringDecoder decoder = null;
     String rawUriStr = "";
     
-    rawUriStr = "http://127.0.0.1:26200/?=1234&tid=&pid=4567";
+    rawUriStr = "http://127.0.0.1:26200/?=1234&tid=&partition_id=4567";
     decoder = new QueryStringDecoder(rawUriStr);
-    assertThat(decoder.getQueries(), is("=1234&tid=&pid=4567"));
+    assertThat(decoder.getQueries(), is("=1234&tid=&partition_id=4567"));
     decoder.getParameters();
   }
 }


Mime
View raw message