phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/4.4-HBase-1.1 eeefd6d12 - b07f68a60


PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b07f68a6
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b07f68a6
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b07f68a6

Branch: refs/heads/4.4-HBase-1.1
Commit: b07f68a603dca48a53828f8c20c5f92478bf69e3
Parents: eeefd6d
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:24:26 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07f68a6/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07f68a6/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file



phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 6d322103e - 04e9d58d1


PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/04e9d58d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/04e9d58d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/04e9d58d

Branch: refs/heads/4.x-HBase-1.0
Commit: 04e9d58d173e5bed05ab893237a60214e1756520
Parents: 6d32210
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:24:46 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/04e9d58d/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/04e9d58d/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file



phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/4.4-HBase-1.0 d226c6a63 - 2501ecf74


PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2501ecf7
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2501ecf7
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2501ecf7

Branch: refs/heads/4.4-HBase-1.0
Commit: 2501ecf744a5b7046997317a6a2f360abffece32
Parents: d226c6a
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:24:14 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2501ecf7/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2501ecf7/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file



phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/master b329e85b6 - b38a62431


PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b38a6243
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b38a6243
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b38a6243

Branch: refs/heads/master
Commit: b38a62431ee44df171c913097d18e2433c951466
Parents: b329e85
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:25:01 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b38a6243/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b38a6243/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file



[34/34] phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread greid
PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/954a4a1b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/954a4a1b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/954a4a1b

Branch: refs/heads/4.x-HBase-1.1
Commit: 954a4a1b615e6c42dfaecbf2ff6b8174261ccea6
Parents: 89ab41c
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:24:57 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/954a4a1b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/954a4a1b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file



phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 73da0fb0d - 8eb9afeb6


PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8eb9afeb
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8eb9afeb
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8eb9afeb

Branch: refs/heads/4.x-HBase-0.98
Commit: 8eb9afeb6d0024265c8a8526218ac1c35076ec80
Parents: 73da0fb
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:24:35 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8eb9afeb/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8eb9afeb/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file



[48/50] [abbrv] phoenix git commit: PHOENIX-2131 Closing paren in CastParseNode SQL

2015-07-20 Thread maryannxue
PHOENIX-2131 Closing paren in CastParseNode SQL

Add a missing closing parenthesis in CastParseNode.toSQL.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b38a6243
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b38a6243
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b38a6243

Branch: refs/heads/calcite
Commit: b38a62431ee44df171c913097d18e2433c951466
Parents: b329e85
Author: Gabriel Reid gr...@apache.org
Authored: Sun Jul 19 17:46:48 2015 +0200
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Jul 20 15:25:01 2015 +0200

--
 .../org/apache/phoenix/parse/CastParseNode.java |  2 +-
 .../apache/phoenix/parse/CastParseNodeTest.java | 57 
 2 files changed, 58 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b38a6243/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
index 78be616..3e03613 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/CastParseNode.java
@@ -133,7 +133,7 @@ public class CastParseNode extends UnaryParseNode {
 if (isArray) {
 buf.append(' ');
 buf.append(PDataType.ARRAY_TYPE_SUFFIX);
-buf.append(' ');
 }
+buf.append());
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b38a6243/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
new file mode 100644
index 000..b62d9a9
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/CastParseNodeTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.parse;
+
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDecimal;
+import org.apache.phoenix.schema.types.PDouble;
+import org.apache.phoenix.schema.types.PLong;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CastParseNodeTest {
+
+@Test
+public void testToSQL() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT), stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_WithLengthAndScale() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PDecimal.INSTANCE, 5, 3, false);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS DECIMAL(5,3)), 
stringBuilder.toString());
+}
+
+@Test
+public void testToSQL_ArrayType() {
+ColumnParseNode columnParseNode = new 
ColumnParseNode(TableName.create(SCHEMA1, TABLE1), V);
+CastParseNode castParseNode = new CastParseNode(columnParseNode, 
PLong.INSTANCE, null, null, true);
+StringBuilder stringBuilder = new StringBuilder();
+castParseNode.toSQL(null, stringBuilder);
+assertEquals( CAST(TABLE1.V AS BIGINT ARRAY), 
stringBuilder.toString());
+}
+}
\ No newline at end of file