git commit: PHOENIX-1180 Rename test classes so they are properly picked up by the test runner (Kyle Buzsaki)
Repository: phoenix Updated Branches: refs/heads/4.0 aa2ac700d - 0420b013d PHOENIX-1180 Rename test classes so they are properly picked up by the test runner (Kyle Buzsaki) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0420b013 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0420b013 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0420b013 Branch: refs/heads/4.0 Commit: 0420b013d76b6edc7ffc8e047937810c44db78a0 Parents: aa2ac70 Author: James Taylor jamestay...@apache.org Authored: Tue Aug 19 13:03:12 2014 -0700 Committer: James Taylor jamestay...@apache.org Committed: Tue Aug 19 13:04:28 2014 -0700 -- .../RoundFloorCeilExpressionsTest.java | 230 +++ .../RoundFloorCeilExpressionsUnitTests.java | 230 --- .../phoenix/query/KeyRangeCoalesceTest.java | 161 + .../phoenix/query/KeyRangeCoalesceTests.java| 161 - .../phoenix/query/KeyRangeIntersectTest.java| 97 .../phoenix/query/KeyRangeIntersectTests.java | 97 .../apache/phoenix/query/KeyRangeUnionTest.java | 97 .../phoenix/query/KeyRangeUnionTests.java | 97 8 files changed, 585 insertions(+), 585 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0420b013/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java -- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java b/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java new file mode 100644 index 000..55bcd7f --- /dev/null +++ b/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.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.expression; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.ArrayList; +import java.util.List; + +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.phoenix.expression.function.CeilDateExpression; +import org.apache.phoenix.expression.function.CeilDecimalExpression; +import org.apache.phoenix.expression.function.FloorDateExpression; +import org.apache.phoenix.expression.function.FloorDecimalExpression; +import org.apache.phoenix.expression.function.RoundDateExpression; +import org.apache.phoenix.expression.function.RoundDecimalExpression; +import org.apache.phoenix.expression.function.TimeUnit; +import org.apache.phoenix.schema.IllegalDataException; +import org.apache.phoenix.schema.PDataType; +import org.apache.phoenix.util.DateUtil; +import org.junit.Test; + +/** + * + * Unit tests for {@link RoundDecimalExpression}, {@link FloorDecimalExpression} + * and {@link CeilDecimalExpression}. + * + * + * @since 3.0.0 + */ +public class RoundFloorCeilExpressionsTest { + +@Test +public void testRoundDecimalExpression() throws Exception { +LiteralExpression bd = LiteralExpression.newConstant(1.23898, PDataType.DECIMAL); +Expression rde = RoundDecimalExpression.create(bd, 3); +ImmutableBytesWritable ptr = new ImmutableBytesWritable(); +rde.evaluate(null, ptr); +Object obj = rde.getDataType().toObject(ptr); +assertTrue(obj instanceof BigDecimal); +BigDecimal value = (BigDecimal)obj; +assertEquals(BigDecimal.valueOf(1.239), value); +} + +@Test +public void testCeilDecimalExpression() throws Exception { +LiteralExpression bd = LiteralExpression.newConstant(1.23898, PDataType.DECIMAL); +Expression rde = CeilDecimalExpression.create(bd, 3); +ImmutableBytesWritable ptr = new ImmutableBytesWritable(); +rde.evaluate(null, ptr); +Object obj = rde.getDataType().toObject(ptr);
git commit: PHOENIX-1182 UPSERT SELECT not working with joins; Add a test in DerivedTableIT
Repository: phoenix Updated Branches: refs/heads/3.0 05eb9a668 - 4b511a0c4 PHOENIX-1182 UPSERT SELECT not working with joins; Add a test in DerivedTableIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4b511a0c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4b511a0c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4b511a0c Branch: refs/heads/3.0 Commit: 4b511a0c4a20cd8b2c95ecc73b34f6d970035983 Parents: 05eb9a6 Author: maryannxue maryann...@apache.org Authored: Tue Aug 19 16:15:30 2014 -0400 Committer: maryannxue maryann...@apache.org Committed: Tue Aug 19 16:15:30 2014 -0400 -- .../apache/phoenix/end2end/DerivedTableIT.java | 13 ++ .../org/apache/phoenix/end2end/HashJoinIT.java | 49 .../apache/phoenix/compile/QueryCompiler.java | 13 +++--- 3 files changed, 69 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4b511a0c/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java index 2e45313..8a80764 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java @@ -395,6 +395,19 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { } catch (SQLFeatureNotSupportedException e) { assertEquals(MSG, e.getMessage()); } + +// (groupby orderby) limit +query = SELECT a, s FROM (SELECT a_string a, sum(a_byte) s FROM aTable GROUP BY a_string ORDER BY sum(a_byte)) LIMIT 2; +statement = conn.prepareStatement(query); +rs = statement.executeQuery(); +assertTrue (rs.next()); +assertEquals(C_VALUE,rs.getString(1)); +assertEquals(9,rs.getInt(2)); +assertTrue (rs.next()); +assertEquals(A_VALUE,rs.getString(1)); +assertEquals(10,rs.getInt(2)); + +assertFalse(rs.next()); } finally { conn.close(); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/4b511a0c/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java index 02caa9d..d5f1297 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java @@ -2530,6 +2530,55 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { assertNull(rs.getDate(5)); assertFalse(rs.next()); + +//Bug: PHOENIX-1182 +String sourceTable = SOURCE_TABLE; +String joinTable = JOIN_TABLE; +conn.createStatement().execute(CREATE TABLE + sourceTable ++(TID CHAR(3) NOT NULL, ++ A UNSIGNED_INT NOT NULL, ++ B UNSIGNED_INT NOT NULL ++ CONSTRAINT pk PRIMARY KEY (TID, A, B))); +conn.createStatement().execute(CREATE TABLE + joinTable ++(TID CHAR(3) NOT NULL, ++ A UNSIGNED_INT NOT NULL, ++ B UNSIGNED_INT NOT NULL, ++ COUNT UNSIGNED_INT ++ CONSTRAINT pk PRIMARY KEY (TID, A, B))); + +PreparedStatement upsertStmt = conn.prepareStatement( +upsert into + sourceTable + (TID, A, B) + values (?, ?, ?)); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 1); +upsertStmt.setInt(3, 1); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 1); +upsertStmt.setInt(3, 2); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 1); +upsertStmt.setInt(3, 3); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 2); +upsertStmt.setInt(3, 1); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 2); +upsertStmt.setInt(3, 2); +upsertStmt.execute(); +conn.commit(); + +upsertStmt = conn.prepareStatement( +
git commit: PHOENIX-1182 UPSERT SELECT not working with joins; Add a test in DerivedTableIT
Repository: phoenix Updated Branches: refs/heads/4.0 0420b013d - 9973c1ac6 PHOENIX-1182 UPSERT SELECT not working with joins; Add a test in DerivedTableIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9973c1ac Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9973c1ac Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9973c1ac Branch: refs/heads/4.0 Commit: 9973c1ac6db6acac172e66abf1651a839e64788c Parents: 0420b01 Author: maryannxue maryann...@apache.org Authored: Tue Aug 19 16:19:16 2014 -0400 Committer: maryannxue maryann...@apache.org Committed: Tue Aug 19 16:19:16 2014 -0400 -- .../apache/phoenix/end2end/DerivedTableIT.java | 13 ++ .../org/apache/phoenix/end2end/HashJoinIT.java | 49 .../apache/phoenix/compile/QueryCompiler.java | 13 +++--- 3 files changed, 69 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9973c1ac/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java index 2e45313..8a80764 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java @@ -395,6 +395,19 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { } catch (SQLFeatureNotSupportedException e) { assertEquals(MSG, e.getMessage()); } + +// (groupby orderby) limit +query = SELECT a, s FROM (SELECT a_string a, sum(a_byte) s FROM aTable GROUP BY a_string ORDER BY sum(a_byte)) LIMIT 2; +statement = conn.prepareStatement(query); +rs = statement.executeQuery(); +assertTrue (rs.next()); +assertEquals(C_VALUE,rs.getString(1)); +assertEquals(9,rs.getInt(2)); +assertTrue (rs.next()); +assertEquals(A_VALUE,rs.getString(1)); +assertEquals(10,rs.getInt(2)); + +assertFalse(rs.next()); } finally { conn.close(); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/9973c1ac/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java index e880253..65ebaa6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java @@ -2889,6 +2889,55 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { assertNull(rs.getDate(5)); assertFalse(rs.next()); + +//Bug: PHOENIX-1182 +String sourceTable = SOURCE_TABLE; +String joinTable = JOIN_TABLE; +conn.createStatement().execute(CREATE TABLE + sourceTable ++(TID CHAR(3) NOT NULL, ++ A UNSIGNED_INT NOT NULL, ++ B UNSIGNED_INT NOT NULL ++ CONSTRAINT pk PRIMARY KEY (TID, A, B))); +conn.createStatement().execute(CREATE TABLE + joinTable ++(TID CHAR(3) NOT NULL, ++ A UNSIGNED_INT NOT NULL, ++ B UNSIGNED_INT NOT NULL, ++ COUNT UNSIGNED_INT ++ CONSTRAINT pk PRIMARY KEY (TID, A, B))); + +PreparedStatement upsertStmt = conn.prepareStatement( +upsert into + sourceTable + (TID, A, B) + values (?, ?, ?)); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 1); +upsertStmt.setInt(3, 1); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 1); +upsertStmt.setInt(3, 2); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 1); +upsertStmt.setInt(3, 3); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 2); +upsertStmt.setInt(3, 1); +upsertStmt.execute(); +upsertStmt.setString(1, 1); +upsertStmt.setInt(2, 2); +upsertStmt.setInt(3, 2); +upsertStmt.execute(); +conn.commit(); + +upsertStmt = conn.prepareStatement( +
git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory
Repository: phoenix Updated Branches: refs/heads/4.0 9973c1ac6 - c0bb7368c PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c0bb7368 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c0bb7368 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c0bb7368 Branch: refs/heads/4.0 Commit: c0bb7368c6797c9bdd834387993f671f3caca464 Parents: 9973c1a Author: James Taylor jamestay...@apache.org Authored: Tue Aug 19 16:19:07 2014 -0700 Committer: James Taylor jamestay...@apache.org Committed: Tue Aug 19 16:19:07 2014 -0700 -- .../MutatingParallelIteratorFactory.java| 3 ++- .../apache/phoenix/execute/AggregatePlan.java | 9 + .../phoenix/iterate/ChunkedResultIterator.java | 21 .../phoenix/iterate/ParallelIterators.java | 4 ++-- .../phoenix/iterate/SpoolingResultIterator.java | 3 ++- 5 files changed, 19 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0bb7368/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java index fbfce29..df91b1d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java @@ -26,6 +26,7 @@ import java.sql.SQLException; import java.util.List; import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.execute.MutationState; import org.apache.phoenix.iterate.ParallelIterators.ParallelIteratorFactory; import org.apache.phoenix.iterate.PeekingResultIterator; @@ -58,7 +59,7 @@ public abstract class MutatingParallelIteratorFactory implements ParallelIterato abstract protected MutationState mutate(StatementContext context, ResultIterator iterator, PhoenixConnection connection) throws SQLException; @Override -public PeekingResultIterator newIterator(StatementContext context, ResultIterator iterator) throws SQLException { +public PeekingResultIterator newIterator(StatementContext context, ResultIterator iterator, Scan scan) throws SQLException { final PhoenixConnection connection = new PhoenixConnection(this.connection); MutationState state = mutate(context, iterator, connection); long totalRowCount = state.getUpdateCount(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0bb7368/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java index 67c7bb7..d45e036 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java @@ -22,6 +22,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.compile.GroupByCompiler.GroupBy; import org.apache.phoenix.compile.OrderByCompiler.OrderBy; import org.apache.phoenix.compile.RowProjector; @@ -94,7 +95,7 @@ public class AggregatePlan extends BasicQueryPlan { this.services = services; } @Override -public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner) throws SQLException { +public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner, Scan scan) throws SQLException { Expression expression = RowKeyExpression.INSTANCE; OrderByExpression orderByExpression = new OrderByExpression(expression, false, true); int threshold = services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); @@ -111,9 +112,9 @@ public class AggregatePlan extends BasicQueryPlan { this.outerFactory = outerFactory; } @Override -public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner) throws SQLException { -PeekingResultIterator iterator = innerFactory.newIterator(context, scanner); -return outerFactory.newIterator(context, iterator); +public PeekingResultIterator
Apache-Phoenix | 4.0 | Hadoop1 | Build Successful
4.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/ Changes [jamestaylor] PHOENIX-1180 Rename test classes so they are properly picked up by the test runner (Kyle Buzsaki) [maryannxue] PHOENIX-1182 UPSERT SELECT not working with joins; Add a test in DerivedTableIT [jamestaylor] PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory
git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory
Repository: phoenix Updated Branches: refs/heads/3.0 0ced64677 - 91e5d3a1e PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/91e5d3a1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/91e5d3a1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/91e5d3a1 Branch: refs/heads/3.0 Commit: 91e5d3a1ef4c38650ac840ae30c04b0f31c8f7a0 Parents: 0ced646 Author: James Taylor jamestay...@apache.org Authored: Tue Aug 19 18:26:56 2014 -0700 Committer: James Taylor jamestay...@apache.org Committed: Tue Aug 19 18:26:56 2014 -0700 -- .../phoenix/compile/StatementContext.java | 23 .../phoenix/iterate/ChunkedResultIterator.java | 6 + .../phoenix/iterate/ParallelIterators.java | 5 ++--- 3 files changed, 8 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/91e5d3a1/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java index 387696b..23f6963 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java @@ -93,29 +93,6 @@ public class StatementContext { this.whereConditionColumns = new ArrayListPairbyte[],byte[](); } -/** - * Copy constructor where an altered scan can be set. - * - * @param stmtContext the {@code StatementContext} to be copied - * @param scan the customized scan - */ -public StatementContext(StatementContext stmtContext, Scan scan) { -this.statement = stmtContext.statement; -this.resolver = stmtContext.resolver; -this.scan = scan; -this.sequences = stmtContext.sequences; -this.binds = stmtContext.binds; -this.aggregates = stmtContext.aggregates; -this.expressions = stmtContext.expressions; -this.dateFormat = stmtContext.dateFormat; -this.dateFormatter = stmtContext.dateFormatter; -this.dateParser = stmtContext.dateParser; -this.numberFormat = stmtContext.numberFormat; -this.tempPtr = new ImmutableBytesWritable(); -this.currentTable = stmtContext.currentTable; -this.whereConditionColumns = stmtContext.whereConditionColumns; -} - public String getDateFormat() { return dateFormat; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/91e5d3a1/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java index 38e91bd..d7fbe79 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java @@ -30,12 +30,15 @@ import org.apache.phoenix.query.QueryServicesOptions; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.tuple.Tuple; import org.apache.phoenix.util.ScanUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * {@code PeekingResultIterator} implementation that loads data in chunks. This is intended for * basic scan plans, to avoid loading large quantities of data from HBase in one go. */ public class ChunkedResultIterator implements PeekingResultIterator { +private static final Logger logger = LoggerFactory.getLogger(ChunkedResultIterator.class); private final ParallelIterators.ParallelIteratorFactory delegateIteratorFactory; private SingleChunkResultIterator singleChunkResultIterator; @@ -59,6 +62,7 @@ public class ChunkedResultIterator implements PeekingResultIterator { @Override public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner, Scan scan) throws SQLException { scanner.close(); //close the iterator since we don't need it anymore. +if (logger.isDebugEnabled()) logger.debug(ChunkedResultIteratorFactory.newIterator over + tableRef.getTable().getName().getString() + with + scan); return new ChunkedResultIterator(delegateFactory, context, tableRef, scan, context.getConnection().getQueryServices().getProps().getLong( QueryServices.SCAN_RESULT_CHUNK_SIZE, @@ -102,6
[1/2] git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory
Repository: phoenix Updated Branches: refs/heads/master 1fe4af34f - b5971dae6 PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5c0a08e5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5c0a08e5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5c0a08e5 Branch: refs/heads/master Commit: 5c0a08e523a1f66d25c87af3a1fb396c36dc4249 Parents: 1fe4af3 Author: James Taylor jamestay...@apache.org Authored: Tue Aug 19 16:19:07 2014 -0700 Committer: James Taylor jamestay...@apache.org Committed: Tue Aug 19 18:39:34 2014 -0700 -- .../MutatingParallelIteratorFactory.java| 3 ++- .../apache/phoenix/execute/AggregatePlan.java | 9 + .../phoenix/iterate/ChunkedResultIterator.java | 21 .../phoenix/iterate/ParallelIterators.java | 4 ++-- .../phoenix/iterate/SpoolingResultIterator.java | 3 ++- 5 files changed, 19 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c0a08e5/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java index fbfce29..df91b1d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java @@ -26,6 +26,7 @@ import java.sql.SQLException; import java.util.List; import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.execute.MutationState; import org.apache.phoenix.iterate.ParallelIterators.ParallelIteratorFactory; import org.apache.phoenix.iterate.PeekingResultIterator; @@ -58,7 +59,7 @@ public abstract class MutatingParallelIteratorFactory implements ParallelIterato abstract protected MutationState mutate(StatementContext context, ResultIterator iterator, PhoenixConnection connection) throws SQLException; @Override -public PeekingResultIterator newIterator(StatementContext context, ResultIterator iterator) throws SQLException { +public PeekingResultIterator newIterator(StatementContext context, ResultIterator iterator, Scan scan) throws SQLException { final PhoenixConnection connection = new PhoenixConnection(this.connection); MutationState state = mutate(context, iterator, connection); long totalRowCount = state.getUpdateCount(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c0a08e5/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java index 67c7bb7..d45e036 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java @@ -22,6 +22,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.compile.GroupByCompiler.GroupBy; import org.apache.phoenix.compile.OrderByCompiler.OrderBy; import org.apache.phoenix.compile.RowProjector; @@ -94,7 +95,7 @@ public class AggregatePlan extends BasicQueryPlan { this.services = services; } @Override -public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner) throws SQLException { +public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner, Scan scan) throws SQLException { Expression expression = RowKeyExpression.INSTANCE; OrderByExpression orderByExpression = new OrderByExpression(expression, false, true); int threshold = services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); @@ -111,9 +112,9 @@ public class AggregatePlan extends BasicQueryPlan { this.outerFactory = outerFactory; } @Override -public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner) throws SQLException { -PeekingResultIterator iterator = innerFactory.newIterator(context, scanner); -return outerFactory.newIterator(context, iterator); +public PeekingResultIterator
Apache-Phoenix | 4.0 | Hadoop1 | Build Successful
4.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/ Changes [jamestaylor] PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory