[20/50] [abbrv] phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum)
PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/edd94b28 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/edd94b28 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/edd94b28 Branch: refs/heads/calcite Commit: edd94b28ab46877aa15e94713274516619fa43b1 Parents: 8ece81b Author: Jesse Yates Authored: Fri Feb 12 15:46:11 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 15:46:51 2016 -0800 -- .../org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/edd94b28/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java index 125c6a8..98f0364 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java @@ -58,8 +58,9 @@ public final class PhoenixMapReduceUtil { * @param inputQuery Select query. */ public static void setInput(final Job job, final Class inputClass, final String tableName, final String inputQuery) { - final Configuration configuration = setInput(job, inputClass, tableName); - PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); +final Configuration configuration = setInput(job, inputClass, tableName); +PhoenixConfigurationUtil.setInputQuery(configuration, inputQuery); +PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); } private static Configuration setInput(final Job job, final Class inputClass, final String tableName){
[19/50] [abbrv] phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause
PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause Setting the condition in the PhoenixMapReduceUtil, as well as some slight cleanup for duplicate code in setInput(). Adding a test that covers mapreduce with and without a condition. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8ece81b5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8ece81b5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8ece81b5 Branch: refs/heads/calcite Commit: 8ece81b5522df3e6bd9dfdb3112e101215bb49f1 Parents: 0c1fd3a Author: Jesse Yates Authored: Wed Feb 10 12:46:47 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 12:15:42 2016 -0800 -- .../org/apache/phoenix/end2end/MapReduceIT.java | 230 +++ .../mapreduce/util/PhoenixMapReduceUtil.java| 65 +++--- 2 files changed, 264 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ece81b5/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java new file mode 100644 index 000..f030701 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java @@ -0,0 +1,230 @@ +/* + * 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.end2end; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.DoubleWritable; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.Mapper; +import org.apache.hadoop.mapreduce.Reducer; +import org.apache.hadoop.mapreduce.lib.db.DBWritable; +import org.apache.phoenix.mapreduce.PhoenixOutputFormat; +import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil; +import org.apache.phoenix.mapreduce.util.PhoenixMapReduceUtil; +import org.apache.phoenix.schema.types.PDouble; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.sql.*; + +import static org.junit.Assert.*; + +/** + * Test that our MapReduce basic tools work as expected + */ +public class MapReduceIT extends BaseHBaseManagedTimeIT { + +private static final String STOCK_TABLE_NAME = "stock"; +private static final String STOCK_STATS_TABLE_NAME = "stock_stats"; +private static final String STOCK_NAME = "STOCK_NAME"; +private static final String RECORDING_YEAR = "RECORDING_YEAR"; +private static final String RECORDINGS_QUARTER = "RECORDINGS_QUARTER"; +private static final String CREATE_STOCK_TABLE = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE_NAME + " ( " + +STOCK_NAME + " VARCHAR NOT NULL ," + RECORDING_YEAR + " INTEGER NOT NULL, " + RECORDINGS_QUARTER + +" DOUBLE array[] CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + " , " + RECORDING_YEAR + "))"; + +private static final String MAX_RECORDING = "MAX_RECORDING"; +private static final String CREATE_STOCK_STATS_TABLE = +"CREATE TABLE IF NOT EXISTS " + STOCK_STATS_TABLE_NAME + "(" + STOCK_NAME + " VARCHAR NOT NULL , " ++ MAX_RECORDING + " DOUBLE CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + "))"; +private static final String UPSERT = "UPSERT into " + STOCK_TABLE_NAME + " values (?, ?, ?)"; + +@Before +public void setupTables() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE_STOCK_TABLE); +conn.createStatement().execute(CREATE_STOCK_STATS_TABLE); +conn.commit(); +} + +@Test +public void testNoConditionsOnSelect() throws Exception { +final Configuration conf = getUtility().getConfiguration(); +Job job = Job.getInstance(conf); +PhoenixMapReduceUtil.setInput(job, Stoc
phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 acca4129b -> ace996372 PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ace99637 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ace99637 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ace99637 Branch: refs/heads/4.x-HBase-1.0 Commit: ace996372077e7eb84410cb9ddc764a5bec6af2f Parents: acca412 Author: Jesse Yates Authored: Fri Feb 12 15:46:11 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 16:14:31 2016 -0800 -- .../org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ace99637/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java index 125c6a8..98f0364 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java @@ -58,8 +58,9 @@ public final class PhoenixMapReduceUtil { * @param inputQuery Select query. */ public static void setInput(final Job job, final Class inputClass, final String tableName, final String inputQuery) { - final Configuration configuration = setInput(job, inputClass, tableName); - PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); +final Configuration configuration = setInput(job, inputClass, tableName); +PhoenixConfigurationUtil.setInputQuery(configuration, inputQuery); +PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); } private static Configuration setInput(final Job job, final Class inputClass, final String tableName){
phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum)
Repository: phoenix Updated Branches: refs/heads/master 8ece81b55 -> edd94b28a PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/edd94b28 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/edd94b28 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/edd94b28 Branch: refs/heads/master Commit: edd94b28ab46877aa15e94713274516619fa43b1 Parents: 8ece81b Author: Jesse Yates Authored: Fri Feb 12 15:46:11 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 15:46:51 2016 -0800 -- .../org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/edd94b28/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java index 125c6a8..98f0364 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java @@ -58,8 +58,9 @@ public final class PhoenixMapReduceUtil { * @param inputQuery Select query. */ public static void setInput(final Job job, final Class inputClass, final String tableName, final String inputQuery) { - final Configuration configuration = setInput(job, inputClass, tableName); - PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); +final Configuration configuration = setInput(job, inputClass, tableName); +PhoenixConfigurationUtil.setInputQuery(configuration, inputQuery); +PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); } private static Configuration setInput(final Job job, final Class inputClass, final String tableName){
phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 35b893d21 -> 470477e50 PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/470477e5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/470477e5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/470477e5 Branch: refs/heads/4.x-HBase-0.98 Commit: 470477e5053075e5ebf128bc3ae532e908a25067 Parents: 35b893d Author: Jesse Yates Authored: Fri Feb 12 15:46:11 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 16:14:41 2016 -0800 -- .../org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/470477e5/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java index 125c6a8..98f0364 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixMapReduceUtil.java @@ -58,8 +58,9 @@ public final class PhoenixMapReduceUtil { * @param inputQuery Select query. */ public static void setInput(final Job job, final Class inputClass, final String tableName, final String inputQuery) { - final Configuration configuration = setInput(job, inputClass, tableName); - PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); +final Configuration configuration = setInput(job, inputClass, tableName); +PhoenixConfigurationUtil.setInputQuery(configuration, inputQuery); +PhoenixConfigurationUtil.setSchemaType(configuration, SchemaType.QUERY); } private static Configuration setInput(final Job job, final Class inputClass, final String tableName){
phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 03b1dd229 -> 35b893d21 PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause Setting the condition in the PhoenixMapReduceUtil, as well as some slight cleanup for duplicate code in setInput(). Adding a test that covers mapreduce with and without a condition. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/35b893d2 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/35b893d2 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/35b893d2 Branch: refs/heads/4.x-HBase-0.98 Commit: 35b893d219a02da2dd2588fbee1ecd8a33ed25cc Parents: 03b1dd2 Author: Jesse Yates Authored: Wed Feb 10 12:46:47 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 12:17:30 2016 -0800 -- .../org/apache/phoenix/end2end/MapReduceIT.java | 230 +++ .../mapreduce/util/PhoenixMapReduceUtil.java| 65 +++--- 2 files changed, 264 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/35b893d2/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java new file mode 100644 index 000..f030701 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java @@ -0,0 +1,230 @@ +/* + * 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.end2end; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.DoubleWritable; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.Mapper; +import org.apache.hadoop.mapreduce.Reducer; +import org.apache.hadoop.mapreduce.lib.db.DBWritable; +import org.apache.phoenix.mapreduce.PhoenixOutputFormat; +import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil; +import org.apache.phoenix.mapreduce.util.PhoenixMapReduceUtil; +import org.apache.phoenix.schema.types.PDouble; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.sql.*; + +import static org.junit.Assert.*; + +/** + * Test that our MapReduce basic tools work as expected + */ +public class MapReduceIT extends BaseHBaseManagedTimeIT { + +private static final String STOCK_TABLE_NAME = "stock"; +private static final String STOCK_STATS_TABLE_NAME = "stock_stats"; +private static final String STOCK_NAME = "STOCK_NAME"; +private static final String RECORDING_YEAR = "RECORDING_YEAR"; +private static final String RECORDINGS_QUARTER = "RECORDINGS_QUARTER"; +private static final String CREATE_STOCK_TABLE = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE_NAME + " ( " + +STOCK_NAME + " VARCHAR NOT NULL ," + RECORDING_YEAR + " INTEGER NOT NULL, " + RECORDINGS_QUARTER + +" DOUBLE array[] CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + " , " + RECORDING_YEAR + "))"; + +private static final String MAX_RECORDING = "MAX_RECORDING"; +private static final String CREATE_STOCK_STATS_TABLE = +"CREATE TABLE IF NOT EXISTS " + STOCK_STATS_TABLE_NAME + "(" + STOCK_NAME + " VARCHAR NOT NULL , " ++ MAX_RECORDING + " DOUBLE CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + "))"; +private static final String UPSERT = "UPSERT into " + STOCK_TABLE_NAME + " values (?, ?, ?)"; + +@Before +public void setupTables() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE_STOCK_TABLE); +conn.createStatement().execute(CREATE_STOCK_STATS_TABLE); +conn.commit(); +} + +@Test +public void testNoConditionsOnSelect() throws Exception { +final Configuration conf = getUtility().getConfigura
phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 fd757a055 -> acca4129b PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause Setting the condition in the PhoenixMapReduceUtil, as well as some slight cleanup for duplicate code in setInput(). Adding a test that covers mapreduce with and without a condition. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/acca4129 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/acca4129 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/acca4129 Branch: refs/heads/4.x-HBase-1.0 Commit: acca4129b0b038e59ee047d88a8f445d4ebf1e6d Parents: fd757a0 Author: Jesse Yates Authored: Wed Feb 10 12:46:47 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 12:16:31 2016 -0800 -- .../org/apache/phoenix/end2end/MapReduceIT.java | 230 +++ .../mapreduce/util/PhoenixMapReduceUtil.java| 65 +++--- 2 files changed, 264 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/acca4129/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java new file mode 100644 index 000..f030701 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java @@ -0,0 +1,230 @@ +/* + * 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.end2end; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.DoubleWritable; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.Mapper; +import org.apache.hadoop.mapreduce.Reducer; +import org.apache.hadoop.mapreduce.lib.db.DBWritable; +import org.apache.phoenix.mapreduce.PhoenixOutputFormat; +import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil; +import org.apache.phoenix.mapreduce.util.PhoenixMapReduceUtil; +import org.apache.phoenix.schema.types.PDouble; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.sql.*; + +import static org.junit.Assert.*; + +/** + * Test that our MapReduce basic tools work as expected + */ +public class MapReduceIT extends BaseHBaseManagedTimeIT { + +private static final String STOCK_TABLE_NAME = "stock"; +private static final String STOCK_STATS_TABLE_NAME = "stock_stats"; +private static final String STOCK_NAME = "STOCK_NAME"; +private static final String RECORDING_YEAR = "RECORDING_YEAR"; +private static final String RECORDINGS_QUARTER = "RECORDINGS_QUARTER"; +private static final String CREATE_STOCK_TABLE = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE_NAME + " ( " + +STOCK_NAME + " VARCHAR NOT NULL ," + RECORDING_YEAR + " INTEGER NOT NULL, " + RECORDINGS_QUARTER + +" DOUBLE array[] CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + " , " + RECORDING_YEAR + "))"; + +private static final String MAX_RECORDING = "MAX_RECORDING"; +private static final String CREATE_STOCK_STATS_TABLE = +"CREATE TABLE IF NOT EXISTS " + STOCK_STATS_TABLE_NAME + "(" + STOCK_NAME + " VARCHAR NOT NULL , " ++ MAX_RECORDING + " DOUBLE CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + "))"; +private static final String UPSERT = "UPSERT into " + STOCK_TABLE_NAME + " values (?, ?, ?)"; + +@Before +public void setupTables() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE_STOCK_TABLE); +conn.createStatement().execute(CREATE_STOCK_STATS_TABLE); +conn.commit(); +} + +@Test +public void testNoConditionsOnSelect() throws Exception { +final Configuration conf = getUtility().getConfigurati
phoenix git commit: PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause
Repository: phoenix Updated Branches: refs/heads/master 0c1fd3ad5 -> 8ece81b55 PHOENIX-2674 PhoenixMapReduceUtil#setInput doesn't honor condition clause Setting the condition in the PhoenixMapReduceUtil, as well as some slight cleanup for duplicate code in setInput(). Adding a test that covers mapreduce with and without a condition. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8ece81b5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8ece81b5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8ece81b5 Branch: refs/heads/master Commit: 8ece81b5522df3e6bd9dfdb3112e101215bb49f1 Parents: 0c1fd3a Author: Jesse Yates Authored: Wed Feb 10 12:46:47 2016 -0800 Committer: Jesse Yates Committed: Fri Feb 12 12:15:42 2016 -0800 -- .../org/apache/phoenix/end2end/MapReduceIT.java | 230 +++ .../mapreduce/util/PhoenixMapReduceUtil.java| 65 +++--- 2 files changed, 264 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ece81b5/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java new file mode 100644 index 000..f030701 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MapReduceIT.java @@ -0,0 +1,230 @@ +/* + * 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.end2end; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.DoubleWritable; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.Mapper; +import org.apache.hadoop.mapreduce.Reducer; +import org.apache.hadoop.mapreduce.lib.db.DBWritable; +import org.apache.phoenix.mapreduce.PhoenixOutputFormat; +import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil; +import org.apache.phoenix.mapreduce.util.PhoenixMapReduceUtil; +import org.apache.phoenix.schema.types.PDouble; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.sql.*; + +import static org.junit.Assert.*; + +/** + * Test that our MapReduce basic tools work as expected + */ +public class MapReduceIT extends BaseHBaseManagedTimeIT { + +private static final String STOCK_TABLE_NAME = "stock"; +private static final String STOCK_STATS_TABLE_NAME = "stock_stats"; +private static final String STOCK_NAME = "STOCK_NAME"; +private static final String RECORDING_YEAR = "RECORDING_YEAR"; +private static final String RECORDINGS_QUARTER = "RECORDINGS_QUARTER"; +private static final String CREATE_STOCK_TABLE = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE_NAME + " ( " + +STOCK_NAME + " VARCHAR NOT NULL ," + RECORDING_YEAR + " INTEGER NOT NULL, " + RECORDINGS_QUARTER + +" DOUBLE array[] CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + " , " + RECORDING_YEAR + "))"; + +private static final String MAX_RECORDING = "MAX_RECORDING"; +private static final String CREATE_STOCK_STATS_TABLE = +"CREATE TABLE IF NOT EXISTS " + STOCK_STATS_TABLE_NAME + "(" + STOCK_NAME + " VARCHAR NOT NULL , " ++ MAX_RECORDING + " DOUBLE CONSTRAINT pk PRIMARY KEY (" + STOCK_NAME + "))"; +private static final String UPSERT = "UPSERT into " + STOCK_TABLE_NAME + " values (?, ?, ?)"; + +@Before +public void setupTables() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE_STOCK_TABLE); +conn.createStatement().execute(CREATE_STOCK_STATS_TABLE); +conn.commit(); +} + +@Test +public void testNoConditionsOnSelect() throws Exception { +final Configuration conf = getUtility().getConfiguration(); +