[09/14] phoenix git commit: PHOENIX-2820 Investigate why SortMergeJoinIT has a sort in the explain plan
PHOENIX-2820 Investigate why SortMergeJoinIT has a sort in the explain plan Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/91800b70 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/91800b70 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/91800b70 Branch: refs/heads/calcite Commit: 91800b703d9879574ac5b3ee6fcfe6dd73af2148 Parents: 1e47821 Author: James TaylorAuthored: Thu Apr 7 18:52:52 2016 -0700 Committer: James Taylor Committed: Thu Apr 7 18:52:52 2016 -0700 -- .../org/apache/phoenix/end2end/SortMergeJoinIT.java | 6 +- .../phoenix/end2end/SubqueryUsingSortMergeJoinIT.java | 2 -- .../org/apache/phoenix/compile/GroupByCompiler.java | 12 3 files changed, 13 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/91800b70/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java index b62acc4..f19b886 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java @@ -113,8 +113,6 @@ public class SortMergeJoinIT extends BaseHBaseManagedTimeIT { "AND\n" + "SORT-MERGE-JOIN (INNER) TABLES\n" + "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ITEM_TABLE_DISPLAY_NAME + "\n" + -"SERVER SORTED BY [\"I.item_id\"]\n" + -"CLIENT MERGE SORT\n" + "AND (SKIP MERGE)\n" + "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + "SERVER FILTER BY QUANTITY < 5000\n" + @@ -134,9 +132,7 @@ public class SortMergeJoinIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL 1-WAY FULL SCAN OVER Join.ItemTable\n" + "AND\n" + "CLIENT PARALLEL 1-WAY FULL SCAN OVER Join.ItemTable\n" + -"SERVER FILTER BY FIRST KEY ONLY\n" + -"SERVER SORTED BY [\"I2.item_id\"]\n" + -"CLIENT MERGE SORT" +"SERVER FILTER BY FIRST KEY ONLY" }}); testCases.add(new String[][] { { http://git-wip-us.apache.org/repos/asf/phoenix/blob/91800b70/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java index 6a34c57..f7a798e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java @@ -114,8 +114,6 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { "CLIENT MERGE SORT\n" + "AND\n" + "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME + "\n" + -"SERVER SORTED BY [\"S.supplier_id\"]\n" + -"CLIENT MERGE SORT\n" + "CLIENT SORTED BY [\"I.item_id\"]\n" + "AND (SKIP MERGE)\n" + "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + " ['001'] - [*]\n" + http://git-wip-us.apache.org/repos/asf/phoenix/blob/91800b70/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java index cabe777..ceab2f1 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java @@ -60,8 +60,14 @@ public class GroupByCompiler { private final boolean isOrderPreserving; public static final GroupByCompiler.GroupBy EMPTY_GROUP_BY = new GroupBy(new GroupByBuilder()) { @Override +public GroupBy compile(StatementContext context, TupleProjector tupleProjector) throws SQLException { +return this; +} +
[14/14] phoenix git commit: Sync with Phoenix master
Sync with Phoenix master Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e0dc286a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e0dc286a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e0dc286a Branch: refs/heads/calcite Commit: e0dc286a4655dd5a704044601a498b2aecc395f7 Parents: 760723a 776eea9 Author: maryannxue <maryann@gmail.com> Authored: Fri Apr 8 11:40:40 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Fri Apr 8 11:40:40 2016 -0400 -- .../apache/phoenix/end2end/AutoCommitIT.java| 14 +- .../apache/phoenix/end2end/CreateTableIT.java | 2 +- .../phoenix/end2end/CsvBulkLoadToolIT.java | 32 +++ .../apache/phoenix/end2end/DerivedTableIT.java | 144 +- .../apache/phoenix/end2end/GroupByCaseIT.java | 82 ++ .../org/apache/phoenix/end2end/HashJoinIT.java | 170 +++- .../phoenix/end2end/QueryWithOffsetIT.java | 211 +++ .../org/apache/phoenix/end2end/ReadOnlyIT.java | 12 +- .../apache/phoenix/end2end/SortMergeJoinIT.java | 44 +++ .../phoenix/end2end/StatsCollectorIT.java | 6 + .../org/apache/phoenix/end2end/SubqueryIT.java | 6 +- .../end2end/SubqueryUsingSortMergeJoinIT.java | 6 +- .../end2end/index/IndexExpressionIT.java| 6 +- .../phoenix/end2end/index/LocalIndexIT.java | 2 +- .../phoenix/end2end/index/ViewIndexIT.java | 72 - phoenix-core/src/main/antlr3/PhoenixSQL.g | 16 +- .../calcite/rel/PhoenixAbstractAggregate.java | 7 +- .../calcite/rel/PhoenixClientAggregate.java | 2 +- .../phoenix/calcite/rel/PhoenixClientJoin.java | 2 +- .../calcite/rel/PhoenixClientProject.java | 2 +- .../phoenix/calcite/rel/PhoenixClientSort.java | 2 +- .../phoenix/calcite/rel/PhoenixFilter.java | 2 +- .../phoenix/calcite/rel/PhoenixLimit.java | 2 +- .../calcite/rel/PhoenixMergeSortUnion.java | 2 +- .../calcite/rel/PhoenixServerAggregate.java | 2 +- .../phoenix/calcite/rel/PhoenixTableScan.java | 3 +- .../phoenix/calcite/rel/PhoenixUnion.java | 2 +- .../phoenix/calcite/rel/PhoenixValues.java | 2 +- .../apache/phoenix/compile/DeleteCompiler.java | 13 +- .../apache/phoenix/compile/GroupByCompiler.java | 265 +++ .../apache/phoenix/compile/JoinCompiler.java| 10 +- .../phoenix/compile/ListJarsQueryPlan.java | 5 + .../apache/phoenix/compile/OffsetCompiler.java | 114 .../apache/phoenix/compile/OrderByCompiler.java | 3 +- .../apache/phoenix/compile/PostDDLCompiler.java | 3 +- .../apache/phoenix/compile/QueryCompiler.java | 59 +++-- .../org/apache/phoenix/compile/QueryPlan.java | 2 + .../phoenix/compile/StatementNormalizer.java| 2 +- .../phoenix/compile/SubqueryRewriter.java | 10 +- .../phoenix/compile/SubselectRewriter.java | 17 +- .../apache/phoenix/compile/TraceQueryPlan.java | 5 + .../apache/phoenix/compile/UpsertCompiler.java | 2 +- .../coprocessor/BaseScannerRegionObserver.java | 1 + .../phoenix/coprocessor/ScanRegionObserver.java | 95 ++- .../apache/phoenix/execute/AggregatePlan.java | 53 ++-- .../apache/phoenix/execute/BaseQueryPlan.java | 9 +- .../phoenix/execute/ClientAggregatePlan.java| 25 +- .../phoenix/execute/ClientProcessingPlan.java | 10 +- .../apache/phoenix/execute/ClientScanPlan.java | 40 ++- .../apache/phoenix/execute/CorrelatePlan.java | 2 +- .../phoenix/execute/DegenerateQueryPlan.java| 2 +- .../phoenix/execute/DelegateQueryPlan.java | 4 + .../execute/LiteralResultIterationPlan.java | 15 +- .../org/apache/phoenix/execute/ScanPlan.java| 64 +++-- .../phoenix/execute/SortMergeJoinPlan.java | 7 +- .../org/apache/phoenix/execute/UnionPlan.java | 17 +- .../apache/phoenix/execute/UnnestArrayPlan.java | 2 +- .../phoenix/iterate/BaseResultIterators.java| 19 +- .../apache/phoenix/iterate/ExplainTable.java| 16 +- .../phoenix/iterate/LimitingResultIterator.java | 2 +- .../iterate/MergeSortTopNResultIterator.java| 21 +- .../phoenix/iterate/OffsetResultIterator.java | 62 + .../OrderedAggregatingResultIterator.java | 6 +- .../phoenix/iterate/OrderedResultIterator.java | 58 ++-- .../phoenix/iterate/ParallelIterators.java | 4 +- .../apache/phoenix/iterate/SerialIterators.java | 19 +- .../phoenix/iterate/TableResultIterator.java| 22 +- .../apache/phoenix/jdbc/PhoenixStatement.java | 18 +- .../org/apache/phoenix/join/HashJoinInfo.java | 2 +- .../phoenix/mapreduce/CsvBulkLoadTool.java | 3 +- .../apache/phoenix/optimize/QueryOptimizer.java | 2 +- .../apache/phoenix/parse/DeleteStatement.java | 6 + .../phoenix/parse/FilterableStatement.java | 1 + .../org/apache/phoenix/parse/Off
[05/14] phoenix git commit: PHOENIX-2802 Merge sort usually not necessary for ORDERED aggregation
PHOENIX-2802 Merge sort usually not necessary for ORDERED aggregation Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8916eb79 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8916eb79 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8916eb79 Branch: refs/heads/calcite Commit: 8916eb791b37a2444135abba7c4b640630eb859c Parents: 1576662 Author: James TaylorAuthored: Sat Apr 2 08:50:53 2016 -0700 Committer: James Taylor Committed: Sat Apr 2 08:50:53 2016 -0700 -- phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8916eb79/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 07408f6..00655cf 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 @@ -825,6 +825,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + "" + JOIN_ITEM_TABLE_DISPLAY_NAME+" [-32768]\n" + "SERVER FILTER BY FIRST KEY ONLY\n" + "SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [\"I.0:NAME\"]\n" + +"CLIENT MERGE SORT\n" + "PARALLEL LEFT-JOIN TABLE 0\n" + "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME, /*
phoenix git commit: Change Calcite version to 1.8.0-SNAPSHOT
Repository: phoenix Updated Branches: refs/heads/calcite aa0bf5834 -> 760723a1e Change Calcite version to 1.8.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/760723a1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/760723a1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/760723a1 Branch: refs/heads/calcite Commit: 760723a1ef949420663e2980a109689e02688e49 Parents: aa0bf58 Author: maryannxue <maryann@gmail.com> Authored: Thu Apr 7 22:27:32 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Thu Apr 7 22:27:32 2016 -0400 -- .../phoenix/calcite/metadata/PhoenixRelMdCollation.java | 12 ++-- .../phoenix/calcite/metadata/PhoenixRelMdRowCount.java | 12 +++- .../phoenix/calcite/metadata/PhoenixRelMdSize.java | 12 ++-- .../calcite/metadata/PhoenixRelMetadataProvider.java| 2 +- pom.xml | 2 +- 5 files changed, 33 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/760723a1/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdCollation.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdCollation.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdCollation.java index 02bf8e3..281ed2b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdCollation.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdCollation.java @@ -6,6 +6,9 @@ import org.apache.calcite.rel.RelCollation; import org.apache.calcite.rel.RelCollations; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.JoinRelType; +import org.apache.calcite.rel.metadata.BuiltInMetadata; +import org.apache.calcite.rel.metadata.MetadataDef; +import org.apache.calcite.rel.metadata.MetadataHandler; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; import org.apache.calcite.rel.metadata.RelMdCollation; import org.apache.calcite.rel.metadata.RelMetadataProvider; @@ -22,13 +25,18 @@ import org.apache.phoenix.calcite.rel.PhoenixTableScan; import com.google.common.collect.ImmutableList; -public class PhoenixRelMdCollation { +public class PhoenixRelMdCollation implements MetadataHandler { public static final RelMetadataProvider SOURCE = ReflectiveRelMetadataProvider.reflectiveSource( BuiltInMethod.COLLATIONS.method, new PhoenixRelMdCollation()); private PhoenixRelMdCollation() { } +@Override +public MetadataDef getDef() { +return BuiltInMetadata.Collation.DEF; +} + public ImmutableList collations(PhoenixTableScan tableScan, RelMetadataQuery mq) { return ImmutableList.copyOf(tableScan.getCollationList()); } @@ -49,7 +57,7 @@ public class PhoenixRelMdCollation { return ImmutableList.copyOf(PhoenixRelMdCollation.mergeJoin(mq, join.getLeft(), join.getRight(), join.joinInfo.leftKeys, join.joinInfo.rightKeys)); } -public ImmutableList collations(PhoenixMergeSortUnion union) { +public ImmutableList collations(PhoenixMergeSortUnion union, RelMetadataQuery mq) { return ImmutableList.of(union.collation); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/760723a1/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java index 1bd4c15..aab8624 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java @@ -1,6 +1,9 @@ package org.apache.phoenix.calcite.metadata; import org.apache.calcite.rel.core.Aggregate; +import org.apache.calcite.rel.metadata.BuiltInMetadata; +import org.apache.calcite.rel.metadata.MetadataDef; +import org.apache.calcite.rel.metadata.MetadataHandler; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; import org.apache.calcite.rel.metadata.RelMetadataProvider; import org.apache.calcite.rel.metadata.RelMetadataQuery; @@ -9,10 +12,17 @@ import org.apache.calcite.util.ImmutableBitSet; import org.apache.phoenix.calcite.rel.PhoenixAbstractAggregate; import org.apache.phoenix.calcite.rel.PhoenixLimit; -public class PhoenixRelMdRowCount { +public class PhoenixRelMdRowCount implements
phoenix git commit: PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 14646e84a -> cede5a991 PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cede5a99 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cede5a99 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cede5a99 Branch: refs/heads/4.x-HBase-1.0 Commit: cede5a9914981384313ba7a4962a13ef46411669 Parents: 14646e8 Author: maryannxue <maryann@gmail.com> Authored: Tue Apr 5 13:41:16 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Tue Apr 5 13:41:16 2016 -0400 -- .../phoenix/end2end/index/ViewIndexIT.java | 72 ++-- .../apache/phoenix/index/IndexMaintainer.java | 3 +- .../org/apache/phoenix/schema/ValueSchema.java | 5 -- 3 files changed, 67 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cede5a99/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java index 79b776c..34094d5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java @@ -17,13 +17,17 @@ */ package org.apache.phoenix.end2end.index; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; +import java.util.Properties; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HBaseAdmin; @@ -32,6 +36,7 @@ import org.apache.phoenix.end2end.Shadower; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.TestUtil; import org.junit.BeforeClass; @@ -54,22 +59,32 @@ public class ViewIndexIT extends BaseHBaseManagedTimeIT { setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } -private void createBaseTable(String tableName, Integer saltBuckets, String splits) throws SQLException { +private void createBaseTable(String tableName, boolean multiTenant, Integer saltBuckets, String splits) throws SQLException { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + tableName + " (t_id VARCHAR NOT NULL,\n" + -"k1 INTEGER NOT NULL,\n" + +"k1 VARCHAR NOT NULL,\n" + "k2 INTEGER NOT NULL,\n" + "v1 VARCHAR,\n" + -"CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n" -+ (saltBuckets == null || splits != null ? "" : (",salt_buckets=" + saltBuckets) -+ (saltBuckets != null || splits == null ? "" : ",splits=" + splits)); -conn.createStatement().execute(ddl); +"v2 INTEGER,\n" + +"CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n"; +String ddlOptions = multiTenant ? "MULTI_TENANT=true" : ""; +if (saltBuckets != null) { +ddlOptions = ddlOptions ++ (ddlOptions.isEmpty() ? "" : ",") ++ "salt_buckets=" + saltBuckets; +} +if (splits != null) { +ddlOptions = ddlOptions ++ (ddlOptions.isEmpty() ? "" : ",") ++ "splits=" + splits; +} +conn.createStatement().execute(ddl + ddlOptions); conn.close(); } @Test public void testDeleteViewIndexSequences() throws Exception { -createBaseTable(TestUtil.DEFAULT_DATA_TABLE_NAME, null, null); +createBaseTable(TestUtil.DEFAULT_DATA_TABLE_NAME, false, null, null); Connection conn1 = DriverManager.getConnection(getUrl()); Connection conn2 = DriverManager.getConnection(getUrl()); conn1.createStatement().execute("CREATE VIEW " + VIEW_NAME + " AS SELECT * FROM " + TestUtil.DEFAULT_DATA_TABLE_NAME); @@ -86,4 +101,47 @@ p
phoenix git commit: PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 5f00c1f95 -> 8e9fcb6b4 PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8e9fcb6b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8e9fcb6b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8e9fcb6b Branch: refs/heads/4.x-HBase-0.98 Commit: 8e9fcb6b47ef315eda901eea7e2ebdb134d74cb8 Parents: 5f00c1f Author: maryannxue <maryann@gmail.com> Authored: Tue Apr 5 13:31:45 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Tue Apr 5 13:31:45 2016 -0400 -- .../phoenix/end2end/index/ViewIndexIT.java | 72 ++-- .../apache/phoenix/index/IndexMaintainer.java | 3 +- .../org/apache/phoenix/schema/ValueSchema.java | 5 -- 3 files changed, 67 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8e9fcb6b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java index 79b776c..34094d5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java @@ -17,13 +17,17 @@ */ package org.apache.phoenix.end2end.index; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; +import java.util.Properties; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HBaseAdmin; @@ -32,6 +36,7 @@ import org.apache.phoenix.end2end.Shadower; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.TestUtil; import org.junit.BeforeClass; @@ -54,22 +59,32 @@ public class ViewIndexIT extends BaseHBaseManagedTimeIT { setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } -private void createBaseTable(String tableName, Integer saltBuckets, String splits) throws SQLException { +private void createBaseTable(String tableName, boolean multiTenant, Integer saltBuckets, String splits) throws SQLException { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + tableName + " (t_id VARCHAR NOT NULL,\n" + -"k1 INTEGER NOT NULL,\n" + +"k1 VARCHAR NOT NULL,\n" + "k2 INTEGER NOT NULL,\n" + "v1 VARCHAR,\n" + -"CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n" -+ (saltBuckets == null || splits != null ? "" : (",salt_buckets=" + saltBuckets) -+ (saltBuckets != null || splits == null ? "" : ",splits=" + splits)); -conn.createStatement().execute(ddl); +"v2 INTEGER,\n" + +"CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n"; +String ddlOptions = multiTenant ? "MULTI_TENANT=true" : ""; +if (saltBuckets != null) { +ddlOptions = ddlOptions ++ (ddlOptions.isEmpty() ? "" : ",") ++ "salt_buckets=" + saltBuckets; +} +if (splits != null) { +ddlOptions = ddlOptions ++ (ddlOptions.isEmpty() ? "" : ",") ++ "splits=" + splits; +} +conn.createStatement().execute(ddl + ddlOptions); conn.close(); } @Test public void testDeleteViewIndexSequences() throws Exception { -createBaseTable(TestUtil.DEFAULT_DATA_TABLE_NAME, null, null); +createBaseTable(TestUtil.DEFAULT_DATA_TABLE_NAME, false, null, null); Connection conn1 = DriverManager.getConnection(getUrl()); Connection conn2 = DriverManager.getConnection(getUrl()); conn1.createStatement().execute("CREATE VIEW " + VIEW_NAME + " AS SELECT * FROM " + TestUtil.DEFAULT_DATA_TABLE_NAME); @@ -86,4 +101,47 @@ p
phoenix git commit: PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field)
Repository: phoenix Updated Branches: refs/heads/master 8916eb791 -> 3420a973c PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3420a973 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3420a973 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3420a973 Branch: refs/heads/master Commit: 3420a973c3fbe5ee4483216e54596869665c7cc9 Parents: 8916eb7 Author: maryannxue <maryann@gmail.com> Authored: Tue Apr 5 13:25:55 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Tue Apr 5 13:25:55 2016 -0400 -- .../phoenix/end2end/index/ViewIndexIT.java | 72 ++-- .../apache/phoenix/index/IndexMaintainer.java | 3 +- .../org/apache/phoenix/schema/ValueSchema.java | 5 -- 3 files changed, 67 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3420a973/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java index 79b776c..34094d5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java @@ -17,13 +17,17 @@ */ package org.apache.phoenix.end2end.index; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; +import java.util.Properties; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HBaseAdmin; @@ -32,6 +36,7 @@ import org.apache.phoenix.end2end.Shadower; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.TestUtil; import org.junit.BeforeClass; @@ -54,22 +59,32 @@ public class ViewIndexIT extends BaseHBaseManagedTimeIT { setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } -private void createBaseTable(String tableName, Integer saltBuckets, String splits) throws SQLException { +private void createBaseTable(String tableName, boolean multiTenant, Integer saltBuckets, String splits) throws SQLException { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + tableName + " (t_id VARCHAR NOT NULL,\n" + -"k1 INTEGER NOT NULL,\n" + +"k1 VARCHAR NOT NULL,\n" + "k2 INTEGER NOT NULL,\n" + "v1 VARCHAR,\n" + -"CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n" -+ (saltBuckets == null || splits != null ? "" : (",salt_buckets=" + saltBuckets) -+ (saltBuckets != null || splits == null ? "" : ",splits=" + splits)); -conn.createStatement().execute(ddl); +"v2 INTEGER,\n" + +"CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n"; +String ddlOptions = multiTenant ? "MULTI_TENANT=true" : ""; +if (saltBuckets != null) { +ddlOptions = ddlOptions ++ (ddlOptions.isEmpty() ? "" : ",") ++ "salt_buckets=" + saltBuckets; +} +if (splits != null) { +ddlOptions = ddlOptions ++ (ddlOptions.isEmpty() ? "" : ",") ++ "splits=" + splits; +} +conn.createStatement().execute(ddl + ddlOptions); conn.close(); } @Test public void testDeleteViewIndexSequences() throws Exception { -createBaseTable(TestUtil.DEFAULT_DATA_TABLE_NAME, null, null); +createBaseTable(TestUtil.DEFAULT_DATA_TABLE_NAME, false, null, null); Connection conn1 = DriverManager.getConnection(getUrl()); Connection conn2 = DriverManager.getConnection(getUrl()); conn1.createStatement().execute("CREATE VIEW " + VIEW_NAME + " AS SELECT * FROM " + TestUtil.DEFAULT_DATA_TABLE_NAME); @@ -86,4 +101,47 @@ public class ViewIndexIT extend
[1/2] phoenix git commit: PHOENIX-2128 Implement using local index with missing columns
Repository: phoenix Updated Branches: refs/heads/calcite c9f117e5b -> aa0bf5834 http://git-wip-us.apache.org/repos/asf/phoenix/blob/aa0bf583/phoenix-core/src/main/java/org/apache/phoenix/execute/CorrelatePlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/CorrelatePlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/CorrelatePlan.java index 1981c4b..dcab6a6 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/CorrelatePlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/CorrelatePlan.java @@ -150,7 +150,7 @@ public class CorrelatePlan extends DelegateQueryPlan { close(); return null; } -runtimeContext.setCorrelateVariableValue(variableId, current); + runtimeContext.getCorrelateVariable(variableId).setValue(current); rhsIter = rhs.iterator(); rhsCurrent = rhsIter.next(); if ((rhsCurrent == null && (joinType == JoinType.Inner || joinType == JoinType.Semi)) http://git-wip-us.apache.org/repos/asf/phoenix/blob/aa0bf583/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContext.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContext.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContext.java index 99f409e..ea2b74a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContext.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContext.java @@ -18,17 +18,16 @@ package org.apache.phoenix.execute; import org.apache.phoenix.expression.Expression; -import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.tuple.Tuple; public interface RuntimeContext { + +public interface CorrelateVariable { +public Expression newExpression(int index); +public Tuple getValue(); +public void setValue(Tuple value); +} -public abstract void defineCorrelateVariable(String variableId, TableRef def); - -public abstract Expression newCorrelateVariableReference(String variableId, int index); - -public abstract void setCorrelateVariableValue(String variableId, Tuple value); - -public abstract Tuple getCorrelateVariableValue(String variableId); - +public void defineCorrelateVariable(String variableId, CorrelateVariable def); +public CorrelateVariable getCorrelateVariable(String variableId); } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/aa0bf583/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java index 0accea6..86097bd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java @@ -17,73 +17,28 @@ */ package org.apache.phoenix.execute; -import java.util.List; import java.util.Map; -import org.apache.phoenix.calcite.PhoenixTable; -import org.apache.phoenix.expression.Expression; -import org.apache.phoenix.schema.ColumnRef; -import org.apache.phoenix.schema.PColumn; -import org.apache.phoenix.schema.TableRef; -import org.apache.phoenix.schema.tuple.Tuple; - import com.google.common.collect.Maps; public class RuntimeContextImpl implements RuntimeContext { -MapcorrelateVariables; +Map correlateVariables; public RuntimeContextImpl() { this.correlateVariables = Maps.newHashMap(); } @Override -public void defineCorrelateVariable(String variableId, TableRef def) { -this.correlateVariables.put(variableId, new VariableEntry(def)); +public void defineCorrelateVariable(String variableId, CorrelateVariable def) { +this.correlateVariables.put(variableId, def); } @Override -public Expression newCorrelateVariableReference(String variableId, int index) { -VariableEntry entry = this.correlateVariables.get(variableId); -if (entry == null) -throw new RuntimeException("Variable '" + variableId + "' undefined."); - -return new ColumnRef(entry.def, entry.mappedColumns.get(index).getPosition()).newColumnExpression(); -} - -@Override -public void setCorrelateVariableValue(String variableId, Tuple value) { -VariableEntry entry = this.correlateVariables.get(variableId); -if (entry == null) -throw new RuntimeException("Variable
[2/2] phoenix git commit: PHOENIX-2128 Implement using local index with missing columns
PHOENIX-2128 Implement using local index with missing columns Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/aa0bf583 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/aa0bf583 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/aa0bf583 Branch: refs/heads/calcite Commit: aa0bf5834656909e6814204992b6fec19a166b02 Parents: c9f117e Author: maryannxue <maryann@gmail.com> Authored: Sun Apr 3 13:40:16 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Sun Apr 3 13:40:16 2016 -0400 -- .../phoenix/calcite/CalciteLocalIndexIT.java| 18 + .../apache/phoenix/calcite/CalciteUtils.java| 16 +- .../phoenix/calcite/CorrelateVariableImpl.java | 30 ++ .../apache/phoenix/calcite/PhoenixSchema.java | 6 +- .../apache/phoenix/calcite/PhoenixTable.java| 64 ++-- .../apache/phoenix/calcite/TableMapping.java| 355 +++ .../calcite/jdbc/PhoenixPrepareImpl.java| 2 + .../calcite/rel/PhoenixAbstractAggregate.java | 6 +- .../calcite/rel/PhoenixAbstractProject.java | 6 +- .../calcite/rel/PhoenixClientAggregate.java | 2 +- .../phoenix/calcite/rel/PhoenixClientJoin.java | 10 +- .../calcite/rel/PhoenixClientSemiJoin.java | 6 +- .../phoenix/calcite/rel/PhoenixClientSort.java | 2 +- .../phoenix/calcite/rel/PhoenixCorrelate.java | 13 +- .../phoenix/calcite/rel/PhoenixLimit.java | 2 +- .../apache/phoenix/calcite/rel/PhoenixRel.java | 11 +- .../calcite/rel/PhoenixRelImplementorImpl.java | 75 +--- .../phoenix/calcite/rel/PhoenixServerJoin.java | 8 +- .../calcite/rel/PhoenixServerSemiJoin.java | 8 +- .../phoenix/calcite/rel/PhoenixTableScan.java | 61 ++-- .../rel/PhoenixToEnumerableConverter.java | 2 +- .../phoenix/calcite/rel/PhoenixUncollect.java | 6 +- .../phoenix/calcite/rel/PhoenixValues.java | 8 +- .../rules/PhoenixFilterScanMergeRule.java | 3 +- .../rules/PhoenixForwardTableScanRule.java | 3 +- .../rules/PhoenixReverseTableScanRule.java | 3 +- .../rules/PhoenixTableScanColumnRefRule.java| 50 +++ .../apache/phoenix/execute/CorrelatePlan.java | 2 +- .../apache/phoenix/execute/RuntimeContext.java | 17 +- .../phoenix/execute/RuntimeContextImpl.java | 57 +-- .../apache/phoenix/execute/TupleProjector.java | 12 +- .../CorrelateVariableFieldAccessExpression.java | 2 +- .../java/org/apache/phoenix/util/IndexUtil.java | 6 + .../phoenix/calcite/ToExpressionTest.java | 11 +- .../phoenix/execute/CorrelatePlanTest.java | 27 +- 35 files changed, 659 insertions(+), 251 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/aa0bf583/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java index 90bfc3b..02cf2a1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java @@ -239,6 +239,24 @@ public class CalciteLocalIndexIT extends BaseCalciteIndexIT { {"1000", 1001}, {"1001", 1002}})*/ .close(); + +start(props).sql("select * from " + MULTI_TENANT_VIEW1 + " where col0 = 1000") +.explainIs("PhoenixToEnumerableConverter\n" + + " PhoenixServerProject(ID=[$1], COL0=[CAST($0):INTEGER], COL1=[$2], COL2=[$3])\n" + + "PhoenixTableScan(table=[[phoenix, S1, IDX_MULTITENANT_TEST_VIEW1]], filter=[=(CAST($0):INTEGER, 1000)], extendedColumns=[{2, 3}])\n") +.sameResultAsPhoenixStandalone(0) +/*.resultIs(0, new Object[][] { +{"0999", 1000, 1001, 1002}})*/ +.close(); + +start(props).sql("select id, col0, col2 from " + MULTI_TENANT_VIEW1 + " where col0 = 1000") +.explainIs("PhoenixToEnumerableConverter\n" + + " PhoenixServerProject(ID=[$1], COL0=[CAST($0):INTEGER], COL2=[$3])\n" + + "PhoenixTableScan(table=[[phoenix, S1, IDX_MULTITENANT_TEST_VIEW1]], filter=[=(CAST($0):INTEGER, 1000)], extendedColumns=[{3}])\n") +.sameResultAsPhoenixStandalone(0) +/*.resultIs(0, new Object[][] { +{"0999", 1000, 1002}})*/
phoenix git commit: PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field)
Repository: phoenix Updated Branches: refs/heads/calcite 4e32e29a5 -> c9f117e5b PHOENIX-2819 Remove problematic method ValueSchemaBuilder.addField(Field) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c9f117e5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c9f117e5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c9f117e5 Branch: refs/heads/calcite Commit: c9f117e5b5cc45b27255f4ebb1e23e282e10470f Parents: 4e32e29 Author: maryannxue <maryann@gmail.com> Authored: Sun Apr 3 13:34:26 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Sun Apr 3 13:34:26 2016 -0400 -- .../src/main/java/org/apache/phoenix/index/IndexMaintainer.java | 3 ++- .../src/main/java/org/apache/phoenix/schema/ValueSchema.java| 5 - 2 files changed, 2 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9f117e5/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java index 13ad7e5..57616cb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java @@ -705,7 +705,8 @@ public class IndexMaintainer implements Writable, Iterable { } int dataPosOffset = isDataTableSalted ? 1 : 0 ; if (isMultiTenant) { -builder.addField(dataRowKeySchema.getField(dataPosOffset++)); +Field field = dataRowKeySchema.getField(dataPosOffset++); +builder.addField(field, field.isNullable(), field.getSortOrder()); nIndexedColumns--; } if (viewIndexId != null) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9f117e5/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueSchema.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueSchema.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueSchema.java index a4b40f3..5c8c4f9 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueSchema.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueSchema.java @@ -318,11 +318,6 @@ public abstract class ValueSchema implements Writable { fields.add(new Field(datum, isNullable, 1, sortOrder)); return this; } - -public ValueSchemaBuilder addField(Field field) { -fields.add(field); -return this; -} } public int getEstimatedByteSize() {
phoenix git commit: PHOENIX-2781 Support multi-tenant secondary index in Calcite-Phoenix
Repository: phoenix Updated Branches: refs/heads/calcite caf1c6ed9 -> 4e32e29a5 PHOENIX-2781 Support multi-tenant secondary index in Calcite-Phoenix Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4e32e29a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4e32e29a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4e32e29a Branch: refs/heads/calcite Commit: 4e32e29a562ee83856e36480b17335f5f9a16ea3 Parents: caf1c6e Author: maryannxue <maryann@gmail.com> Authored: Thu Mar 31 09:31:11 2016 -0400 Committer: maryannxue <maryann@gmail.com> Committed: Thu Mar 31 09:31:11 2016 -0400 -- .../phoenix/calcite/CalciteLocalIndexIT.java | 19 ++- .../phoenix/calcite/rel/PhoenixTableScan.java| 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e32e29a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java index 30ec0bc..90bfc3b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java @@ -195,11 +195,11 @@ public class CalciteLocalIndexIT extends BaseCalciteIndexIT { .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(ID=[$1], COL0=[$2], COL1=[CAST($0):INTEGER], COL2=[$3])\n" + "PhoenixTableScan(table=[[phoenix, IDX_MULTITENANT_TEST_TABLE]], filter=[>(CAST($0):INTEGER, 1000)])\n") -//.resultIs(0, new Object[][] { -//{"0999", 1000, 1001, 1002}, -//{"1000", 1001, 1002, 1003}, -//{"1001", 1002, 1003, 1004}, -//{"1002", 1003, 1004, 1005}}) +.resultIs(0, new Object[][] { +{"0999", 1000, 1001, 1002}, +{"1000", 1001, 1002, 1003}, +{"1001", 1002, 1003, 1004}, +{"1002", 1003, 1004, 1005}}) .close(); try { @@ -222,10 +222,11 @@ public class CalciteLocalIndexIT extends BaseCalciteIndexIT { .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(ID=[$1], COL0=[$2], COL1=[CAST($0):INTEGER], COL2=[$3])\n" + "PhoenixTableScan(table=[[phoenix, IDX_MULTITENANT_TEST_TABLE]], filter=[<=(CAST($0):INTEGER, 6)])\n") -//.resultIs(0, new Object[][] { -//{"0002", 3, 4, 5}, -//{"0003", 4, 5, 6}, -//{"0004", 5, 6, 7}}) +.sameResultAsPhoenixStandalone(0) +/*.resultIs(0, new Object[][] { +{"0002", 3, 4, 5}, +{"0003", 4, 5, 6}, +{"0004", 5, 6, 7}})*/ .close(); start(props).sql("select id, col0 from " + MULTI_TENANT_VIEW1 + " where col0 >= 1000") http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e32e29a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java index c510e3b..32c7a90 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java @@ -255,7 +255,7 @@ public class PhoenixTableScan extends TableScan implements PhoenixRel { if (filter != null && !context.getScanRanges().equals(this.scanRanges)) { dynamicFilter = filterExpr; } -projectColumnFamilies(context.getScan(), phoenixTable.getTable(), columnRefList); +projectColumnFamilies(context.getScan(), phoenixTable.mappedColumns, columnRefList); if (implementor.getCurrentContext().forceProject) { TupleProjector tupleProjector = implementor.createTupleProjector(); TupleProj
[26/30] phoenix git commit: PHOENIX-2760 Upgrade phoenix-server and phoenix-server-client to Avatica 1.7.1 (Josh Elser)
PHOENIX-2760 Upgrade phoenix-server and phoenix-server-client to Avatica 1.7.1 (Josh Elser) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/64fdf840 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/64fdf840 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/64fdf840 Branch: refs/heads/calcite Commit: 64fdf840be576db1484d55c4079c81b03d365b4c Parents: d4d973c Author: James TaylorAuthored: Mon Mar 28 08:28:13 2016 -0700 Committer: James Taylor Committed: Mon Mar 28 08:28:13 2016 -0700 -- phoenix-server-client/pom.xml | 4 ++-- phoenix-server/pom.xml | 12 ++-- phoenix-server/src/build/query-server-runnable.xml | 2 +- pom.xml| 14 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/64fdf840/phoenix-server-client/pom.xml -- diff --git a/phoenix-server-client/pom.xml b/phoenix-server-client/pom.xml index 2e7a3b9..1270c46 100644 --- a/phoenix-server-client/pom.xml +++ b/phoenix-server-client/pom.xml @@ -54,8 +54,8 @@ - org.apache.calcite - calcite-avatica + org.apache.calcite.avatica + avatica http://git-wip-us.apache.org/repos/asf/phoenix/blob/64fdf840/phoenix-server/pom.xml -- diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml index ad298dc..b5f6e1f 100644 --- a/phoenix-server/pom.xml +++ b/phoenix-server/pom.xml @@ -66,14 +66,14 @@ phoenix-server-client - org.apache.calcite - calcite-avatica - ${calcite.version} + org.apache.calcite.avatica + avatica + ${avatica.version} - org.apache.calcite - calcite-avatica-server - ${calcite.version} + org.apache.calcite.avatica + avatica-server + ${avatica.version} org.apache.phoenix http://git-wip-us.apache.org/repos/asf/phoenix/blob/64fdf840/phoenix-server/src/build/query-server-runnable.xml -- diff --git a/phoenix-server/src/build/query-server-runnable.xml b/phoenix-server/src/build/query-server-runnable.xml index d4259bf..db22142 100644 --- a/phoenix-server/src/build/query-server-runnable.xml +++ b/phoenix-server/src/build/query-server-runnable.xml @@ -45,7 +45,7 @@ org.apache.phoenix:phoenix-server org.apache.phoenix:phoenix-server-client -org.apache.calcite:* +org.apache.calcite.avatica:* http://git-wip-us.apache.org/repos/asf/phoenix/blob/64fdf840/pom.xml -- diff --git a/pom.xml b/pom.xml index 0add065..389dcc0 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ 1.6 2.1.2 -1.6.0 +1.7.1 8.1.7.v20120910 0.7.0 1.5.2 @@ -610,14 +610,14 @@ -org.apache.calcite -calcite-avatica -${calcite.version} +org.apache.calcite.avatica +avatica +${avatica.version} -org.apache.calcite -calcite-avatica-server -${calcite.version} +org.apache.calcite.avatica +avatica-server +${avatica.version}
[28/30] phoenix git commit: PHOENIX-2803 Initializing ToCharFunction with the List constructor fails
PHOENIX-2803 Initializing ToCharFunction with the List constructor fails Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b9880503 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b9880503 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b9880503 Branch: refs/heads/calcite Commit: b98805039516bfa706f1fa78ed0850d802df5dc8 Parents: d07fed5 Author: Thomas D'SilvaAuthored: Mon Mar 28 12:01:12 2016 -0700 Committer: Thomas D'Silva Committed: Mon Mar 28 14:23:51 2016 -0700 -- .../apache/phoenix/end2end/ToCharFunctionIT.java | 15 +++ .../apache/phoenix/end2end/ToDateFunctionIT.java | 15 +++ .../expression/function/ToCharFunction.java| 13 + .../expression/function/ToDateFunction.java| 17 +++-- .../expression/function/ToNumberFunction.java | 14 ++ .../expression/function/ToTimeFunction.java| 13 + .../expression/function/ToTimestampFunction.java | 13 + .../function/BuiltinFunctionConstructorTest.java | 11 --- 8 files changed, 86 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9880503/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java index 52b5207..1cccf07 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java @@ -28,6 +28,7 @@ import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.text.DateFormat; @@ -240,4 +241,18 @@ public class ToCharFunctionIT extends BaseClientManagedTimeIT { result.setTimeZone(TimeZone.getTimeZone("GMT")); return result; } + +@Test +public void testToCharWithCloneMethod() throws SQLException { +Connection conn = DriverManager.getConnection(getUrl()); + String ddl = "create table t (k varchar primary key, v integer[])"; +conn.createStatement().execute(ddl); +conn.createStatement().execute("UPSERT INTO T VALUES('x',ARRAY[1234])"); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("select to_char(v[1],'000') from t"); +assertTrue(rs.next()); +assertEquals("Unexpected value for date ", String.valueOf(1234), rs.getString(1)); +assertFalse(rs.next()); +} } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9880503/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java index dbe47ca..acb29df 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java @@ -251,4 +251,19 @@ public class ToDateFunctionIT extends BaseHBaseManagedTimeIT { assertEquals("Did not get value that was inserted!!", dateString2, obtainedString); assertFalse("No more rows expected!!", rs.next()); } + +@Test +public void testToDateWithCloneMethod() throws SQLException { +Connection conn = DriverManager.getConnection(getUrl()); + String ddl = "create table t (k varchar primary key, v varchar[])"; +conn.createStatement().execute(ddl); +String dateStr = "2100-01-01"; +conn.createStatement().execute("UPSERT INTO T VALUES('x',ARRAY['"+dateStr+"'])"); +conn.commit(); +ResultSet rs = conn.createStatement().executeQuery("select to_date(v[1], '-MM-dd', 'local') from t"); + +assertTrue(rs.next()); +assertEquals("Unexpected value for date ", Date.valueOf(dateStr), rs.getDate(1)); +assertFalse(rs.next()); +} } http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9880503/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ToCharFunction.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ToCharFunction.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ToCharFunction.java
[10/30] phoenix git commit: PHOENIX-2733 Minor cleanup for improvements to CSV Bulk Loader performance (Sergey Soldatov)
PHOENIX-2733 Minor cleanup for improvements to CSV Bulk Loader performance (Sergey Soldatov) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/952a01cc Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/952a01cc Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/952a01cc Branch: refs/heads/calcite Commit: 952a01cce6d7d314ca26e89a398e75f38690cdad Parents: 1d03e02 Author: James TaylorAuthored: Wed Mar 2 13:54:05 2016 -0800 Committer: James Taylor Committed: Wed Mar 2 13:54:24 2016 -0800 -- .../phoenix/mapreduce/AbstractBulkLoadTool.java | 12 +- .../phoenix/mapreduce/CsvToKeyValueMapper.java | 2 +- .../mapreduce/FormatToBytesWritableMapper.java | 385 +++ .../mapreduce/FormatToKeyValueMapper.java | 378 -- .../mapreduce/FormatToKeyValueReducer.java | 28 +- .../phoenix/mapreduce/JsonToKeyValueMapper.java | 2 +- .../bulkload/TargetTableRefFunctions.java | 2 +- .../util/PhoenixConfigurationUtil.java | 4 +- .../FormatToBytesWritableMapperTest.java| 102 + .../mapreduce/FormatToKeyValueMapperTest.java | 102 - 10 files changed, 516 insertions(+), 501 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/952a01cc/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java index ab2848f..ff73530 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java @@ -209,10 +209,10 @@ public abstract class AbstractBulkLoadTool extends Configured implements Tool { List importColumns = buildImportColumns(conn, cmdLine, qualifiedTableName); Preconditions.checkNotNull(importColumns); Preconditions.checkArgument(!importColumns.isEmpty(), "Column info list is empty"); -FormatToKeyValueMapper.configureColumnInfoList(conf, importColumns); +FormatToBytesWritableMapper.configureColumnInfoList(conf, importColumns); boolean ignoreInvalidRows = cmdLine.hasOption(IGNORE_ERRORS_OPT.getOpt()); -conf.setBoolean(FormatToKeyValueMapper.IGNORE_INVALID_ROW_CONFKEY, ignoreInvalidRows); -conf.set(FormatToKeyValueMapper.TABLE_NAME_CONFKEY, qualifiedTableName); + conf.setBoolean(FormatToBytesWritableMapper.IGNORE_INVALID_ROW_CONFKEY, ignoreInvalidRows); +conf.set(FormatToBytesWritableMapper.TABLE_NAME_CONFKEY, qualifiedTableName); // give subclasses their hook configureOptions(cmdLine, importColumns, conf); @@ -277,10 +277,10 @@ public abstract class AbstractBulkLoadTool extends Configured implements Tool { MultiHfileOutputFormat.configureIncrementalLoad(job, tablesToBeLoaded); final String tableNamesAsJson = TargetTableRefFunctions.NAMES_TO_JSON.apply(tablesToBeLoaded); -final String logicalNamesAsJson = TargetTableRefFunctions.LOGICAN_NAMES_TO_JSON.apply(tablesToBeLoaded); +final String logicalNamesAsJson = TargetTableRefFunctions.LOGICAL_NAMES_TO_JSON.apply(tablesToBeLoaded); - job.getConfiguration().set(FormatToKeyValueMapper.TABLE_NAMES_CONFKEY,tableNamesAsJson); - job.getConfiguration().set(FormatToKeyValueMapper.LOGICAL_NAMES_CONFKEY,logicalNamesAsJson); + job.getConfiguration().set(FormatToBytesWritableMapper.TABLE_NAMES_CONFKEY,tableNamesAsJson); + job.getConfiguration().set(FormatToBytesWritableMapper.LOGICAL_NAMES_CONFKEY,logicalNamesAsJson); // give subclasses their hook setupJob(job); http://git-wip-us.apache.org/repos/asf/phoenix/blob/952a01cc/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java index 2cb1ac7..e5a6e5b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java @@ -41,7 +41,7 @@ import com.google.common.collect.Iterables; * extracting the created KeyValues and rolling back the statement execution before it is * committed to HBase. */ -public class CsvToKeyValueMapper extends FormatToKeyValueMapper { +public class CsvToKeyValueMapper
[13/30] phoenix git commit: PHOENIX-2465 upgrade ANTLR version to correct generation error with Java 8 (Gabor Liptak)
PHOENIX-2465 upgrade ANTLR version to correct generation error with Java 8 (Gabor Liptak) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9815e16e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9815e16e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9815e16e Branch: refs/heads/calcite Commit: 9815e16e2e067aa9372d212d4fe9337b5473e5a1 Parents: 57c17ec Author: James TaylorAuthored: Sat Mar 5 16:39:29 2016 -0800 Committer: James Taylor Committed: Sat Mar 5 16:39:29 2016 -0800 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9815e16e/pom.xml -- diff --git a/pom.xml b/pom.xml index d9e5ff9..9cb83ff 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ 2.5.1 0.13.0 1.9.2 -3.5 +3.5.2 1.2.17 1.6.4 2.5.0
[11/30] phoenix git commit: PHOENIX-2100 Indicate in explain plan when round robin iterator is being used
PHOENIX-2100 Indicate in explain plan when round robin iterator is being used Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6e7acaa4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6e7acaa4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6e7acaa4 Branch: refs/heads/calcite Commit: 6e7acaa4564e837dad3f54f79ac7a9b1e670d93a Parents: 952a01c Author: James TaylorAuthored: Wed Mar 2 15:27:05 2016 -0800 Committer: James Taylor Committed: Wed Mar 2 15:58:27 2016 -0800 -- .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java| 6 +++--- .../it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e7acaa4/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java index fe95470..ef22094 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java @@ -144,7 +144,7 @@ public class IndexToolIT extends BaseOwnClusterHBaseManagedTimeIT { String actualExplainPlan = QueryUtil.getExplainPlan(rs); //assert we are pulling from data table. -assertEquals(String.format("CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER %s", fullTableName), actualExplainPlan); +assertEquals(String.format("CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN FULL SCAN OVER %s", fullTableName), actualExplainPlan); rs = stmt1.executeQuery(selectSql); assertTrue(rs.next()); @@ -205,10 +205,10 @@ public class IndexToolIT extends BaseOwnClusterHBaseManagedTimeIT { String expectedExplainPlan = ""; if(isLocal) { final String localIndexName = MetaDataUtil.getLocalIndexTableName(SchemaUtil.getTableName(schemaName, dataTable)); -expectedExplainPlan = String.format("CLIENT 1-CHUNK PARALLEL 1-WAY RANGE SCAN OVER %s [-32768]" +expectedExplainPlan = String.format("CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER %s [-32768]" + "\nSERVER FILTER BY FIRST KEY ONLY", localIndexName); } else { -expectedExplainPlan = String.format("CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER %s" +expectedExplainPlan = String.format("CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN FULL SCAN OVER %s" + "\nSERVER FILTER BY FIRST KEY ONLY",SchemaUtil.getTableName(schemaName, indxTable)); } assertEquals(expectedExplainPlan,actualExplainPlan); http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e7acaa4/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java index 8125007..c335ff8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java @@ -91,7 +91,7 @@ public class MutableIndexToolIT extends BaseOwnClusterHBaseManagedTimeIT { String actualExplainPlan = QueryUtil.getExplainPlan(rs); //assert we are pulling from data table. -assertEquals(String.format("CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER %s",dataTable),actualExplainPlan); +assertEquals(String.format("CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN FULL SCAN OVER %s",dataTable),actualExplainPlan); rs = stmt1.executeQuery(selectSql); assertTrue(rs.next());
[05/30] phoenix git commit: PHOENIX-2732 Update HBase versions in pom
PHOENIX-2732 Update HBase versions in pom Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/db4e5cda Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/db4e5cda Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/db4e5cda Branch: refs/heads/calcite Commit: db4e5cda53988da05f6ec28666cf664bd5dd43f4 Parents: f97b4af Author: SamarthAuthored: Wed Mar 2 09:55:24 2016 -0800 Committer: Samarth Committed: Wed Mar 2 09:55:24 2016 -0800 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/db4e5cda/pom.xml -- diff --git a/pom.xml b/pom.xml index b27c3b9..d9e5ff9 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,7 @@ ${project.basedir} -1.1.2 +1.1.3 2.5.1
[23/30] phoenix git commit: PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu)
PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cd8e86ca Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cd8e86ca Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cd8e86ca Branch: refs/heads/calcite Commit: cd8e86ca7170876a30771fcc16c027f8dc8dd386 Parents: e7bcfe4 Author: Rajeshbabu ChintaguntlaAuthored: Fri Mar 18 01:28:53 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Fri Mar 18 01:28:53 2016 +0530 -- .../org/apache/phoenix/end2end/DeleteIT.java| 12 + .../apache/phoenix/compile/DeleteCompiler.java | 28 +++- .../apache/phoenix/optimize/QueryOptimizer.java | 14 ++ .../org/apache/phoenix/schema/PTableImpl.java | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd8e86ca/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java index 6b4eead..10152e3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java @@ -19,6 +19,7 @@ package org.apache.phoenix.end2end; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.Date; @@ -370,6 +371,7 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { "STATS.ACTIVE_VISITOR INTEGER " + "CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)) IMMUTABLE_ROWS=true"); stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (DATE, FEATURE)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (DATE, FEATURE, USAGE.DB)"); stm.close(); Date date = new Date(0); @@ -406,6 +408,16 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { assertTrue(rs.next()); assertEquals(0, rs.getLong(1)); +stm.execute("DROP INDEX web_stats_idx ON web_stats"); +stm.execute("DROP INDEX web_stats_idx2 ON web_stats"); + +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (USAGE.DB)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (USAGE.DB, DATE)"); +try{ +psInsert = con.prepareStatement("DELETE FROM web_stats WHERE USAGE.DB=2"); +} catch(Exception e) { +fail("There should not be any exception while deleting row"); +} } finally { try { con.close(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd8e86ca/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java index 8e9e1de..24a2add 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java @@ -22,6 +22,7 @@ import java.sql.ParameterMetaData; import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -233,18 +234,18 @@ public class DeleteCompiler { } -private Set getNonDisabledImmutableIndexes(TableRef tableRef) { +private Map getNonDisabledImmutableIndexes(TableRef tableRef) { PTable table = tableRef.getTable(); if (table.isImmutableRows() && !table.getIndexes().isEmpty()) { -Set nonDisabledIndexes = Sets.newHashSetWithExpectedSize(table.getIndexes().size()); +Map nonDisabledIndexes = new HashMap (table.getIndexes().size()); for (PTable index : table.getIndexes()) { if (index.getIndexState() != PIndexState.DISABLE) { -nonDisabledIndexes.add(index); +nonDisabledIndexes.put(index.getKey(), index); } } return nonDisabledIndexes;
[25/30] phoenix git commit: PHOENIX-2734 Literal expressions for UNSIGNED_DATE/UNSIGNED_TIME/etc (Sergey Soldatov)
PHOENIX-2734 Literal expressions for UNSIGNED_DATE/UNSIGNED_TIME/etc (Sergey Soldatov) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d4d973c7 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d4d973c7 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d4d973c7 Branch: refs/heads/calcite Commit: d4d973c7b9fd5bb6bd206c9082c4c6d53e54c59b Parents: bea110c Author: James TaylorAuthored: Mon Mar 28 08:22:37 2016 -0700 Committer: James Taylor Committed: Mon Mar 28 08:22:37 2016 -0700 -- .../org/apache/phoenix/end2end/DateTimeIT.java | 20 .../phoenix/expression/LiteralExpression.java | 12 2 files changed, 24 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d4d973c7/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java index e87d8d4..af8f0c1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java @@ -513,6 +513,26 @@ public class DateTimeIT extends BaseHBaseManagedTimeIT { } @Test +public void testUnsignedTimeDateWithLiteral() throws Exception { +String ddl = +"CREATE TABLE IF NOT EXISTS UT (k1 INTEGER NOT NULL," + +"unsignedDates UNSIGNED_DATE, unsignedTimestamps UNSIGNED_TIMESTAMP, unsignedTimes UNSIGNED_TIME CONSTRAINT pk PRIMARY KEY (k1))"; +conn.createStatement().execute(ddl); +String dml = "UPSERT INTO UT VALUES (1, " + +"'2010-06-20 12:00:00', '2012-07-28 12:00:00', '2015-12-25 12:00:00')"; +conn.createStatement().execute(dml); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("SELECT k1, unsignedDates, " + +"unsignedTimestamps, unsignedTimes FROM UT where k1 = 1"); +assertTrue(rs.next()); +assertEquals(DateUtil.parseDate("2010-06-20 12:00:00"), rs.getDate(2)); +assertEquals(DateUtil.parseTimestamp("2012-07-28 12:00:00"), rs.getTimestamp(3)); +assertEquals(DateUtil.parseTime("2015-12-25 12:00:00"), rs.getTime(4)); +assertFalse(rs.next()); +} + +@Test public void testSecondFuncAgainstColumns() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS T1 (k1 INTEGER NOT NULL, dates DATE, timestamps TIMESTAMP, times TIME, " + http://git-wip-us.apache.org/repos/asf/phoenix/blob/d4d973c7/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java index ad1c7c0..90882a2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java @@ -25,6 +25,7 @@ import java.sql.SQLException; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.io.WritableUtils; import org.apache.phoenix.expression.visitor.ExpressionVisitor; +import org.apache.phoenix.schema.IllegalDataException; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.TypeMismatchException; import org.apache.phoenix.schema.tuple.Tuple; @@ -182,16 +183,11 @@ public class LiteralExpression extends BaseTerminalExpression { return getBooleanLiteralExpression((Boolean)value, determinism); } PDataType actualType = PDataType.fromLiteral(value); -// For array we should check individual element in it? -// It would be costly though! -// UpsertStatement can try to cast varchar to date type but PVarchar can't CoercibleTo Date or Timestamp -// otherwise TO_NUMBER like functions will fail -if (!actualType.isCoercibleTo(type, value) && -(!actualType.equals(PVarchar.INSTANCE) || -!(type.equals(PDate.INSTANCE) || type.equals(PTimestamp.INSTANCE) || type.equals(PTime.INSTANCE { +try { +value = type.toObject(value, actualType); +} catch (IllegalDataException e) { throw TypeMismatchException.newException(type, actualType, value.toString()); } -value = type.toObject(value, actualType); byte[] b = type.isArrayType() ?
[16/30] phoenix git commit: PHOENIX-2748 Disable auto-commit during bulk load
PHOENIX-2748 Disable auto-commit during bulk load Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5d33fba6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5d33fba6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5d33fba6 Branch: refs/heads/calcite Commit: 5d33fba633bdc5b2cbc31fa1736f56dce1e17ac6 Parents: 5977e1f Author: Gabriel ReidAuthored: Fri Mar 11 15:13:58 2016 +0100 Committer: Gabriel Reid Committed: Fri Mar 11 20:46:04 2016 +0100 -- .../org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d33fba6/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java index 2c9b6d9..1211b83 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java @@ -126,6 +126,9 @@ public abstract class FormatToBytesWritableMapper extends Mapper
[04/30] phoenix git commit: PHOENIX-2730 Fix min hbase versions for scanner lease renewal
PHOENIX-2730 Fix min hbase versions for scanner lease renewal Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f97b4af8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f97b4af8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f97b4af8 Branch: refs/heads/calcite Commit: f97b4af8982d2e9c1dbe56a14eb3a9cc90b84a98 Parents: 58cf5fa Author: SamarthAuthored: Wed Mar 2 08:51:23 2016 -0800 Committer: Samarth Committed: Wed Mar 2 08:51:23 2016 -0800 -- .../main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f97b4af8/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java index 26d57fa..67814e8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java @@ -295,7 +295,7 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData { private final ResultSet emptyResultSet; public static final int MAX_LOCAL_SI_VERSION_DISALLOW = VersionUtil.encodeVersion("0", "98", "8"); public static final int MIN_LOCAL_SI_VERSION_DISALLOW = VersionUtil.encodeVersion("0", "98", "6"); -public static final int MIN_RENEW_LEASE_VERSION = VersionUtil.encodeVersion("1", "1", "4"); +public static final int MIN_RENEW_LEASE_VERSION = VersionUtil.encodeVersion("1", "1", "3"); // Version below which we should turn off essential column family. public static final int ESSENTIAL_FAMILY_VERSION_THRESHOLD = VersionUtil.encodeVersion("0", "94", "7");
[08/30] phoenix git commit: PHOENIX-2728 Remove usage of usage of com.google.common.io.Closeables.closeQuietly(Closeable)
PHOENIX-2728 Remove usage of usage of com.google.common.io.Closeables.closeQuietly(Closeable) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/42e2b85e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/42e2b85e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/42e2b85e Branch: refs/heads/calcite Commit: 42e2b85e391893ba033272bc42e9a0ebad1caca1 Parents: db4e5cd Author: James TaylorAuthored: Tue Mar 1 22:24:46 2016 -0800 Committer: James Taylor Committed: Wed Mar 2 10:40:30 2016 -0800 -- .../main/java/org/apache/phoenix/iterate/BaseResultIterators.java | 2 +- .../main/java/org/apache/phoenix/schema/stats/PTableStatsImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/42e2b85e/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index a48de13..9f3b3e6 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -82,6 +82,7 @@ import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.stats.GuidePostsInfo; import org.apache.phoenix.schema.stats.PTableStats; import org.apache.phoenix.util.ByteUtil; +import org.apache.phoenix.util.Closeables; import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.PrefixByteCodec; import org.apache.phoenix.util.PrefixByteDecoder; @@ -95,7 +96,6 @@ import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import com.google.common.io.Closeables; /** http://git-wip-us.apache.org/repos/asf/phoenix/blob/42e2b85e/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/PTableStatsImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/PTableStatsImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/PTableStatsImpl.java index 42e7bed..5eb02fd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/PTableStatsImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/PTableStatsImpl.java @@ -28,11 +28,11 @@ import java.util.TreeMap; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.MetaDataProtocol; +import org.apache.phoenix.util.Closeables; import org.apache.phoenix.util.PrefixByteCodec; import org.apache.phoenix.util.PrefixByteDecoder; import org.apache.phoenix.util.SizedUtil; -import com.google.common.io.Closeables; import com.sun.istack.NotNull; /**
phoenix git commit: 1. Retrieve PhoenixTable stats the same way as PhoenixTableScan stats; 2. Handle no stats cases; 3. Revert temp changes for PHOENIX-2712
Repository: phoenix Updated Branches: refs/heads/calcite 36ee23ab7 -> a78fdf5b6 1. Retrieve PhoenixTable stats the same way as PhoenixTableScan stats; 2. Handle no stats cases; 3. Revert temp changes for PHOENIX-2712 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a78fdf5b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a78fdf5b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a78fdf5b Branch: refs/heads/calcite Commit: a78fdf5b6db7b8cf1016811dc4872b5e70c4b748 Parents: 36ee23a Author: maryannxue <maryann@gmail.com> Authored: Fri Feb 26 09:14:05 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Fri Feb 26 09:14:05 2016 -0500 -- .../apache/phoenix/calcite/PhoenixTable.java| 51 .../phoenix/calcite/rel/PhoenixTableScan.java | 49 ++- .../coprocessor/MetaDataEndpointImpl.java | 18 --- .../apache/phoenix/schema/MetaDataClient.java | 3 -- 4 files changed, 55 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a78fdf5b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java index 101ee5d..47ac80a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java @@ -20,22 +20,27 @@ import org.apache.calcite.schema.TranslatableTable; import org.apache.calcite.schema.impl.AbstractTable; import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.util.ImmutableBitSet; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.util.Pair; import org.apache.phoenix.calcite.rel.PhoenixTableScan; +import org.apache.phoenix.compile.ColumnResolver; +import org.apache.phoenix.compile.FromCompiler; +import org.apache.phoenix.compile.SequenceManager; +import org.apache.phoenix.compile.StatementContext; +import org.apache.phoenix.iterate.BaseResultIterators; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; import org.apache.phoenix.schema.PColumn; -import org.apache.phoenix.schema.PColumnFamily; import org.apache.phoenix.schema.PTable; -import org.apache.phoenix.schema.RowKeySchema; import org.apache.phoenix.schema.SortOrder; -import org.apache.phoenix.schema.stats.GuidePostsInfo; +import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.stats.StatisticsUtil; import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.util.SchemaUtil; -import org.apache.phoenix.util.SizedUtil; - import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -89,12 +94,18 @@ public class PhoenixTable extends AbstractTable implements TranslatableTable { } this.pkBitSet = ImmutableBitSet.of(pkPositions); this.collation = RelCollationTraitDef.INSTANCE.canonize(RelCollations.of(fieldCollations)); - byte[] emptyCf = SchemaUtil.getEmptyColumnFamily(pTable); - GuidePostsInfo info = pTable.getTableStats().getGuidePosts().get(emptyCf); long rowCount = 0; long byteCount = 0; try { - if (info == null) { + PhoenixStatement stmt = new PhoenixStatement(pc); + TableRef tableRef = new TableRef(CalciteUtils.createTempAlias(), pTable, HConstants.LATEST_TIMESTAMP, false); + ColumnResolver resolver = FromCompiler.getResolver(tableRef); + StatementContext context = new StatementContext(stmt, resolver, new Scan(), new SequenceManager(stmt)); + Pair<Long, Long> estimatedCount = BaseResultIterators.getEstimatedCount(context, pTable); + if (estimatedCount != null) { + rowCount = estimatedCount.getFirst(); + byteCount = estimatedCount.getSecond(); + } else { // TODO The props might not be the same as server props. int guidepostPerRegion = pc.getQueryServices().getProps().getInt( QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, @@ -109,30 +120,8 @@ public class PhoenixTable extends AbstractTable implements TranslatableTable { } byteCount = StatisticsUtil.getGuidePostDepth( guidepostPerRegion, guid
[01/12] phoenix git commit: PHOENIX-2706 Implement client-side mechanism to know if stats are enabled
Repository: phoenix Updated Branches: refs/heads/calcite 9ac854ae5 -> 36ee23ab7 PHOENIX-2706 Implement client-side mechanism to know if stats are enabled Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a1e6ae44 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a1e6ae44 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a1e6ae44 Branch: refs/heads/calcite Commit: a1e6ae44be757b3fc5c4192ad55ecd8f3c03c01a Parents: e4acd0c Author: James TaylorAuthored: Mon Feb 22 18:49:04 2016 -0800 Committer: James Taylor Committed: Mon Feb 22 18:49:04 2016 -0800 -- .../StatisticsCollectionRunTrackerIT.java | 10 ++-- .../org/apache/phoenix/end2end/IndexToolIT.java | 3 +- .../phoenix/end2end/MutableIndexToolIT.java | 1 + .../end2end/StatsCollectionDisabledIT.java | 19 +-- .../phoenix/end2end/StatsCollectorIT.java | 3 ++ .../coprocessor/MetaDataEndpointImpl.java | 12 + .../UngroupedAggregateRegionObserver.java | 27 +- .../phoenix/iterate/BaseResultIterators.java| 25 - .../phoenix/query/ConnectionQueryServices.java | 7 ++- .../query/ConnectionQueryServicesImpl.java | 25 +++-- .../query/ConnectionlessQueryServicesImpl.java | 18 ++- .../query/DelegateConnectionQueryServices.java | 10 .../org/apache/phoenix/query/QueryServices.java | 1 + .../phoenix/query/QueryServicesOptions.java | 7 +++ .../apache/phoenix/schema/MetaDataClient.java | 2 + .../schema/stats/NoOpStatisticsCollector.java | 3 -- .../stats/StatisticsCollectionRunTracker.java | 7 ++- .../phoenix/schema/stats/StatisticsUtil.java| 16 ++ .../org/apache/phoenix/util/MetaDataUtil.java | 55 +--- .../phoenix/query/QueryServicesTestImpl.java| 2 + .../apache/phoenix/util/MetaDataUtilTest.java | 33 21 files changed, 215 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a1e6ae44/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java index bf567f0..345400e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java @@ -17,8 +17,7 @@ */ package org.apache.phoenix.coprocessor; -import static org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.COMPACTION_UPDATE_STATS_ROW_COUNT; -import static org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.CONCURRENT_UPDATE_STATS_ROW_COUNT; +import static org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.UPDATE_STATS_SKIPPED; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -38,7 +37,6 @@ import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker; import org.apache.phoenix.util.ReadOnlyProps; -import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -105,7 +103,8 @@ public class StatisticsCollectionRunTrackerIT extends BaseOwnClusterHBaseManaged HRegionInfo regionInfo = createTableAndGetRegion(tableName); // simulate stats collection via major compaction by marking the region as compacting in the tracker markRegionAsCompacting(regionInfo); -Assert.assertEquals("Row count didn't match", COMPACTION_UPDATE_STATS_ROW_COUNT, runUpdateStats(tableName)); +long returnValue = runUpdateStats(tableName); +assertTrue("Update stats should have been skipped", returnValue >= UPDATE_STATS_SKIPPED); StatisticsCollectionRunTracker tracker = StatisticsCollectionRunTracker.getInstance(new Configuration()); // assert that the tracker state was cleared. @@ -117,8 +116,7 @@ public class StatisticsCollectionRunTrackerIT extends BaseOwnClusterHBaseManaged String tableName = "testUpdateStatsPreventsAnotherUpdateStatsFromRunning".toUpperCase(); HRegionInfo regionInfo = createTableAndGetRegion(tableName); markRunningUpdateStats(regionInfo); -Assert.assertEquals("Row count didn't match", CONCURRENT_UPDATE_STATS_ROW_COUNT, -runUpdateStats(tableName)); +assertTrue("Update stats should have been skipped", runUpdateStats(tableName) >= UPDATE_STATS_SKIPPED);
[08/12] phoenix git commit: PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6
PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a6de19bd Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a6de19bd Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a6de19bd Branch: refs/heads/calcite Commit: a6de19bd2290d8242b002ff661ec7028577e3055 Parents: 1f7b47a Author: James TaylorAuthored: Wed Feb 24 17:25:51 2016 -0800 Committer: James Taylor Committed: Wed Feb 24 17:28:26 2016 -0800 -- .../query/ConnectionQueryServicesImpl.java | 65 .../stats/StatisticsCollectorFactory.java | 17 - 2 files changed, 68 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6de19bd/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index d27a4bc..37ebc78 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -2367,24 +2367,24 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0, columnsToAdd); } if(currentServerSideTableTimeStamp < MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0) { +// Drop old stats table so that new stats table is created +metaConnection = dropStatsTable(metaConnection, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 4); // Add these columns one at a time, each with different timestamps so that if folks have // run the upgrade code already for a snapshot, we'll still enter this block (and do the // parts we haven't yet done). -metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 4, +metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 3, PhoenixDatabaseMetaData.TRANSACTIONAL + " " + PBoolean.INSTANCE.getSqlTypeName()); -// Drop old stats table so that new stats table is created -metaConnection = dropStatsTable(metaConnection, - MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 3); -metaConnection = addColumnsIfNotExists(metaConnection, - PhoenixDatabaseMetaData.SYSTEM_CATALOG, +metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2, - PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " " -+ PLong.INSTANCE.getSqlTypeName()); -metaConnection = setImmutableTableIndexesImmutable(metaConnection, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1); -Properties props = PropertiesUtil.deepCopy(metaConnection.getClientInfo()); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0)); -metaConnection = new PhoenixConnection(metaConnection, ConnectionQueryServicesImpl.this, props); -// that already have cached data. + PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " " + PLong.INSTANCE.getSqlTypeName()); +metaConnection = setImmutableTableIndexesImmutable(metaConnection, +
[07/12] phoenix git commit: PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6
PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1f7b47a5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1f7b47a5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1f7b47a5 Branch: refs/heads/calcite Commit: 1f7b47a5e75fe5f6014b4dcdeb4637d05fd12a43 Parents: 05e6e2a Author: James TaylorAuthored: Wed Feb 24 11:48:16 2016 -0800 Committer: James Taylor Committed: Wed Feb 24 12:01:21 2016 -0800 -- .../phoenix/coprocessor/MetaDataProtocol.java | 2 +- .../query/ConnectionQueryServicesImpl.java | 35 2 files changed, 30 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1f7b47a5/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java index a704e22..fb9d228 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java @@ -73,7 +73,7 @@ public abstract class MetaDataProtocol extends MetaDataService { public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0 = MIN_TABLE_TIMESTAMP + 7; public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_5_0 = MIN_TABLE_TIMESTAMP + 8; public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0 = MIN_TABLE_TIMESTAMP + 9; -public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = MIN_TABLE_TIMESTAMP + 13; +public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = MIN_TABLE_TIMESTAMP + 14; // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the MIN_SYSTEM_TABLE_TIMESTAMP_* constants public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0; // TODO: pare this down to minimum, as we don't need duplicates for both table and column errors, nor should we need http://git-wip-us.apache.org/repos/asf/phoenix/blob/1f7b47a5/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index d55ab30..d27a4bc 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -2370,17 +2370,20 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // Add these columns one at a time, each with different timestamps so that if folks have // run the upgrade code already for a snapshot, we'll still enter this block (and do the // parts we haven't yet done). -metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2, +metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 4, PhoenixDatabaseMetaData.TRANSACTIONAL + " " + PBoolean.INSTANCE.getSqlTypeName()); // Drop old stats table so that new stats table is created metaConnection = dropStatsTable(metaConnection, - MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1); + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 3); metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, - MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2, PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " " + PLong.INSTANCE.getSqlTypeName()); -
[06/12] phoenix git commit: PHOENIX-2711 Need Thrift included in phoenix-server jar for M/R index (Thomas D'Silva)
PHOENIX-2711 Need Thrift included in phoenix-server jar for M/R index (Thomas D'Silva) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/05e6e2a3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/05e6e2a3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/05e6e2a3 Branch: refs/heads/calcite Commit: 05e6e2a3d67ed5c7c1cace0b2903c35b83ee5ec5 Parents: e3a6202 Author: James TaylorAuthored: Tue Feb 23 17:13:10 2016 -0800 Committer: James Taylor Committed: Tue Feb 23 17:16:58 2016 -0800 -- phoenix-assembly/src/build/server.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/05e6e2a3/phoenix-assembly/src/build/server.xml -- diff --git a/phoenix-assembly/src/build/server.xml b/phoenix-assembly/src/build/server.xml index ef79486..e8f9bfb 100644 --- a/phoenix-assembly/src/build/server.xml +++ b/phoenix-assembly/src/build/server.xml @@ -46,6 +46,7 @@ com.google.inject.extensions:guice-assistedinject it.unimi.dsi:fastutil io.dropwizard.metrics:metrics-core + org.apache.thrift:libthrift
[11/12] phoenix git commit: Merge remote-tracking branch 'origin/master' into calcite
Merge remote-tracking branch 'origin/master' into calcite Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/06fd5812 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/06fd5812 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/06fd5812 Branch: refs/heads/calcite Commit: 06fd581296bc58390ebf7f8e738af19a6634a66e Parents: 87e8f29 29ca38b Author: maryannxue <maryann@gmail.com> Authored: Thu Feb 25 15:23:38 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Thu Feb 25 15:23:38 2016 -0500 -- phoenix-assembly/src/build/server.xml | 1 + .../org/apache/phoenix/end2end/IndexToolIT.java | 3 +- .../phoenix/end2end/MutableIndexToolIT.java | 1 + .../end2end/StatsCollectionDisabledIT.java | 21 ++- .../phoenix/end2end/StatsCollectorIT.java | 57 +++- .../phoenix/coprocessor/MetaDataProtocol.java | 2 +- .../UngroupedAggregateRegionObserver.java | 4 +- .../apache/phoenix/execute/AggregatePlan.java | 6 +- .../apache/phoenix/execute/BaseQueryPlan.java | 11 ++ .../org/apache/phoenix/execute/ScanPlan.java| 7 +- .../phoenix/iterate/BaseResultIterators.java| 140 +++ .../query/ConnectionQueryServicesImpl.java | 86 ++-- .../apache/phoenix/query/QueryConstants.java| 2 +- .../org/apache/phoenix/query/QueryServices.java | 1 + .../phoenix/query/QueryServicesOptions.java | 7 + .../stats/DefaultStatisticsCollector.java | 33 ++--- .../phoenix/schema/stats/GuidePostsInfo.java| 2 +- .../schema/stats/GuidePostsInfoBuilder.java | 6 - .../phoenix/schema/stats/PTableStatsImpl.java | 5 +- .../stats/StatisticsCollectorFactory.java | 17 ++- .../phoenix/schema/stats/StatisticsUtil.java| 23 +-- .../phoenix/schema/stats/StatisticsWriter.java | 60 .../apache/phoenix/util/PrefixByteCodec.java| 37 ++--- .../phoenix/query/QueryServicesTestImpl.java| 2 + 24 files changed, 360 insertions(+), 174 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsUtil.java -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java --
[10/12] phoenix git commit: Revert changes for PHOENIX-2714
Revert changes for PHOENIX-2714 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/87e8f29b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/87e8f29b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/87e8f29b Branch: refs/heads/calcite Commit: 87e8f29bb2f93b875c73dce499cf5b95044072c4 Parents: 9ac854a Author: maryannxue <maryann@gmail.com> Authored: Thu Feb 25 15:23:03 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Thu Feb 25 15:23:03 2016 -0500 -- .../java/org/apache/phoenix/execute/ScanPlan.java| 5 - .../apache/phoenix/iterate/BaseResultIterators.java | 10 ++ .../org/apache/phoenix/iterate/ResultIterators.java | 1 - .../apache/phoenix/iterate/UnionResultIterators.java | 5 - .../phoenix/iterate/AggregateResultScannerTest.java | 5 - .../phoenix/iterate/ConcatResultIteratorTest.java| 10 -- .../phoenix/iterate/MergeSortResultIteratorTest.java | 15 --- 7 files changed, 2 insertions(+), 49 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e8f29b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java index f622e8e..673a641 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java @@ -34,7 +34,6 @@ import org.apache.phoenix.coprocessor.ScanRegionObserver; import org.apache.phoenix.expression.Expression; import org.apache.phoenix.iterate.ChunkedResultIterator; import org.apache.phoenix.iterate.ConcatResultIterator; -import org.apache.phoenix.iterate.DefaultParallelScanGrouper; import org.apache.phoenix.iterate.LimitingResultIterator; import org.apache.phoenix.iterate.MergeSortRowKeyResultIterator; import org.apache.phoenix.iterate.MergeSortTopNResultIterator; @@ -258,8 +257,4 @@ public class ScanPlan extends BaseQueryPlan { } } -public long getEstimatedBytes() throws SQLException { -return new ParallelIterators(this, null, parallelIteratorFactory, DefaultParallelScanGrouper.getInstance()).getEstimatedSize(); -} - } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e8f29b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index c3da407..fc3edbe 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -560,10 +560,8 @@ public abstract class BaseResultIterators extends ExplainTable implements Result while (guideIndex < gpsSize && (currentGuidePost.compareTo(endKey) <= 0 || endKey.length == 0)) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, false); -if (newScan != null) { -estimatedRows += gps.getRowCounts().get(guideIndex); -estimatedSize += gps.getByteCounts().get(guideIndex); -} +estimatedRows += gps.getRowCounts().get(guideIndex); +estimatedSize += gps.getByteCounts().get(guideIndex); scans = addNewScan(parallelScans, scans, newScan, currentGuidePostBytes, false, regionLocation); currentKeyBytes = currentGuidePost.copyBytes(); currentGuidePost = PrefixByteCodec.decode(decoder, input); @@ -874,8 +872,4 @@ public abstract class BaseResultIterators extends ExplainTable implements Result return "ResultIterators [name=" + getName() + ",id=" + scanId + ",scans=" + scans + "]"; } -@Override -public long getEstimatedSize() { -return estimatedSize; -} } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e8f29b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java index e76db56..16f8b41
[05/12] phoenix git commit: PHOENIX-2707 Differentiate between a table+family have zero guideposts from not having collected guideposts
PHOENIX-2707 Differentiate between a table+family have zero guideposts from not having collected guideposts Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e3a62026 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e3a62026 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e3a62026 Branch: refs/heads/calcite Commit: e3a62026cbfaf1eb7c50a35a8871e0f059d7d668 Parents: c25f887 Author: James TaylorAuthored: Tue Feb 23 16:52:05 2016 -0800 Committer: James Taylor Committed: Tue Feb 23 16:52:05 2016 -0800 -- .../java/org/apache/phoenix/execute/AggregatePlan.java | 6 -- .../java/org/apache/phoenix/execute/BaseQueryPlan.java | 11 +++ .../main/java/org/apache/phoenix/execute/ScanPlan.java | 7 +-- 3 files changed, 20 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e3a62026/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 73a995c..a8a7dc5 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 @@ -35,6 +35,7 @@ import org.apache.phoenix.expression.OrderByExpression; import org.apache.phoenix.expression.RowKeyExpression; import org.apache.phoenix.expression.aggregator.Aggregators; import org.apache.phoenix.iterate.AggregatingResultIterator; +import org.apache.phoenix.iterate.BaseResultIterators; import org.apache.phoenix.iterate.ConcatResultIterator; import org.apache.phoenix.iterate.DistinctAggregatingResultIterator; import org.apache.phoenix.iterate.FilterAggregatingResultIterator; @@ -48,7 +49,6 @@ import org.apache.phoenix.iterate.ParallelIterators; import org.apache.phoenix.iterate.ParallelScanGrouper; import org.apache.phoenix.iterate.PeekingResultIterator; import org.apache.phoenix.iterate.ResultIterator; -import org.apache.phoenix.iterate.ResultIterators; import org.apache.phoenix.iterate.SequenceResultIterator; import org.apache.phoenix.iterate.SerialIterators; import org.apache.phoenix.iterate.SpoolingResultIterator; @@ -197,12 +197,14 @@ public class AggregatePlan extends BaseQueryPlan { context.getScan().setAttribute(BaseScannerRegionObserver.GROUP_BY_LIMIT, PInteger.INSTANCE.toBytes(limit)); } } -ResultIterators iterators = statement.getHint().hasHint(HintNode.Hint.SERIAL) ? +BaseResultIterators iterators = statement.getHint().hasHint(HintNode.Hint.SERIAL) ? new SerialIterators(this, null, wrapParallelIteratorFactory(), scanGrouper) : new ParallelIterators(this, null, wrapParallelIteratorFactory()); splits = iterators.getSplits(); scans = iterators.getScans(); +estimatedSize = iterators.getEstimatedByteCount(); +estimatedRows = iterators.getEstimatedRowCount(); AggregatingResultIterator aggResultIterator; // No need to merge sort for ungrouped aggregation http://git-wip-us.apache.org/repos/asf/phoenix/blob/e3a62026/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java index 2aef7f7..0ee70ba 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java @@ -108,6 +108,9 @@ public abstract class BaseQueryPlan implements QueryPlan { * immediately before creating the ResultIterator. */ protected final Expression dynamicFilter; +protected Long estimatedRows; +protected Long estimatedSize; + protected BaseQueryPlan( StatementContext context, FilterableStatement statement, TableRef table, @@ -127,6 +130,14 @@ public abstract class BaseQueryPlan implements QueryPlan { this.dynamicFilter = dynamicFilter; } +public Long getEstimatedRowCount() { +return this.estimatedRows; +} + +public Long getEstimatedByteCount() { +return this.estimatedSize; +} + @Override public Operation getOperation() { http://git-wip-us.apache.org/repos/asf/phoenix/blob/e3a62026/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
[04/12] phoenix git commit: PHOENIX-2707 Differentiate between a table+family have zero guideposts from not having collected guideposts
PHOENIX-2707 Differentiate between a table+family have zero guideposts from not having collected guideposts Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c25f8879 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c25f8879 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c25f8879 Branch: refs/heads/calcite Commit: c25f88791c86cd65ea21810406eec199403d78aa Parents: dbc9ee9 Author: James TaylorAuthored: Tue Feb 23 14:53:11 2016 -0800 Committer: James Taylor Committed: Tue Feb 23 14:53:11 2016 -0800 -- .../org/apache/phoenix/end2end/IndexToolIT.java | 3 +- .../phoenix/end2end/MutableIndexToolIT.java | 1 + .../end2end/StatsCollectionDisabledIT.java | 21 ++- .../phoenix/end2end/StatsCollectorIT.java | 57 +++- .../phoenix/iterate/BaseResultIterators.java| 140 +++ .../apache/phoenix/query/QueryConstants.java| 2 +- .../org/apache/phoenix/query/QueryServices.java | 1 + .../phoenix/query/QueryServicesOptions.java | 7 + .../stats/DefaultStatisticsCollector.java | 33 ++--- .../phoenix/schema/stats/GuidePostsInfo.java| 2 +- .../schema/stats/GuidePostsInfoBuilder.java | 6 - .../phoenix/schema/stats/PTableStatsImpl.java | 5 +- .../phoenix/schema/stats/StatisticsUtil.java| 23 +-- .../phoenix/schema/stats/StatisticsWriter.java | 60 .../apache/phoenix/util/PrefixByteCodec.java| 37 ++--- .../phoenix/query/QueryServicesTestImpl.java| 2 + 16 files changed, 246 insertions(+), 154 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c25f8879/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java index aba9c11..fe95470 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java @@ -108,7 +108,8 @@ public class IndexToolIT extends BaseOwnClusterHBaseManagedTimeIT { final String fullTableName = SchemaUtil.getTableName(schemaName, dataTable); final String indxTable = String.format("%s_%s", dataTable, "INDX"); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); -props.setProperty(QueryServices.TRANSACTIONS_ENABLED, "true"); +props.setProperty(QueryServices.TRANSACTIONS_ENABLED, Boolean.TRUE.toString()); +props.setProperty(QueryServices.EXPLAIN_ROW_COUNT_ATTRIB, Boolean.FALSE.toString()); Connection conn = DriverManager.getConnection(getUrl(), props); Statement stmt = conn.createStatement(); try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/c25f8879/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java index 0791479..8125007 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java @@ -61,6 +61,7 @@ public class MutableIndexToolIT extends BaseOwnClusterHBaseManagedTimeIT { final String dataTable = "DATA_TABLE5"; final String indxTable = String.format("%s_%s",dataTable,"INDX"); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +props.setProperty(QueryServices.EXPLAIN_ROW_COUNT_ATTRIB, Boolean.FALSE.toString()); Connection conn = DriverManager.getConnection(getUrl(), props); Statement stmt = conn.createStatement(); try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/c25f8879/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java index a92a665..54ffa7c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java @@ -17,24 +17,26 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import
[12/12] phoenix git commit: Temporary fix for PHOENIX-2714
Temporary fix for PHOENIX-2714 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/36ee23ab Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/36ee23ab Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/36ee23ab Branch: refs/heads/calcite Commit: 36ee23ab7760616394f32f88b2da6b038cfee1e9 Parents: 06fd581 Author: maryannxue <maryann@gmail.com> Authored: Thu Feb 25 15:38:55 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Thu Feb 25 15:38:55 2016 -0500 -- .../phoenix/calcite/rel/PhoenixTableScan.java | 4 +- .../apache/phoenix/execute/AggregatePlan.java | 2 - .../apache/phoenix/execute/BaseQueryPlan.java | 11 -- .../org/apache/phoenix/execute/ScanPlan.java| 2 - .../phoenix/iterate/BaseResultIterators.java| 154 --- 5 files changed, 137 insertions(+), 36 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/36ee23ab/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java index 80c328f..dfdb507 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java @@ -36,6 +36,7 @@ import org.apache.phoenix.execute.ScanPlan; import org.apache.phoenix.execute.TupleProjector; import org.apache.phoenix.expression.Expression; import org.apache.phoenix.expression.LiteralExpression; +import org.apache.phoenix.iterate.BaseResultIterators; import org.apache.phoenix.iterate.ParallelIteratorFactory; import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.parse.SelectStatement; @@ -131,8 +132,7 @@ public class PhoenixTableScan extends TableScan implements PhoenixRel { filterExpr = WhereOptimizer.pushKeyExpressionsToScan(context, select, filterExpr); WhereCompiler.setScanFilter(context, select, filterExpr, true, false); scanRanges = context.getScanRanges(); -ScanPlan plan = new ScanPlan(context, select, tableRef, RowProjector.EMPTY_PROJECTOR, null, OrderBy.EMPTY_ORDER_BY, null, true, null); -estimatedSize = plan.getEstimatedBytes(); +estimatedSize = BaseResultIterators.getEstimatedCount(context, tableRef.getTable()).getSecond(); } catch (SQLException e) { throw new RuntimeException(e); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/36ee23ab/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 f9eca0c..794247b 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 @@ -208,8 +208,6 @@ public class AggregatePlan extends BaseQueryPlan { splits = iterators.getSplits(); scans = iterators.getScans(); -estimatedSize = iterators.getEstimatedByteCount(); -estimatedRows = iterators.getEstimatedRowCount(); AggregatingResultIterator aggResultIterator; // No need to merge sort for ungrouped aggregation http://git-wip-us.apache.org/repos/asf/phoenix/blob/36ee23ab/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java index 0ee70ba..f389fd0 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java @@ -108,8 +108,6 @@ public abstract class BaseQueryPlan implements QueryPlan { * immediately before creating the ResultIterator. */ protected final Expression dynamicFilter; -protected Long estimatedRows; -protected Long estimatedSize; protected BaseQueryPlan( @@ -129,16 +127,7 @@ public abstract class BaseQueryPlan implements QueryPlan { this.parallelIteratorFactory = parallelIteratorFactory; this.dynamicFilter = dynamicFilter; } - -public Long getEstimatedRowCount() { -return this.estimatedRows; -} -public Long getEstima
[09/12] phoenix git commit: PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6
PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/29ca38b8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/29ca38b8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/29ca38b8 Branch: refs/heads/calcite Commit: 29ca38b85a5f2455a007404aaa72c104f20a5afe Parents: a6de19b Author: James TaylorAuthored: Wed Feb 24 17:44:08 2016 -0800 Committer: James Taylor Committed: Wed Feb 24 17:44:08 2016 -0800 -- .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ca38b8/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 37ebc78..3327861 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -2384,7 +2384,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement metaConnection = updateSystemCatalogTimestamp(metaConnection, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0); ConnectionQueryServicesImpl.this.removeTable(null, PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME, null, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0); -logger.warn("Update of SYSTEM.CATALOG complete"); +logger.info("Update of SYSTEM.CATALOG complete"); clearCache(); }
[46/50] [abbrv] phoenix git commit: PHONIX-2666 addendum; correct HBase version.
PHONIX-2666 addendum; correct HBase version. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d9d66ae8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d9d66ae8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d9d66ae8 Branch: refs/heads/calcite Commit: d9d66ae807e6e69e43b36a0106d4f17bab1b0217 Parents: 0b1a180 Author: Lars HofhanslAuthored: Sun Feb 21 16:20:09 2016 -0800 Committer: Lars Hofhansl Committed: Sun Feb 21 16:20:09 2016 -0800 -- .../main/java/org/apache/phoenix/iterate/BaseResultIterators.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d9d66ae8/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index fa09704..01b790a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -108,7 +108,7 @@ import com.google.common.collect.Lists; public abstract class BaseResultIterators extends ExplainTable implements ResultIterators { private static final Logger logger = LoggerFactory.getLogger(BaseResultIterators.class); private static final int ESTIMATED_GUIDEPOSTS_PER_REGION = 20; -private static final int MIN_SEEK_TO_COLUMN_VERSION = VersionUtil.encodeVersion("0", "94", "12"); +private static final int MIN_SEEK_TO_COLUMN_VERSION = VersionUtil.encodeVersion("0", "98", "12"); private final List scans; private final List splits;
[08/50] [abbrv] phoenix git commit: PHOENIX-2653 Use data.tx.zookeeper.quorum property to initialize TransactionServiceClient falling back to HBase ZK quorum setting
PHOENIX-2653 Use data.tx.zookeeper.quorum property to initialize TransactionServiceClient falling back to HBase ZK quorum setting Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/39a982db Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/39a982db Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/39a982db Branch: refs/heads/calcite Commit: 39a982db98f52b33decb30ec51ca4b92a230abd2 Parents: b0122a5 Author: Thomas D'SilvaAuthored: Mon Feb 8 12:11:05 2016 -0800 Committer: Thomas D'Silva Committed: Mon Feb 8 12:27:58 2016 -0800 -- .../phoenix/query/ConnectionQueryServicesImpl.java | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/39a982db/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 8eba40b..f2a4512 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -187,6 +187,12 @@ import org.apache.twill.zookeeper.ZKClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import co.cask.tephra.TransactionSystemClient; +import co.cask.tephra.TxConstants; +import co.cask.tephra.distributed.PooledClientProvider; +import co.cask.tephra.distributed.TransactionServiceClient; +import co.cask.tephra.hbase98.coprocessor.TransactionProcessor; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Throwables; @@ -346,7 +352,10 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } private void initTxServiceClient() { -String zkQuorumServersString = connectionInfo.getZookeeperQuorum()+":"+connectionInfo.getPort(); +String zkQuorumServersString = this.getProps().get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM); +if (zkQuorumServersString==null) { +zkQuorumServersString = connectionInfo.getZookeeperQuorum()+":"+connectionInfo.getPort(); +} ZKClientService zkClientService = ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure(
[26/50] [abbrv] phoenix git commit: PHOENIX-2635 Partial index rebuild doesn't work for mutable data
PHOENIX-2635 Partial index rebuild doesn't work for mutable data Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/046bda34 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/046bda34 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/046bda34 Branch: refs/heads/calcite Commit: 046bda34771aaec3befd4ad17024afc5af9b83ed Parents: e2a6386 Author: James TaylorAuthored: Mon Feb 15 00:33:05 2016 -0800 Committer: James Taylor Committed: Mon Feb 15 10:14:54 2016 -0800 -- .../end2end/index/MutableIndexFailureIT.java| 379 +++ .../end2end/index/ReadOnlyIndexFailureIT.java | 75 ++-- .../EndToEndCoveredColumnsIndexBuilderIT.java | 2 +- .../coprocessor/BaseScannerRegionObserver.java | 5 +- .../coprocessor/MetaDataRegionObserver.java | 120 +- .../hbase/index/covered/LocalTableState.java| 19 +- .../phoenix/hbase/index/covered/TableState.java | 7 +- .../index/covered/data/LocalHBaseState.java | 6 +- .../hbase/index/covered/data/LocalTable.java| 9 +- .../example/CoveredColumnIndexCodec.java| 4 +- .../hbase/index/scanner/ScannerBuilder.java | 1 - .../apache/phoenix/index/IndexMaintainer.java | 4 +- .../apache/phoenix/index/PhoenixIndexCodec.java | 12 +- .../phoenix/index/PhoenixIndexMetaData.java | 10 +- .../index/PhoenixTransactionalIndexer.java | 2 +- .../org/apache/phoenix/jdbc/PhoenixDriver.java | 32 +- .../apache/phoenix/parse/NamedTableNode.java| 8 + .../phoenix/query/QueryServicesOptions.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 34 +- .../org/apache/phoenix/util/PhoenixRuntime.java | 8 +- .../index/covered/TestLocalTableState.java | 10 +- .../example/TestCoveredColumnIndexCodec.java| 4 +- 22 files changed, 368 insertions(+), 385 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/046bda34/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java index 176c5a0..ebc6988 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java @@ -30,24 +30,17 @@ import java.sql.SQLException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.hbase.HBaseCluster; -import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.hbase.ServerName; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.TableNotFoundException; -import org.apache.hadoop.hbase.Waiter; -import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.DoNotRetryIOException; +import org.apache.hadoop.hbase.HBaseIOException; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.client.Mutation; +import org.apache.hadoop.hbase.coprocessor.ObserverContext; +import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; +import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver; +import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress; import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest; import org.apache.phoenix.query.QueryServices; @@ -61,7 +54,6 @@ import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.StringUtil; import org.apache.phoenix.util.TestUtil; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -75,28 +67,29 @@ import com.google.common.collect.Maps; * For some reason dropping tables after running this test * fails unless it runs its own mini cluster. * - * - * @since 2.1 */ @Category(NeedsOwnMiniClusterTest.class) @RunWith(Parameterized.class) public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { -private Timer scheduleTimer; - +public static volatile boolean FAIL_WRITE = false; +public static final String INDEX_NAME
[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 YatesAuthored: 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){
[32/50] [abbrv] phoenix git commit: PHOENIX-2666 Performance regression: Aggregate query with filter on table with multiple column families
PHOENIX-2666 Performance regression: Aggregate query with filter on table with multiple column families Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/65445738 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/65445738 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/65445738 Branch: refs/heads/calcite Commit: 6544573832324789f8cbd4531aa6614145c9eb7d Parents: 4ccce0e Author: James TaylorAuthored: Tue Feb 16 17:15:57 2016 -0800 Committer: James Taylor Committed: Tue Feb 16 17:15:57 2016 -0800 -- .../phoenix/iterate/BaseResultIterators.java| 34 ++-- 1 file changed, 17 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/65445738/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index 2352e94..d8256d7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -18,10 +18,10 @@ package org.apache.phoenix.iterate; import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.EXPECTED_UPPER_REGION_KEY; +import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW; import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_FAILED_QUERY_COUNTER; import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_QUERY_TIMEOUT_COUNTER; import static org.apache.phoenix.util.ByteUtil.EMPTY_BYTE_ARRAY; -import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW; import java.io.ByteArrayInputStream; import java.io.DataInput; @@ -179,8 +179,15 @@ public abstract class BaseResultIterators extends ExplainTable implements Result // Project the one column family. We must project a column family since it's possible // that there are other non declared column families that we need to ignore. scan.addFamily(table.getColumnFamilies().get(0).getName().getBytes()); -} else { -if (projector.projectEveryRow()) { +} else if (projector.projectEveryRow()) { +if (table.getViewType() == ViewType.MAPPED) { +// Since we don't have the empty key value in MAPPED tables, +// we must select all CFs in HRS. However, only the +// selected column values are returned back to client. +for (PColumnFamily family : table.getColumnFamilies()) { +scan.addFamily(family.getName().getBytes()); +} +} else { byte[] ecf = SchemaUtil.getEmptyColumnFamily(table); // Project empty key value unless the column family containing it has // been projected in its entirety. @@ -188,32 +195,25 @@ public abstract class BaseResultIterators extends ExplainTable implements Result scan.addColumn(ecf, QueryConstants.EMPTY_COLUMN_BYTES); } } -} -if (table.getViewType() == ViewType.MAPPED) { -if (projector.projectEveryRow()) { -// Since we don't have the empty key value in MAPPED tables, -// we must select all CFs in HRS. However, only the -// selected column values are returned back to client. -for (PColumnFamily family : table.getColumnFamilies()) { -scan.addFamily(family.getName().getBytes()); -} +} else { +for (Pair whereColumn : context.getWhereConditionColumns()) { +scan.addColumn(whereColumn.getFirst(), whereColumn.getSecond()); } -} +} } // Add FirstKeyOnlyFilter if there are no references to key value columns if (keyOnlyFilter) { ScanUtil.andFilterAtBeginning(scan, new FirstKeyOnlyFilter()); } - -// TODO adding all CFs here is not correct. It should be done only after ColumnProjectionOptimization. + if (perScanLimit != null) {
[37/50] [abbrv] phoenix git commit: PHOENIX-2688 Remove unused mergeRegions for statistics collection
PHOENIX-2688 Remove unused mergeRegions for statistics collection Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5127a656 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5127a656 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5127a656 Branch: refs/heads/calcite Commit: 5127a6565ea286222ea0ebf9f61fd5737d5b8009 Parents: c316d91 Author: James TaylorAuthored: Wed Feb 17 12:27:11 2016 -0800 Committer: James Taylor Committed: Wed Feb 17 12:27:11 2016 -0800 -- .../coprocessor/UngroupedAggregateRegionObserver.java | 9 + .../apache/phoenix/schema/stats/StatisticsCollector.java | 10 -- .../apache/phoenix/schema/stats/StatisticsScanner.java| 5 + 3 files changed, 6 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5127a656/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java index e000e25..d850eab 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java @@ -44,9 +44,7 @@ import org.apache.hadoop.hbase.CoprocessorEnvironment; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.KeyValue; -import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.client.Mutation; @@ -609,16 +607,11 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver InternalScanner internalScanner = scanner; if (scanType.equals(ScanType.COMPACT_DROP_DELETES)) { try { -Connection conn = c.getEnvironment().getRegionServerServices().getConnection(); Pair mergeRegions = null; -if (store.hasReferences()) { -mergeRegions = MetaTableAccessor.getRegionsFromMergeQualifier(conn, - c.getEnvironment().getRegion().getRegionInfo().getRegionName()); -} long clientTimeStamp = TimeKeeper.SYSTEM.getCurrentTime(); StatisticsCollector stats = new StatisticsCollector(c.getEnvironment(), table.getNameAsString(), clientTimeStamp, store.getFamily().getName()); -internalScanner = stats.createCompactionScanner(c.getEnvironment(), store, scanner, mergeRegions); +internalScanner = stats.createCompactionScanner(c.getEnvironment(), store, scanner); } catch (IOException e) { // If we can't reach the stats table, don't interrupt the normal // compaction operation, just log a warning. http://git-wip-us.apache.org/repos/asf/phoenix/blob/5127a656/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java index 1d0204f..185ceb8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.client.Mutation; @@ -197,19 +196,18 @@ public class StatisticsCollector { } } -public InternalScanner createCompactionScanner(RegionCoprocessorEnvironment env, Store store, InternalScanner s, -Pair mergeRegions) throws IOException { +public InternalScanner createCompactionScanner(RegionCoprocessorEnvironment env, Store store, InternalScanner s) throws IOException { // See if this is for Major compaction if (logger.isDebugEnabled()) { logger.debug("Compaction scanner created
[49/50] [abbrv] phoenix git commit: Revert "PHOENIX-2678 Replace calcite default RelOptCostFactory"
Revert "PHOENIX-2678 Replace calcite default RelOptCostFactory" This reverts commit 69a2f2437bf0d6513d3f6c46ec34094279f0f411. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bc4b8917 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bc4b8917 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bc4b8917 Branch: refs/heads/calcite Commit: bc4b89172180e963267b1588c3f31a3d94491777 Parents: 58ec257 Author: maryannxue <maryann@gmail.com> Authored: Tue Feb 23 10:28:45 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Tue Feb 23 10:28:45 2016 -0500 -- .../org/apache/phoenix/calcite/CalciteIT.java | 8 +- .../apache/phoenix/calcite/CalciteIndexIT.java | 2 +- .../calcite/jdbc/PhoenixPrepareImpl.java| 2 - .../phoenix/calcite/plan/PhoenixCost.java | 227 --- .../calcite/rel/PhoenixAbstractAggregate.java | 2 +- .../calcite/rel/PhoenixAbstractSort.java| 2 +- .../calcite/rel/PhoenixClientAggregate.java | 3 +- .../phoenix/calcite/rel/PhoenixClientJoin.java | 4 +- .../calcite/rel/PhoenixClientProject.java | 3 +- .../calcite/rel/PhoenixClientSemiJoin.java | 4 +- .../phoenix/calcite/rel/PhoenixClientSort.java | 3 +- .../calcite/rel/PhoenixCompactClientSort.java | 3 +- .../phoenix/calcite/rel/PhoenixCorrelate.java | 21 +- .../phoenix/calcite/rel/PhoenixFilter.java | 4 +- .../phoenix/calcite/rel/PhoenixLimit.java | 4 +- .../calcite/rel/PhoenixMergeSortUnion.java | 4 +- .../apache/phoenix/calcite/rel/PhoenixRel.java | 7 + .../calcite/rel/PhoenixServerAggregate.java | 3 +- .../phoenix/calcite/rel/PhoenixServerJoin.java | 4 +- .../calcite/rel/PhoenixServerProject.java | 3 +- .../calcite/rel/PhoenixServerSemiJoin.java | 4 +- .../phoenix/calcite/rel/PhoenixServerSort.java | 3 +- .../phoenix/calcite/rel/PhoenixTableScan.java | 6 +- .../phoenix/calcite/rel/PhoenixUncollect.java | 15 +- .../phoenix/calcite/rel/PhoenixUnion.java | 4 +- .../phoenix/calcite/rel/PhoenixValues.java | 5 +- .../calcite/rules/PhoenixConverterRules.java| 3 +- 27 files changed, 60 insertions(+), 293 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bc4b8917/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java index 820c2d4..df6ac81 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java @@ -293,17 +293,17 @@ public class CalciteIT extends BaseCalciteIT { start(false, 1000f).sql("select t1.entity_id, t2.a_string, t3.organization_id from aTable t1 join aTable t2 on t1.entity_id = t2.entity_id and t1.organization_id = t2.organization_id join atable t3 on t1.entity_id = t3.entity_id and t1.organization_id = t3.organization_id") .explainIs("PhoenixToEnumerableConverter\n" + - " PhoenixClientProject(ENTITY_ID=[$1], A_STRING=[$4], ORGANIZATION_ID=[$5])\n" + - "PhoenixClientJoin(condition=[AND(=($1, $6), =($0, $5))], joinType=[inner])\n" + + " PhoenixClientProject(ENTITY_ID=[$1], A_STRING=[$6], ORGANIZATION_ID=[$2])\n" + + "PhoenixClientJoin(condition=[AND(=($1, $5), =($0, $4))], joinType=[inner])\n" + " PhoenixClientJoin(condition=[AND(=($1, $3), =($0, $2))], joinType=[inner])\n" + "PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n" + " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1])\n" + "PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + "PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n" + - " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1], A_STRING=[$2])\n" + + " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1])\n" + "PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + " PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n" + -
[23/50] [abbrv] phoenix git commit: PHOENIX-2671 System.STATS table getting truncated every time on new client connection(Ankit Singhal)
PHOENIX-2671 System.STATS table getting truncated every time on new client connection(Ankit Singhal) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6881aef0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6881aef0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6881aef0 Branch: refs/heads/calcite Commit: 6881aef0cfaae8643303f0612a2a4b997b8a5138 Parents: cdaca28 Author: Ankit SinghalAuthored: Mon Feb 15 12:04:20 2016 +0530 Committer: Ankit Singhal Committed: Mon Feb 15 12:04:20 2016 +0530 -- .../query/ConnectionQueryServicesImpl.java | 48 ++-- .../org/apache/phoenix/util/UpgradeUtil.java| 16 +++ 2 files changed, 22 insertions(+), 42 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6881aef0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 897c207..9a385b2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -188,11 +188,6 @@ import org.apache.twill.zookeeper.ZKClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import co.cask.tephra.TransactionSystemClient; -import co.cask.tephra.TxConstants; -import co.cask.tephra.distributed.PooledClientProvider; -import co.cask.tephra.distributed.TransactionServiceClient; - import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Throwables; @@ -205,6 +200,11 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import co.cask.tephra.TransactionSystemClient; +import co.cask.tephra.TxConstants; +import co.cask.tephra.distributed.PooledClientProvider; +import co.cask.tephra.distributed.TransactionServiceClient; + public class ConnectionQueryServicesImpl extends DelegateQueryServices implements ConnectionQueryServices { private static final Logger logger = LoggerFactory.getLogger(ConnectionQueryServicesImpl.class); @@ -2370,14 +2370,16 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // parts we haven't yet done). metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2, PhoenixDatabaseMetaData.TRANSACTIONAL + " " + PBoolean.INSTANCE.getSqlTypeName()); -metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1, - PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " " + PLong.INSTANCE.getSqlTypeName()); +// Drop old stats table so that new stats table is created +metaConnection = dropStatsTable(metaConnection, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1); +metaConnection = addColumnsIfNotExists(metaConnection, + PhoenixDatabaseMetaData.SYSTEM_CATALOG, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, + PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " " ++ PLong.INSTANCE.getSqlTypeName()); setImmutableTableIndexesImmutable(metaConnection); - // Drop old stats table so that new stats table is created - metaConnection = dropStatsTable(metaConnection, - MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0); - // Clear the server cache so the above changes make it over to any clients - // that already have cached data. +
[12/50] [abbrv] phoenix git commit: PHOENIX-2602 Parser does not handle escaped LPAREN
PHOENIX-2602 Parser does not handle escaped LPAREN Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c485a40c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c485a40c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c485a40c Branch: refs/heads/calcite Commit: c485a40c766e34e3a5a443e60057cfaa1cb92869 Parents: d5518f0 Author: Thomas D'SilvaAuthored: Mon Feb 8 16:47:36 2016 -0800 Committer: Thomas D'Silva Committed: Tue Feb 9 15:08:37 2016 -0800 -- .../phoenix/end2end/LikeExpressionIT.java | 20 phoenix-core/src/main/antlr3/PhoenixSQL.g | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c485a40c/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java index 1d93341..ecd1e8c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java @@ -123,4 +123,24 @@ public class LikeExpressionIT extends BaseHBaseManagedTimeIT { conn.close(); } + +@Test +public void testLikeWithEscapenLParen() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String ddl = "CREATE TABLE t (k VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k))"; +conn.createStatement().execute(ddl); +conn.createStatement().execute("UPSERT INTO t VALUES('aa','bb')"); +conn.createStatement().execute("UPSERT INTO t VALUES('a\\(d','xx')"); +conn.createStatement().execute("UPSERT INTO t VALUES('dd',null)"); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM t WHERE k not like '%\\(%'"); +assertTrue(rs.next()); +assertEquals("aa", rs.getString(1)); +assertEquals("bb", rs.getString(2)); +assertTrue(rs.next()); +assertEquals("dd", rs.getString(1)); +assertEquals(null, rs.getString(2)); +assertFalse(rs.next()); +} } http://git-wip-us.apache.org/repos/asf/phoenix/blob/c485a40c/phoenix-core/src/main/antlr3/PhoenixSQL.g -- diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g b/phoenix-core/src/main/antlr3/PhoenixSQL.g index 23f7e8f..0be5717 100644 --- a/phoenix-core/src/main/antlr3/PhoenixSQL.g +++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g @@ -1213,14 +1213,14 @@ DIGIT STRING_LITERAL @init{ StringBuilder sb = new StringBuilder(); } : '\'' -( t=CHAR { sb.append(t.getText()); } -| t=CHAR_ESC { sb.append(getText()); } +( t=CHAR_ESC { sb.append(getText()); } +| t=CHAR { sb.append(t.getText()); } )* '\'' { setText(sb.toString()); } ; fragment CHAR -: ( ~('\'' | '\\') )+ +: ( ~('\'') ) ; fragment
[36/50] [abbrv] phoenix git commit: PHOENIX-2676 Cannot support join operations in scans with limit (Maryann Xue)
PHOENIX-2676 Cannot support join operations in scans with limit (Maryann Xue) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c316d910 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c316d910 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c316d910 Branch: refs/heads/calcite Commit: c316d91044e2e92030e3fd9e9b5fccbf5cfd5e17 Parents: 818683a Author: James TaylorAuthored: Wed Feb 17 11:53:11 2016 -0800 Committer: James Taylor Committed: Wed Feb 17 12:19:57 2016 -0800 -- .../coprocessor/HashJoinRegionScanner.java | 72 +--- 1 file changed, 48 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c316d910/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java index 1e34d96..8f64b55 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.hadoop.hbase.regionserver.NoLimitScannerContext; import org.apache.hadoop.hbase.regionserver.RegionScanner; import org.apache.hadoop.hbase.regionserver.ScannerContext; import org.apache.hadoop.hbase.util.Bytes; @@ -46,6 +47,7 @@ import org.apache.phoenix.schema.KeyValueSchema; import org.apache.phoenix.schema.ValueBitSet; import org.apache.phoenix.schema.tuple.ResultTuple; import org.apache.phoenix.schema.tuple.Tuple; +import org.apache.phoenix.util.ServerUtil; import org.apache.phoenix.util.TupleUtil; public class HashJoinRegionScanner implements RegionScanner { @@ -53,6 +55,7 @@ public class HashJoinRegionScanner implements RegionScanner { private final RegionScanner scanner; private final TupleProjector projector; private final HashJoinInfo joinInfo; +private final RegionCoprocessorEnvironment env; private Queue resultQueue; private boolean hasMore; private long count; @@ -64,6 +67,7 @@ public class HashJoinRegionScanner implements RegionScanner { @SuppressWarnings("unchecked") public HashJoinRegionScanner(RegionScanner scanner, TupleProjector projector, HashJoinInfo joinInfo, ImmutableBytesWritable tenantId, RegionCoprocessorEnvironment env) throws IOException { +this.env = env; this.scanner = scanner; this.projector = projector; this.joinInfo = joinInfo; @@ -250,25 +254,35 @@ public class HashJoinRegionScanner implements RegionScanner { @Override public boolean nextRaw(List result) throws IOException { -while (shouldAdvance()) { -hasMore = scanner.nextRaw(result); -processResults(result, false); -result.clear(); +try { +while (shouldAdvance()) { +hasMore = scanner.nextRaw(result); +processResults(result, false); +result.clear(); +} + +return nextInQueue(result); +} catch (Throwable t) { + ServerUtil.throwIOException(env.getRegion().getRegionInfo().getRegionNameAsString(), t); +return false; // impossible } - -return nextInQueue(result); } @Override public boolean nextRaw(List result, ScannerContext scannerContext) throws IOException { -while (shouldAdvance()) { -hasMore = scanner.nextRaw(result, scannerContext); -processResults(result, false); // TODO fix honoring the limit -result.clear(); +try { +while (shouldAdvance()) { +hasMore = scanner.nextRaw(result, scannerContext); +processResults(result, scannerContext != NoLimitScannerContext.getInstance()); +result.clear(); +} + +return nextInQueue(result); +} catch (Throwable t) { + ServerUtil.throwIOException(env.getRegion().getRegionInfo().getRegionNameAsString(), t); +return false; // impossible } - -return nextInQueue(result); } @Override @@ -283,24 +297,34 @@ public class HashJoinRegionScanner implements RegionScanner { @Override public boolean next(List result)
[21/50] [abbrv] phoenix git commit: PHOENIX-2657 Transactionally deleted cells become visible after few hours
PHOENIX-2657 Transactionally deleted cells become visible after few hours Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/04c3819f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/04c3819f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/04c3819f Branch: refs/heads/calcite Commit: 04c3819f0ca353f09eeb231424c09dbd3d9d5bb3 Parents: edd94b2 Author: James TaylorAuthored: Sat Feb 13 00:00:34 2016 -0800 Committer: James Taylor Committed: Sat Feb 13 00:02:18 2016 -0800 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/04c3819f/pom.xml -- diff --git a/pom.xml b/pom.xml index 70b1a79..fe79577 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ 2.1.2 1.6.0 8.1.7.v20120910 -0.6.4 +0.6.5 1.5.2 2.10.4 2.10
[48/50] [abbrv] phoenix git commit: Sync with master branch
Sync with master branch Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/58ec2579 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/58ec2579 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/58ec2579 Branch: refs/heads/calcite Commit: 58ec2579cd5883bf19b1d24cd3dd9342fec339c8 Parents: 69a2f24 e4acd0c Author: maryannxue <maryann@gmail.com> Authored: Tue Feb 23 10:07:19 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Tue Feb 23 10:07:19 2016 -0500 -- bin/queryserver.py | 14 +- .../phoenix/end2end/AlterTableWithViewsIT.java | 7 +- .../end2end/ClientTimeArithmeticQueryIT.java| 11 +- .../phoenix/end2end/CompareDecimalToLongIT.java | 241 .../phoenix/end2end/ContextClassloaderIT.java | 2 +- .../phoenix/end2end/CsvBulkLoadToolIT.java | 114 ++-- .../org/apache/phoenix/end2end/DateTimeIT.java | 5 +- .../org/apache/phoenix/end2end/DeleteIT.java| 3 +- .../apache/phoenix/end2end/DistinctCountIT.java | 2 +- .../apache/phoenix/end2end/GroupByCaseIT.java | 35 ++ .../org/apache/phoenix/end2end/IndexToolIT.java | 273 +++-- .../phoenix/end2end/LikeExpressionIT.java | 20 + .../apache/phoenix/end2end/LpadFunctionIT.java | 242 .../org/apache/phoenix/end2end/MapReduceIT.java | 230 .../phoenix/end2end/MultiCfQueryExecIT.java | 51 ++ .../phoenix/end2end/MutableIndexToolIT.java | 128 + .../apache/phoenix/end2end/PercentileIT.java| 2 +- .../apache/phoenix/end2end/PrimitiveTypeIT.java | 245 .../phoenix/end2end/ProductMetricsIT.java | 6 +- .../apache/phoenix/end2end/ReverseScanIT.java | 21 + .../phoenix/end2end/RowValueConstructorIT.java | 4 +- .../end2end/StatsCollectionDisabledIT.java | 70 +++ .../phoenix/end2end/StatsCollectorIT.java | 28 +- .../StatsCollectorWithSplitsAndMultiCFIT.java | 69 ++- .../org/apache/phoenix/end2end/StringIT.java| 254 + .../org/apache/phoenix/end2end/UnionAllIT.java | 49 +- .../phoenix/end2end/UserDefinedFunctionsIT.java | 8 +- .../phoenix/end2end/VariableLengthPKIT.java | 2 +- .../end2end/index/DropIndexDuringUpsertIT.java | 2 +- .../end2end/index/IndexExpressionIT.java| 7 +- .../apache/phoenix/end2end/index/IndexIT.java | 5 +- .../end2end/index/MutableIndexFailureIT.java| 398 + .../index/MutableIndexReplicationIT.java| 2 +- .../end2end/index/ReadOnlyIndexFailureIT.java | 284 ++ .../salted/SaltedTableUpsertSelectIT.java | 57 ++ .../EndToEndCoveredColumnsIndexBuilderIT.java | 2 +- .../example/EndToEndCoveredIndexingIT.java | 5 +- .../org/apache/phoenix/tx/TransactionIT.java| 12 +- phoenix-core/src/main/antlr3/PhoenixSQL.g | 5 +- .../apache/phoenix/calcite/PhoenixSchema.java | 2 +- .../apache/phoenix/calcite/PhoenixTable.java| 12 +- .../calcite/rel/PhoenixRelImplementorImpl.java | 2 +- .../phoenix/calcite/rel/PhoenixTableScan.java | 5 +- .../apache/phoenix/compile/DeleteCompiler.java | 6 +- .../apache/phoenix/compile/FromCompiler.java| 2 +- .../apache/phoenix/compile/GroupByCompiler.java | 74 ++- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../apache/phoenix/compile/QueryCompiler.java | 3 +- .../org/apache/phoenix/compile/ScanRanges.java | 2 + .../compile/TupleProjectionCompiler.java| 4 +- .../apache/phoenix/compile/UnionCompiler.java | 2 +- .../apache/phoenix/compile/UpsertCompiler.java | 7 +- .../coprocessor/BaseScannerRegionObserver.java | 16 +- .../coprocessor/DelegateRegionObserver.java | 562 +++ .../coprocessor/HashJoinRegionScanner.java | 71 ++- .../coprocessor/MetaDataEndpointImpl.java | 92 +-- .../coprocessor/MetaDataRegionObserver.java | 136 - .../PhoenixTransactionalProcessor.java | 28 + .../UngroupedAggregateRegionObserver.java | 31 +- .../generated/PGuidePostsProtos.java| 336 ++- .../coprocessor/generated/PTableProtos.java | 103 +++- .../phoenix/exception/SQLExceptionCode.java | 7 +- .../apache/phoenix/execute/AggregatePlan.java | 16 +- .../apache/phoenix/execute/MutationState.java | 39 +- .../org/apache/phoenix/execute/ScanPlan.java| 19 +- .../phoenix/expression/InListExpression.java| 2 +- .../phoenix/expression/LiteralExpression.java | 2 +- .../expression/ProjectedColumnExpression.java | 11 +- .../expression/StringConcatExpression.java | 21 +- .../expression/util/regex/JavaPattern.java | 2 +- .../visitor/CloneExpressionVisitor.java | 2 +- .../phoenix/filter/ColumnProjectionFilter.java | 2 + .../apache/phoenix/filter/SkipScanFilter.java | 47 +- .../hbase/i
[44/50] [abbrv] phoenix git commit: PHOENIX-2670 Guava version incompatibility of Twill vs HBase when launching M/R index
PHOENIX-2670 Guava version incompatibility of Twill vs HBase when launching M/R index Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/61fa462b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/61fa462b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/61fa462b Branch: refs/heads/calcite Commit: 61fa462b433296c29b1046e035f811ae159eaa85 Parents: 9dd6bab Author: James TaylorAuthored: Fri Feb 19 14:33:27 2016 -0800 Committer: James Taylor Committed: Fri Feb 19 14:34:21 2016 -0800 -- .../phoenix/query/ConnectionQueryServicesImpl.java| 14 -- pom.xml | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/61fa462b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 9a385b2..d55ab30 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -193,6 +193,7 @@ import com.google.common.base.Joiner; import com.google.common.base.Throwables; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; @@ -204,6 +205,7 @@ import co.cask.tephra.TransactionSystemClient; import co.cask.tephra.TxConstants; import co.cask.tephra.distributed.PooledClientProvider; import co.cask.tephra.distributed.TransactionServiceClient; +import co.cask.tephra.zookeeper.TephraZKClientService; public class ConnectionQueryServicesImpl extends DelegateQueryServices implements ConnectionQueryServices { @@ -350,14 +352,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement if (zkQuorumServersString==null) { zkQuorumServersString = connectionInfo.getZookeeperQuorum()+":"+connectionInfo.getPort(); } + +int timeOut = props.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT); +// Create instance of the tephra zookeeper client +ZKClientService tephraZKClientService = new TephraZKClientService(zkQuorumServersString, timeOut, null, ArrayListMultimap. create()); + ZKClientService zkClientService = ZKClientServices.delegate( ZKClients.reWatchOnExpire( -ZKClients.retryOnFailure( - ZKClientService.Builder.of(zkQuorumServersString) - .setSessionTimeout(props.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT)) -.build(), - RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) -) + ZKClients.retryOnFailure(tephraZKClientService, RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS)) ) ); zkClientService.startAndWait(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/61fa462b/pom.xml -- diff --git a/pom.xml b/pom.xml index fe79577..b27c3b9 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ 2.1.2 1.6.0 8.1.7.v20120910 -0.6.5 +0.7.0 1.5.2 2.10.4 2.10
[14/50] [abbrv] phoenix git commit: PHOENIX-2334 CSV Bulk load fails on local indexes(Rajeshbabu)
PHOENIX-2334 CSV Bulk load fails on local indexes(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/decbfe30 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/decbfe30 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/decbfe30 Branch: refs/heads/calcite Commit: decbfe3062bbc970050e03fbb198e61a2d30e88c Parents: c48fee0 Author: Rajeshbabu ChintaguntlaAuthored: Thu Feb 11 02:48:05 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Thu Feb 11 02:48:05 2016 +0530 -- .../phoenix/end2end/CsvBulkLoadToolIT.java | 27 +++- .../phoenix/mapreduce/AbstractBulkLoadTool.java | 16 .../mapreduce/bulkload/TargetTableRef.java | 2 +- .../phoenix/query/ConnectionQueryServices.java | 1 + .../query/ConnectionQueryServicesImpl.java | 27 .../query/ConnectionlessQueryServicesImpl.java | 15 +++ .../query/DelegateConnectionQueryServices.java | 6 + .../java/org/apache/phoenix/util/IndexUtil.java | 10 +++- 8 files changed, 85 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/decbfe30/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java index 26ec889..96042c5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java @@ -218,7 +218,7 @@ public class CsvBulkLoadToolIT extends BaseOwnClusterHBaseManagedTimeIT { Statement stmt = conn.createStatement(); stmt.execute("CREATE TABLE TABLE6 (ID INTEGER NOT NULL PRIMARY KEY, " + -"FIRST_NAME VARCHAR, LAST_NAME VARCHAR)"); +"FIRST_NAME VARCHAR, LAST_NAME VARCHAR) SPLIt ON (1,2)"); String ddl = "CREATE LOCAL INDEX TABLE6_IDX ON TABLE6 " + " (FIRST_NAME ASC)"; stmt.execute(ddl); @@ -234,16 +234,19 @@ public class CsvBulkLoadToolIT extends BaseOwnClusterHBaseManagedTimeIT { CsvBulkLoadTool csvBulkLoadTool = new CsvBulkLoadTool(); csvBulkLoadTool.setConf(getUtility().getConfiguration()); -try { -csvBulkLoadTool.run(new String[] { -"--input", "/tmp/input3.csv", -"--table", "table6", -"--zookeeper", zkQuorum}); -fail("Csv bulk load currently has issues with local indexes."); -} catch( UnsupportedOperationException ise) { -assertEquals("Local indexes not supported by Bulk Loader",ise.getMessage()); -} - +int exitCode = csvBulkLoadTool.run(new String[] { +"--input", "/tmp/input3.csv", +"--table", "table6", +"--zookeeper", zkQuorum}); +assertEquals(0, exitCode); + +ResultSet rs = stmt.executeQuery("SELECT id, FIRST_NAME FROM TABLE6 where first_name='FirstName 2'"); +assertTrue(rs.next()); +assertEquals(2, rs.getInt(1)); +assertEquals("FirstName 2", rs.getString(2)); + +rs.close(); +stmt.close(); } @Test @@ -251,7 +254,7 @@ public class CsvBulkLoadToolIT extends BaseOwnClusterHBaseManagedTimeIT { testImportOneIndexTable("TABLE4", false); } -//@Test +@Test public void testImportOneLocalIndexTable() throws Exception { testImportOneIndexTable("TABLE5", true); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/decbfe30/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java index f6ba5f6..39ee4b1 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java @@ -21,8 +21,10 @@ import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import org.apache.commons.cli.CommandLine; @@ -54,6 +56,7 @@ import org.apache.phoenix.mapreduce.bulkload.TargetTableRefFunctions; import org.apache.phoenix.query.QueryConstants; import
[31/50] [abbrv] phoenix git commit: PHOENIX-2635 Partial index rebuild doesn't work for mutable data
PHOENIX-2635 Partial index rebuild doesn't work for mutable data Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4ccce0ed Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4ccce0ed Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4ccce0ed Branch: refs/heads/calcite Commit: 4ccce0ed103db04667da95ab515eda76029dacdb Parents: d2fcd21 Author: James TaylorAuthored: Tue Feb 16 09:00:24 2016 -0800 Committer: James Taylor Committed: Tue Feb 16 09:03:10 2016 -0800 -- .../apache/phoenix/coprocessor/MetaDataRegionObserver.java | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4ccce0ed/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java index 0cce4d7..9bcf2d0 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java @@ -56,6 +56,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.phoenix.cache.GlobalCache; import org.apache.phoenix.cache.ServerCacheClient; +import org.apache.phoenix.hbase.index.util.IndexManagementUtil; import org.apache.phoenix.index.IndexMaintainer; import org.apache.phoenix.index.PhoenixIndexCodec; import org.apache.phoenix.jdbc.PhoenixConnection; @@ -320,8 +321,12 @@ public class MetaDataRegionObserver extends BaseRegionObserver { long timeStamp = Math.max(0, earliestDisableTimestamp - overlapTime); LOG.info("Starting to build indexes=" + indexesToPartiallyRebuild + " from timestamp=" + timeStamp); -Scan dataTableScan = new Scan(); -dataTableScan.setRaw(true); +new Scan(); +List maintainers = Lists.newArrayListWithExpectedSize(indexesToPartiallyRebuild.size()); +for (PTable index : indexesToPartiallyRebuild) { +maintainers.add(index.getIndexMaintainer(dataPTable, conn)); +} +Scan dataTableScan = IndexManagementUtil.newLocalStateScan(maintainers); dataTableScan.setTimeRange(timeStamp, HConstants.LATEST_TIMESTAMP); byte[] physicalTableName = dataPTable.getPhysicalName().getBytes(); try (HTableInterface dataHTable = conn.getQueryServices().getTable(physicalTableName)) {
[28/50] [abbrv] phoenix git commit: PHOENIX-2602 Parser does not handle escaped LPAREN
PHOENIX-2602 Parser does not handle escaped LPAREN Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/43b34da1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/43b34da1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/43b34da1 Branch: refs/heads/calcite Commit: 43b34da1d4e10bef233bbb748c5dd1be11d7ce18 Parents: 046bda3 Author: James TaylorAuthored: Mon Feb 15 01:44:31 2016 -0800 Committer: James Taylor Committed: Mon Feb 15 10:14:58 2016 -0800 -- phoenix-core/src/main/antlr3/PhoenixSQL.g | 7 --- .../test/java/org/apache/phoenix/parse/QueryParserTest.java | 6 ++ 2 files changed, 10 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/43b34da1/phoenix-core/src/main/antlr3/PhoenixSQL.g -- diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g b/phoenix-core/src/main/antlr3/PhoenixSQL.g index 0be5717..64e1d32 100644 --- a/phoenix-core/src/main/antlr3/PhoenixSQL.g +++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g @@ -1213,14 +1213,14 @@ DIGIT STRING_LITERAL @init{ StringBuilder sb = new StringBuilder(); } : '\'' -( t=CHAR_ESC { sb.append(getText()); } -| t=CHAR { sb.append(t.getText()); } +( t=CHAR { sb.append(t.getText()); } +| t=CHAR_ESC { sb.append(getText()); } )* '\'' { setText(sb.toString()); } ; fragment CHAR -: ( ~('\'') ) +: ( ~('\'' | '\\') ) ; fragment @@ -1242,6 +1242,7 @@ CHAR_ESC | '\\' { setText("\\"); } | '_' { setText("\\_"); } | '%' { setText("\\\%"); } +| { setText("\\"); } ) | '\'\'' { setText("\'"); } ; http://git-wip-us.apache.org/repos/asf/phoenix/blob/43b34da1/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java -- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java index 5363042..70f590f 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java @@ -766,4 +766,10 @@ public class QueryParserTest { String sql = "select * from t where 'a' <= ALL(a-b+1)"; parseQuery(sql); } + +@Test +public void testDoubleBackslash() throws Exception { +String sql = "SELECT * FROM T WHERE A LIKE 'a\\(d'"; +parseQuery(sql); +} }
[39/50] [abbrv] phoenix git commit: PHOENIX-2689 VARCHAR Field Not Working With String Concatenation
PHOENIX-2689 VARCHAR Field Not Working With String Concatenation Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/45a9d670 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/45a9d670 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/45a9d670 Branch: refs/heads/calcite Commit: 45a9d670bbb5e659fb967cfdbc6fc1ced43fba12 Parents: 7d90e88 Author: James TaylorAuthored: Thu Feb 18 12:16:27 2016 -0800 Committer: James Taylor Committed: Thu Feb 18 12:16:27 2016 -0800 -- .../apache/phoenix/end2end/LpadFunctionIT.java | 242 -- .../org/apache/phoenix/end2end/StringIT.java| 254 +++ .../expression/StringConcatExpression.java | 21 +- 3 files changed, 271 insertions(+), 246 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/45a9d670/phoenix-core/src/it/java/org/apache/phoenix/end2end/LpadFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LpadFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LpadFunctionIT.java deleted file mode 100644 index 4070103..000 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LpadFunctionIT.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * 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 static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; - -import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.query.QueryConstants; -import org.apache.phoenix.util.ByteUtil; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; - -import com.google.common.collect.Lists; - -/** - * Tests for the LPAD built-in function. - */ - -public class LpadFunctionIT extends BaseHBaseManagedTimeIT { - -/** - * Helper to test LPAD function - * - * @param conn - *connection to be used - * @param colName - *name of column to query - * @param length - *length of the output string - * @param fillString - *fill characters to be used while prepending - * @param sortOrder - *sort order of the pk column - * @param expectedOutput - *expected output of LPAD function - */ -private void testLpadHelper(Connection conn, String colName, int length, List fillStringList, -List expectedOutputList, String sortOrder) throws Exception { -assertEquals("fillStringList and expectedOutputList should be of equal size", fillStringList.size(), -expectedOutputList.size()); -for (int id = 0; id < fillStringList.size(); ++id) { -String fillString = fillStringList.get(id); -String lPadExpr = fillString != null ? "LPAD(%s,?,?)" : "LPAD(%s,?)"; -String sql = String.format("SELECT " + lPadExpr + " FROM TEST_TABLE_%s WHERE id=?", colName, sortOrder); -PreparedStatement stmt = conn.prepareStatement(sql); -int index = 1; -stmt.setInt(index++, length); -if (fillString != null) -stmt.setString(index++, fillString); -stmt.setInt(index++, id); - -ResultSet rs = stmt.executeQuery(); -assertTrue("Expected exactly one row to be returned ", rs.next()); -assertEquals("LPAD returned incorrect result ", expectedOutputList.get(id), rs.getString(1)); -assertFalse("Expected exactly one row to be returned ", rs.next()); -} -} - -/** - * Helper to test LPAD function - * - * @param conn - *connection
[43/50] [abbrv] phoenix git commit: PHOENIX-2696 Delete stale stats for a region if in later run no guidePosts found for that region(Ankit Singhal)
PHOENIX-2696 Delete stale stats for a region if in later run no guidePosts found for that region(Ankit Singhal) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9dd6babd Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9dd6babd Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9dd6babd Branch: refs/heads/calcite Commit: 9dd6babd86186242b55d01afcb857aa02497ea95 Parents: c2cc1be Author: Ankit SinghalAuthored: Fri Feb 19 22:28:07 2016 +0530 Committer: Ankit Singhal Committed: Fri Feb 19 22:28:07 2016 +0530 -- .../phoenix/schema/stats/DefaultStatisticsCollector.java | 8 1 file changed, 8 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dd6babd/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index 96b35f1..cb6f5d4 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -126,6 +126,14 @@ class DefaultStatisticsCollector implements StatisticsCollector { throws IOException { try { // update the statistics table +// Delete statistics for a region if no guidepost is collected for that region during UPDATE STATISTICS +// This will not impact a stats collection of single column family during compaction as +// guidePostsInfoWriterMap cannot be empty in this case. +if (guidePostsInfoWriterMap.keySet().isEmpty()) { +for (Store store : region.getStores()) { +statsTable.deleteStats(region, this, new ImmutableBytesPtr(store.getFamily().getName()), mutations); +} +} for (ImmutableBytesPtr fam : guidePostsInfoWriterMap.keySet()) { if (delete) { if (logger.isDebugEnabled()) {
[40/50] [abbrv] phoenix git commit: PHOENIX-2691 Exception while unpacking resultset containing VARCHAR ARRAY of unspecified length
PHOENIX-2691 Exception while unpacking resultset containing VARCHAR ARRAY of unspecified length Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cac03056 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cac03056 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cac03056 Branch: refs/heads/calcite Commit: cac03056578170a82ba812aa4648e0e5b1a1bbb6 Parents: 45a9d67 Author: James TaylorAuthored: Thu Feb 18 14:59:29 2016 -0800 Committer: James Taylor Committed: Thu Feb 18 15:14:48 2016 -0800 -- .../apache/phoenix/end2end/GroupByCaseIT.java | 35 + .../apache/phoenix/compile/GroupByCompiler.java | 74 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../java/org/apache/phoenix/util/IndexUtil.java | 6 +- .../phoenix/compile/QueryCompilerTest.java | 36 ++ 5 files changed, 122 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cac03056/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java index 0f1568c..172f9f7 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java @@ -226,4 +226,39 @@ public class GroupByCaseIT extends BaseHBaseManagedTimeIT { conn.close(); } + +@Test +public void testGroupByArray() throws Exception { +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +Connection conn = DriverManager.getConnection(getUrl(), props); +conn.createStatement().execute("CREATE TABLE test1(\n" + +" a VARCHAR NOT NULL,\n" + +" b VARCHAR,\n" + +" c INTEGER,\n" + +" d VARCHAR,\n" + +" e VARCHAR ARRAY,\n" + +" f BIGINT,\n" + +" g BIGINT,\n" + +" CONSTRAINT pk PRIMARY KEY(a)\n" + +")"); +conn.createStatement().execute("UPSERT INTO test1 VALUES('1', 'val', 100, 'a', ARRAY ['b'], 1, 2)"); +conn.createStatement().execute("UPSERT INTO test1 VALUES('2', 'val', 100, 'a', ARRAY ['b'], 3, 4)"); +conn.createStatement().execute("UPSERT INTO test1 VALUES('3', 'val', 100, 'a', ARRAY ['b','c'], 5, 6)"); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("SELECT c, SUM(f + g) AS sumone, d, e\n" + +"FROM test1\n" + +"WHERE b = 'val'\n" + +" AND a IN ('1','2','3')\n" + +"GROUP BY c, d, e\n" + +"ORDER BY sumone DESC"); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertEquals(11, rs.getLong(2)); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertEquals(10, rs.getLong(2)); +assertFalse(rs.next()); +conn.close(); +} } http://git-wip-us.apache.org/repos/asf/phoenix/blob/cac03056/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java index 7d9df02..85478bf 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java @@ -38,8 +38,8 @@ import org.apache.phoenix.parse.SelectStatement; import org.apache.phoenix.schema.AmbiguousColumnException; import org.apache.phoenix.schema.ColumnNotFoundException; import org.apache.phoenix.schema.types.PDataType; -import org.apache.phoenix.schema.types.PDecimal; -import org.apache.phoenix.schema.types.PVarchar; +import org.apache.phoenix.schema.types.PVarbinary; +import org.apache.phoenix.util.IndexUtil; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -217,34 +217,53 @@ public class GroupByCompiler { public int compare(Pair gb1, Pair gb2) { Expression e1 = gb1.getSecond(); Expression e2 = gb2.getSecond(); -boolean isFixed1 = e1.getDataType().isFixedWidth(); -boolean isFixed2 = e2.getDataType().isFixedWidth(); +PDataType t1 = e1.getDataType(); +
[24/50] [abbrv] phoenix git commit: PHOENIX-2221 Option to make data regions not writable when index regions are not available (Alicia Ying Shu, James Taylor)
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e2a6386f/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java index f5c9295..abd31c0 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java @@ -66,6 +66,8 @@ import org.apache.phoenix.util.SizedUtil; import org.apache.phoenix.util.StringUtil; import org.apache.phoenix.util.TrustedByteArrayOutputStream; +import co.cask.tephra.TxConstants; + import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.collect.ArrayListMultimap; @@ -78,8 +80,6 @@ import com.google.common.collect.Maps; import com.google.protobuf.HBaseZeroCopyByteString; import com.sun.istack.NotNull; -import co.cask.tephra.TxConstants; - /** * * Base class for PTable implementors. Provides abstraction for @@ -101,6 +101,7 @@ public class PTableImpl implements PTable { private PIndexState state; private long sequenceNumber; private long timeStamp; +private long indexDisableTimestamp; // Have MultiMap for String->PColumn (may need family qualifier) private List pkColumns; private List allColumns; @@ -207,7 +208,7 @@ public class PTableImpl implements PTable { table.getSequenceNumber(), table.getPKName(), table.getBucketNum(), getColumnsToClone(table), parentSchemaName, table.getParentTableName(), indexes, table.isImmutableRows(), table.getPhysicalNames(), table.getDefaultFamilyName(), viewStatement, table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), table.getIndexType(), -table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); +table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency(), table.getIndexDisableTimestamp()); } public static PTableImpl makePTable(PTable table, List columns) throws SQLException { @@ -216,7 +217,7 @@ public class PTableImpl implements PTable { table.getSequenceNumber(), table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), table.isImmutableRows(), table.getPhysicalNames(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), table.getIndexType(), -table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); +table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency(), table.getIndexDisableTimestamp()); } public static PTableImpl makePTable(PTable table, long timeStamp, long sequenceNumber, List columns) throws SQLException { @@ -225,7 +226,7 @@ public class PTableImpl implements PTable { sequenceNumber, table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), table.isImmutableRows(), table.getPhysicalNames(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), table.getIndexType(), table.getTableStats(), -table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); +table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency(), table.getIndexDisableTimestamp()); } public static PTableImpl makePTable(PTable table, long timeStamp, long sequenceNumber, List columns, boolean isImmutableRows) throws SQLException { @@ -234,7 +235,7 @@ public class PTableImpl implements PTable { sequenceNumber, table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), isImmutableRows, table.getPhysicalNames(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), -table.getIndexType(), table.getTableStats(),
[03/50] [abbrv] phoenix git commit: PHOENIX-2649 - GC/OOM during BulkLoad (Sergey Soldatov)
PHOENIX-2649 - GC/OOM during BulkLoad (Sergey Soldatov) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a82a0ff6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a82a0ff6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a82a0ff6 Branch: refs/heads/calcite Commit: a82a0ff608f90c470a1290296f8ed08243956fc9 Parents: 7972422 Author: ravimaghamAuthored: Thu Feb 4 14:38:43 2016 -0800 Committer: ravimagham Committed: Thu Feb 4 14:38:43 2016 -0800 -- .../mapreduce/bulkload/TableRowkeyPair.java | 38 +--- .../mapreduce/bulkload/TestTableRowkeyPair.java | 6 ++-- 2 files changed, 37 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a82a0ff6/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java index e3032be..ac80341 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java @@ -22,7 +22,7 @@ import java.io.DataOutput; import java.io.IOException; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.hadoop.io.BytesWritable; +import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; import org.apache.hadoop.io.WritableUtils; @@ -30,6 +30,7 @@ import org.apache.hadoop.io.WritableUtils; import com.google.common.base.Preconditions; + /** * A WritableComparable to hold the table name and the rowkey. */ @@ -101,9 +102,38 @@ public class TableRowkeyPair implements WritableComparable { return this.tableName.compareTo(otherTableName); } } - -static { -WritableComparator.define(TableRowkeyPair.class, new BytesWritable.Comparator()); + +/** Comparator for TableRowkeyPair. */ +public static class Comparator extends WritableComparator { + +public Comparator() { +super(TableRowkeyPair.class); +} + +@Override +public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { +try { +// Compare table names +int strL1 = readInt(b1, s1); +int strL2 = readInt(b2, s2); +int cmp = compareBytes(b1, s1 + Bytes.SIZEOF_INT, strL1, b2, s2 + Bytes.SIZEOF_INT, strL2); +if (cmp != 0) { +return cmp; +} +// Compare row keys +int strL3 = readInt(b1, s1 + Bytes.SIZEOF_INT + strL1); +int strL4 = readInt(b2, s2 + Bytes.SIZEOF_INT + strL2); +int i = compareBytes(b1, s1 + Bytes.SIZEOF_INT*2 + strL1, strL3, b2, s2 ++ Bytes.SIZEOF_INT*2 + strL2, strL4); +return i; +} catch(Exception ex) { +throw new IllegalArgumentException(ex); +} +} +} + +static { +WritableComparator.define(TableRowkeyPair.class, new Comparator()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/a82a0ff6/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java -- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java b/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java index 1fee4bb..2a29c00 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java @@ -23,7 +23,6 @@ import java.io.IOException; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.io.BytesWritable; import org.junit.Assert; import org.junit.Test; @@ -38,8 +37,9 @@ public class TestTableRowkeyPair { testsRowsKeys("first", "aa", "first", "ab", -1); testsRowsKeys("second", "aa", "first", "aa", 1); testsRowsKeys("first", "aa", "first", "aaa", -1); +testsRowsKeys("first","bb", "first", "", 1); } - + private void testsRowsKeys(String aTable, String akey, String bTable, String bkey, int expectedSignum) throws IOException { final ImmutableBytesWritable
[47/50] [abbrv] phoenix git commit: PHOENIX-2702 Show estimate rows and bytes touched in explain plan.
PHOENIX-2702 Show estimate rows and bytes touched in explain plan. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e4acd0cd Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e4acd0cd Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e4acd0cd Branch: refs/heads/calcite Commit: e4acd0cda4ad8f12db8331af39a9e32f4b81c223 Parents: d9d66ae Author: Lars HofhanslAuthored: Sun Feb 21 22:32:09 2016 -0800 Committer: Lars Hofhansl Committed: Sun Feb 21 22:32:09 2016 -0800 -- .../apache/phoenix/iterate/BaseResultIterators.java | 14 +- .../java/org/apache/phoenix/iterate/ExplainTable.java | 2 +- .../phoenix/schema/stats/GuidePostsInfoBuilder.java | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4acd0cd/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index 01b790a..fc3edbe 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -120,6 +120,8 @@ public abstract class BaseResultIterators extends ExplainTable implements Result private final ParallelScanGrouper scanGrouper; // TODO: too much nesting here - breakup into new classes. private final List TO_KEY_RANGE = new Function
() { @Override @@ -558,6 +560,8 @@ public abstract class BaseResultIterators extends ExplainTable implements Result while (guideIndex < gpsSize && (currentGuidePost.compareTo(endKey) <= 0 || endKey.length == 0)) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, false); +estimatedRows += gps.getRowCounts().get(guideIndex); +estimatedSize += gps.getByteCounts().get(guideIndex); scans = addNewScan(parallelScans, scans, newScan, currentGuidePostBytes, false, regionLocation); currentKeyBytes = currentGuidePost.copyBytes(); currentGuidePost = PrefixByteCodec.decode(decoder, input); @@ -851,7 +855,15 @@ public abstract class BaseResultIterators extends ExplainTable implements Result QueryServices.EXPLAIN_CHUNK_COUNT_ATTRIB, QueryServicesOptions.DEFAULT_EXPLAIN_CHUNK_COUNT); StringBuilder buf = new StringBuilder(); -buf.append("CLIENT " + (displayChunkCount ? (this.splits.size() + "-CHUNK ") : "") + getName() + " " + size() + "-WAY "); +buf.append("CLIENT "); +if (displayChunkCount) { +buf.append(this.splits.size()).append("-CHUNK "); +if (estimatedRows > 0) { +buf.append(estimatedRows).append(" ROWS "); +buf.append(estimatedSize).append(" BYTES "); +} +} +buf.append(getName()).append(" ").append(size()).append("-WAY "); explain(buf.toString(),planSteps); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4acd0cd/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java index b319914..1b623a4 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java @@ -120,7 +120,7 @@ public abstract class ExplainTable { } else { explainSkipScan(buf); } -buf.append("OVER " + tableRef.getTable().getPhysicalName().getString()); +buf.append("OVER ").append(tableRef.getTable().getPhysicalName().getString()); if (!scanRanges.isPointLookup()) { appendKeyRanges(buf); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4acd0cd/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java
[38/50] [abbrv] phoenix git commit: PHOENIX-2676 Cannot support join operations in scans with limit
PHOENIX-2676 Cannot support join operations in scans with limit Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7d90e882 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7d90e882 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7d90e882 Branch: refs/heads/calcite Commit: 7d90e88261dfc4ef30544ad7d92fa8c66653df56 Parents: 5127a65 Author: James TaylorAuthored: Wed Feb 17 12:34:48 2016 -0800 Committer: James Taylor Committed: Wed Feb 17 12:34:48 2016 -0800 -- .../org/apache/phoenix/coprocessor/HashJoinRegionScanner.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d90e882/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java index 8f64b55..bd9c5ec 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java @@ -29,7 +29,6 @@ import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.hadoop.hbase.regionserver.NoLimitScannerContext; import org.apache.hadoop.hbase.regionserver.RegionScanner; import org.apache.hadoop.hbase.regionserver.ScannerContext; import org.apache.hadoop.hbase.util.Bytes; @@ -274,7 +273,7 @@ public class HashJoinRegionScanner implements RegionScanner { try { while (shouldAdvance()) { hasMore = scanner.nextRaw(result, scannerContext); -processResults(result, scannerContext != NoLimitScannerContext.getInstance()); +processResults(result, false); // TODO detect if limit used here result.clear(); } @@ -316,7 +315,7 @@ public class HashJoinRegionScanner implements RegionScanner { try { while (shouldAdvance()) { hasMore = scanner.next(result, scannerContext); -processResults(result, scannerContext != NoLimitScannerContext.getInstance()); +processResults(result, false); // TODO detect if limit used here result.clear(); }
[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 YatesAuthored: 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); +
[16/50] [abbrv] phoenix git commit: PHOENIX-2658 When using QueryRunner API UNION ALL queries fail with NPE (Alicia Ying Shu)
PHOENIX-2658 When using QueryRunner API UNION ALL queries fail with NPE (Alicia Ying Shu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0c21539c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0c21539c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0c21539c Branch: refs/heads/calcite Commit: 0c21539cc331b8d6ca144604cf899068ad74fb25 Parents: 18f7a69 Author: James TaylorAuthored: Thu Feb 11 20:10:23 2016 -0800 Committer: James Taylor Committed: Thu Feb 11 20:14:32 2016 -0800 -- .../org/apache/phoenix/end2end/UnionAllIT.java | 49 +++- .../apache/phoenix/compile/QueryCompiler.java | 3 +- 2 files changed, 50 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c21539c/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java index 6531129..b391dcc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java @@ -40,7 +40,6 @@ import org.apache.phoenix.util.ReadOnlyProps; import org.junit.BeforeClass; import org.junit.Test; - public class UnionAllIT extends BaseOwnClusterHBaseManagedTimeIT { @BeforeClass @@ -679,4 +678,52 @@ public class UnionAllIT extends BaseOwnClusterHBaseManagedTimeIT { conn.close(); } } + +@Test +public void testParameterMetaDataNotNull() throws Exception { +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +Connection conn = DriverManager.getConnection(getUrl(), props); + +String ddl = "CREATE TABLE test_table " + +" (a_string varchar not null, col1 integer" + +" CONSTRAINT pk PRIMARY KEY (a_string))\n"; +createTestTable(getUrl(), ddl); +String dml = "UPSERT INTO test_table VALUES(?, ?)"; +PreparedStatement stmt = conn.prepareStatement(dml); +stmt.setString(1, "a"); +stmt.setInt(2, 10); +stmt.execute(); +conn.commit(); + +ddl = "CREATE TABLE b_table " + +" (a_string varchar not null, col1 integer" + +" CONSTRAINT pk PRIMARY KEY (a_string))\n"; +createTestTable(getUrl(), ddl); +dml = "UPSERT INTO b_table VALUES(?, ?)"; +stmt = conn.prepareStatement(dml); +stmt.setString(1, "b"); +stmt.setInt(2, 20); +stmt.execute(); +conn.commit(); + +String query = "select * from test_table union all select * from b_table"; + +try{ +PreparedStatement pstmt = conn.prepareStatement(query); +assertTrue(pstmt.getParameterMetaData() != null); +ResultSet rs = pstmt.executeQuery(); +assertTrue(rs.next()); +assertEquals("a",rs.getString(1)); +assertEquals(10,rs.getInt(2)); +assertTrue(rs.next()); +assertEquals("b",rs.getString(1)); +assertEquals(20,rs.getInt(2)); +assertFalse(rs.next()); +} catch (Exception ex) { +ex.printStackTrace(); +} finally { +conn.close(); +} +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c21539c/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java index 70bb815..9e756c8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java @@ -182,7 +182,8 @@ public class QueryCompiler { StatementContext context = new StatementContext(statement, resolver, scan, sequenceManager); QueryPlan plan = compileSingleFlatQuery(context, select, statement.getParameters(), false, false, null, null, false); -plan = new UnionPlan(context, select, tableRef, plan.getProjector(), plan.getLimit(), plan.getOrderBy(), GroupBy.EMPTY_GROUP_BY, plans, null); +plan = new UnionPlan(context, select, tableRef, plan.getProjector(), plan.getLimit(), plan.getOrderBy(), GroupBy.EMPTY_GROUP_BY, +plans, context.getBindManager().getParameterMetaData()); return plan; }
[22/50] [abbrv] phoenix git commit: PHOENIX-2667 Race condition between IndexBuilder and Split for region lock
PHOENIX-2667 Race condition between IndexBuilder and Split for region lock Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cdaca287 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cdaca287 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cdaca287 Branch: refs/heads/calcite Commit: cdaca287cd50fbdd25a9b11d8af6fb0a3b3956cc Parents: 04c3819 Author: James TaylorAuthored: Sat Feb 13 15:49:31 2016 -0800 Committer: James Taylor Committed: Sat Feb 13 15:53:29 2016 -0800 -- .../phoenix/hbase/index/builder/IndexBuildManager.java| 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cdaca287/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java index ae2125e..f411b8e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java @@ -39,7 +39,8 @@ import org.apache.phoenix.hbase.index.parallel.QuickFailingTaskRunner; import org.apache.phoenix.hbase.index.parallel.Task; import org.apache.phoenix.hbase.index.parallel.TaskBatch; import org.apache.phoenix.hbase.index.parallel.ThreadPoolBuilder; -import org.apache.phoenix.hbase.index.parallel.ThreadPoolManager; + +import com.google.common.util.concurrent.MoreExecutors; /** * Manage the building of index updates from primary table updates. @@ -77,10 +78,11 @@ public class IndexBuildManager implements Stoppable { * @throws IOException if an {@link IndexBuilder} cannot be correctly steup */ public IndexBuildManager(RegionCoprocessorEnvironment env) throws IOException { -this(getIndexBuilder(env), new QuickFailingTaskRunner(ThreadPoolManager.getExecutor( - getPoolBuilder(env), env))); +// Prevent deadlock by using single thread for all reads so that we know +// we can get the ReentrantRWLock. See PHOENIX-2671 for more details. +this(getIndexBuilder(env), new QuickFailingTaskRunner(MoreExecutors.sameThreadExecutor())); } - + private static IndexBuilder getIndexBuilder(RegionCoprocessorEnvironment e) throws IOException { Configuration conf = e.getConfiguration(); Class builderClass =
[29/50] [abbrv] phoenix git commit: PHOENIX-1973 Improve CsvBulkLoadTool performance by moving keyvalue construction from map phase to reduce phase(Sergey Soldatov)
PHOENIX-1973 Improve CsvBulkLoadTool performance by moving keyvalue construction from map phase to reduce phase(Sergey Soldatov) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e797b36c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e797b36c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e797b36c Branch: refs/heads/calcite Commit: e797b36c2ce42e9b9fd6b37fd8b9f79f79d6f18f Parents: 60ef7cd Author: Rajeshbabu ChintaguntlaAuthored: Tue Feb 16 12:12:23 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Tue Feb 16 12:12:23 2016 +0530 -- .../phoenix/mapreduce/AbstractBulkLoadTool.java | 6 +- .../mapreduce/FormatToKeyValueMapper.java | 164 --- .../mapreduce/FormatToKeyValueReducer.java | 127 -- .../bulkload/TargetTableRefFunctions.java | 22 ++- 4 files changed, 281 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e797b36c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java index 39ee4b1..ab2848f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java @@ -41,6 +41,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; @@ -268,7 +269,7 @@ public abstract class AbstractBulkLoadTool extends Configured implements Tool { job.setInputFormatClass(TextInputFormat.class); job.setMapOutputKeyClass(TableRowkeyPair.class); -job.setMapOutputValueClass(KeyValue.class); +job.setMapOutputValueClass(ImmutableBytesWritable.class); job.setOutputKeyClass(TableRowkeyPair.class); job.setOutputValueClass(KeyValue.class); job.setReducerClass(FormatToKeyValueReducer.class); @@ -276,7 +277,10 @@ public abstract class AbstractBulkLoadTool extends Configured implements Tool { MultiHfileOutputFormat.configureIncrementalLoad(job, tablesToBeLoaded); final String tableNamesAsJson = TargetTableRefFunctions.NAMES_TO_JSON.apply(tablesToBeLoaded); +final String logicalNamesAsJson = TargetTableRefFunctions.LOGICAN_NAMES_TO_JSON.apply(tablesToBeLoaded); + job.getConfiguration().set(FormatToKeyValueMapper.TABLE_NAMES_CONFKEY,tableNamesAsJson); + job.getConfiguration().set(FormatToKeyValueMapper.LOGICAL_NAMES_CONFKEY,logicalNamesAsJson); // give subclasses their hook setupJob(job); http://git-wip-us.apache.org/repos/asf/phoenix/blob/e797b36c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java index 7e115e5..95b099e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java @@ -17,30 +17,30 @@ */ package org.apache.phoenix.mapreduce; +import java.io.DataOutputStream; import java.io.IOException; import java.sql.SQLException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; import javax.annotation.Nullable; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; +import org.apache.hadoop.io.WritableUtils; import org.apache.hadoop.mapreduce.Mapper; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.mapreduce.bulkload.TableRowkeyPair; import org.apache.phoenix.mapreduce.bulkload.TargetTableRefFunctions; import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil; -import
[15/50] [abbrv] phoenix git commit: PHOENIX-2681 Avoid usage of HashSet<byte[]> in guideposts selection
PHOENIX-2681 Avoid usage of HashSetin guideposts selection Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/18f7a694 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/18f7a694 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/18f7a694 Branch: refs/heads/calcite Commit: 18f7a69452eec7fd5fde38953510600c4a060151 Parents: decbfe3 Author: James Taylor Authored: Thu Feb 11 20:09:16 2016 -0800 Committer: James Taylor Committed: Thu Feb 11 20:14:31 2016 -0800 -- .../phoenix/end2end/MultiCfQueryExecIT.java | 51 .../phoenix/iterate/BaseResultIterators.java| 35 ++ 2 files changed, 66 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/18f7a694/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java index f5566ce..2b14fe9 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java @@ -52,6 +52,7 @@ public class MultiCfQueryExecIT extends BaseOwnClusterClientManagedTimeIT { Map props = Maps.newHashMapWithExpectedSize(3); // Must update config before starting server props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20)); +props.put(QueryServices.QUEUE_SIZE_ATTRIB, Long.toString(200)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } @@ -184,6 +185,56 @@ public class MultiCfQueryExecIT extends BaseOwnClusterClientManagedTimeIT { } @Test +public void testGuidePostsForMultiCFsOverUnevenDistrib() throws Exception { +long ts = nextTimestamp(); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); +Connection conn = DriverManager.getConnection(getUrl(), props); + +conn.createStatement().execute("CREATE TABLE T_6CF (K1 CHAR(1) NOT NULL, " ++ "K2 VARCHAR NOT NULL, " ++ "CF1.A INTEGER, " ++ "CF2.B INTEGER, " ++ "CF3.C INTEGER, " ++ "CF4.D INTEGER, " ++ "CF5.E INTEGER, " ++ "CF6.F INTEGER " ++ "CONSTRAINT PK PRIMARY KEY (K1,K2)) SPLIT ON ('B','C','D')"); + +conn.close(); +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); +conn = DriverManager.getConnection(getUrl(), props); +for (int i = 0; i < 100; i++) { +String upsert = "UPSERT INTO T_6CF(K1,K2,A) VALUES('" + Character.toString((char)('A'+i%10)) + "','" + (i*10) + "'," + i + ")"; +conn.createStatement().execute(upsert); +if (i % 10 == 0) { +conn.createStatement().execute("UPSERT INTO T_6CF(K1,K2,F) VALUES('" + Character.toString((char)('A'+i%10)) + "','" + (i*10) + "'," + (i * 10) + ")"); +} +} +conn.commit(); +conn.close(); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +try { +analyzeTable(getUrl(), ts + 30, "T_6CF"); +PreparedStatement statement = conn.prepareStatement("select count(*) from T_6CF where f < 400"); +ResultSet rs = statement.executeQuery(); +assertTrue(rs.next()); +assertEquals(4, rs.getLong(1)); +assertFalse(rs.next()); +List splits = getAllSplits(conn, "T_6CF", "f < 400", "COUNT(*)"); +// Uses less populated column f +assertEquals(14, splits.size()); +// Uses more populated column a +splits = getAllSplits(conn, "T_6CF", "a < 80", "COUNT(*)"); +assertEquals(104, splits.size()); +} finally { +conn.close(); +} +} + +@Test public void testGuidePostsRetrievedForMultiCF() throws Exception { Connection conn; PreparedStatement stmt; http://git-wip-us.apache.org/repos/asf/phoenix/blob/18f7a694/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
[11/50] [abbrv] phoenix git commit: PHOENIX-2656 Shield Phoenix from Tephra repackaging
PHOENIX-2656 Shield Phoenix from Tephra repackaging Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d5518f02 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d5518f02 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d5518f02 Branch: refs/heads/calcite Commit: d5518f02d85e2cd92955377fc3934a266eaa1fa6 Parents: 1c3a86d Author: Thomas D'SilvaAuthored: Mon Feb 8 14:22:25 2016 -0800 Committer: Thomas D'Silva Committed: Mon Feb 8 18:02:25 2016 -0800 -- .../phoenix/end2end/AlterTableWithViewsIT.java | 7 +- .../org/apache/phoenix/tx/TransactionIT.java| 12 +- .../coprocessor/DelegateRegionObserver.java | 562 +++ .../PhoenixTransactionalProcessor.java | 28 + .../query/ConnectionQueryServicesImpl.java | 12 +- 5 files changed, 605 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5518f02/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java index e3d78ea..f1816cc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java @@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.compile.QueryPlan; +import org.apache.phoenix.coprocessor.PhoenixTransactionalProcessor; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; @@ -58,8 +59,6 @@ import org.apache.phoenix.util.SchemaUtil; import org.junit.BeforeClass; import org.junit.Test; -import co.cask.tephra.hbase11.coprocessor.TransactionProcessor; - import com.google.common.base.Objects; import com.google.common.collect.Maps; @@ -1126,7 +1125,7 @@ public class AlterTableWithViewsIT extends BaseHBaseManagedTimeIT { assertTableDefinition(conn, "VIEWOFTABLE", PTableType.VIEW, "TABLEWITHVIEW", 0, 5, 3, "ID", "COL1", "COL2", "VIEW_COL1", "VIEW_COL2"); HTableInterface htable = conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes("TABLEWITHVIEW")); - assertFalse(htable.getTableDescriptor().getCoprocessors().contains(TransactionProcessor.class.getName())); + assertFalse(htable.getTableDescriptor().getCoprocessors().contains(PhoenixTransactionalProcessor.class.getName())); assertFalse(conn.unwrap(PhoenixConnection.class).getTable(new PTableKey(null, "TABLEWITHVIEW")).isTransactional()); assertFalse(conn.unwrap(PhoenixConnection.class).getTable(new PTableKey(null, "VIEWOFTABLE")).isTransactional()); @@ -1135,7 +1134,7 @@ public class AlterTableWithViewsIT extends BaseHBaseManagedTimeIT { // query the view to force the table cache to be updated conn.createStatement().execute("SELECT * FROM VIEWOFTABLE"); htable = conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes("TABLEWITHVIEW")); - assertTrue(htable.getTableDescriptor().getCoprocessors().contains(TransactionProcessor.class.getName())); + assertTrue(htable.getTableDescriptor().getCoprocessors().contains(PhoenixTransactionalProcessor.class.getName())); assertTrue(conn.unwrap(PhoenixConnection.class).getTable(new PTableKey(null, "TABLEWITHVIEW")).isTransactional()); assertTrue(conn.unwrap(PhoenixConnection.class).getTable(new PTableKey(null, "VIEWOFTABLE")).isTransactional()); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5518f02/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java index 1bf313b..1fd9828 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java @@ -45,6 +45,7 @@ import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; +import org.apache.phoenix.coprocessor.PhoenixTransactionalProcessor; import
[13/50] [abbrv] phoenix git commit: PHOENIX-2665 index split while running group by query is returning duplicate results(Rajeshbabu)
PHOENIX-2665 index split while running group by query is returning duplicate results(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c48fee04 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c48fee04 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c48fee04 Branch: refs/heads/calcite Commit: c48fee04e75fc9d08af981f1a2cc257e6cecdbdc Parents: c485a40 Author: Rajeshbabu ChintaguntlaAuthored: Thu Feb 11 02:38:48 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Thu Feb 11 02:38:48 2016 +0530 -- .../java/org/apache/phoenix/compile/ScanRanges.java | 2 ++ .../phoenix/coprocessor/BaseScannerRegionObserver.java | 4 +++- .../org/apache/phoenix/iterate/BaseResultIterators.java | 12 +++- 3 files changed, 12 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c48fee04/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java index 4d343f3..719970a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.compile; +import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW; import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.STARTKEY_OFFSET; import java.io.IOException; @@ -384,6 +385,7 @@ public class ScanRanges { if (scanStopKey.length > 0 && Bytes.compareTo(scanStartKey, scanStopKey) >= 0) { return null; } +newScan.setAttribute(SCAN_ACTUAL_START_ROW, scanStartKey); newScan.setStartRow(scanStartKey); newScan.setStopRow(scanStopKey); if(keyOffset > 0) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/c48fee04/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java index a363459..9487b36 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java @@ -97,6 +97,7 @@ abstract public class BaseScannerRegionObserver extends BaseRegionObserver { public static final String RUN_UPDATE_STATS_ASYNC_ATTRIB = "_RunUpdateStatsAsync"; public static final String SKIP_REGION_BOUNDARY_CHECK = "_SKIP_REGION_BOUNDARY_CHECK"; public static final String TX_SCN = "_TxScn"; +public static final String SCAN_ACTUAL_START_ROW = "_ScanActualStartRow"; /** * Attribute name used to pass custom annotations in Scans and Mutations (later). Custom annotations @@ -137,7 +138,8 @@ abstract public class BaseScannerRegionObserver extends BaseRegionObserver { Bytes.compareTo(upperExclusiveRegionKey, expectedUpperRegionKey) != 0; } else { isStaleRegionBoundaries = Bytes.compareTo(lowerInclusiveScanKey, lowerInclusiveRegionKey) < 0 || -( Bytes.compareTo(upperExclusiveScanKey, upperExclusiveRegionKey) > 0 && upperExclusiveRegionKey.length != 0); +( Bytes.compareTo(upperExclusiveScanKey, upperExclusiveRegionKey) > 0 && upperExclusiveRegionKey.length != 0) || +(upperExclusiveRegionKey.length != 0 && upperExclusiveScanKey.length == 0); } if (isStaleRegionBoundaries) { Exception cause = new StaleRegionBoundaryCacheException(region.getRegionInfo().getTable().getNameAsString()); http://git-wip-us.apache.org/repos/asf/phoenix/blob/c48fee04/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index b3235e2..3a3d1f2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -21,6 +21,7 @@ import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.EXPECTED_ import static
[34/50] [abbrv] phoenix git commit: PHOENIX-2119 Do not copy underlying HBase configuration properties when connection properties are supplied
PHOENIX-2119 Do not copy underlying HBase configuration properties when connection properties are supplied Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9e2b4339 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9e2b4339 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9e2b4339 Branch: refs/heads/calcite Commit: 9e2b4339242588f36a71a3920b36b2e2c7867d2d Parents: d8e5a73 Author: James TaylorAuthored: Tue Feb 16 12:55:21 2016 -0800 Committer: James Taylor Committed: Wed Feb 17 09:14:12 2016 -0800 -- .../main/java/org/apache/phoenix/jdbc/PhoenixConnection.java | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9e2b4339/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java index 82bf31a..215d815 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java @@ -58,8 +58,6 @@ import java.util.concurrent.LinkedBlockingQueue; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import co.cask.tephra.TransactionContext; - import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Consistency; import org.apache.htrace.Sampler; @@ -76,7 +74,6 @@ import org.apache.phoenix.iterate.ParallelIteratorFactory; import org.apache.phoenix.iterate.TableResultIterator; import org.apache.phoenix.iterate.TableResultIteratorFactory; import org.apache.phoenix.jdbc.PhoenixStatement.PhoenixStatementParser; -import org.apache.phoenix.monitoring.GlobalClientMetrics; import org.apache.phoenix.parse.PFunction; import org.apache.phoenix.query.ConnectionQueryServices; import org.apache.phoenix.query.DelegateConnectionQueryServices; @@ -119,6 +116,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.Lists; +import co.cask.tephra.TransactionContext; + /** * @@ -304,7 +303,7 @@ public class PhoenixConnection implements Connection, MetaDataMutated, SQLClosea private static Properties filterKnownNonProperties(Properties info) { Properties prunedProperties = info; for (String property : PhoenixRuntime.CONNECTION_PROPERTIES) { -if (info.contains(property)) { +if (info.containsKey(property)) { if (prunedProperties == info) { prunedProperties = PropertiesUtil.deepCopy(info); }
[04/50] [abbrv] phoenix git commit: PHOENIX-2647 Duplicate results in reverse scan when guideposts are traversed (Ankit Singhal)
PHOENIX-2647 Duplicate results in reverse scan when guideposts are traversed (Ankit Singhal) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b64edb75 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b64edb75 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b64edb75 Branch: refs/heads/calcite Commit: b64edb75455d56fc2a5086043bdd6fa1064f2ca7 Parents: a82a0ff Author: Ankit SinghalAuthored: Fri Feb 5 23:45:04 2016 +0530 Committer: Ankit Singhal Committed: Fri Feb 5 23:45:04 2016 +0530 -- .../apache/phoenix/end2end/ReverseScanIT.java | 21 + .../phoenix/end2end/StatsCollectorIT.java | 28 +++ .../java/org/apache/phoenix/util/ScanUtil.java | 49 ++-- 3 files changed, 64 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b64edb75/phoenix-core/src/it/java/org/apache/phoenix/end2end/ReverseScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ReverseScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ReverseScanIT.java index 35a8025..2722be1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ReverseScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ReverseScanIT.java @@ -168,6 +168,27 @@ public class ReverseScanIT extends BaseHBaseManagedTimeIT { } @Test +public void testReverseScanForSpecificRangeInRegion() throws Exception { +Connection conn; +ResultSet rs; +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +conn = DriverManager.getConnection(getUrl(), props); +conn.createStatement() +.execute("CREATE TABLE T" + " ( k VARCHAR, c1.a bigint,c2.b bigint CONSTRAINT pk PRIMARY KEY (k)) "); +conn.createStatement().execute("upsert into T values ('a',1,3)"); +conn.createStatement().execute("upsert into T values ('b',1,3)"); +conn.createStatement().execute("upsert into T values ('c',1,3)"); +conn.createStatement().execute("upsert into T values ('d',1,3)"); +conn.createStatement().execute("upsert into T values ('e',1,3)"); +conn.commit(); +rs = conn.createStatement().executeQuery("SELECT k FROM T where k>'b' and k<'d' order by k desc"); +assertTrue(rs.next()); +assertEquals("c", rs.getString(1)); +assertTrue(!rs.next()); +conn.close(); +} + +@Test public void testReverseScanIndex() throws Exception { String tenantId = getOrganizationId(); initATableValues(tenantId, getSplitsAtRowKeys(tenantId), getUrl()); http://git-wip-us.apache.org/repos/asf/phoenix/blob/b64edb75/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java index caba259..4450152 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java @@ -123,31 +123,41 @@ public class StatsCollectorIT extends StatsCollectorAbstractIT { conn.close(); } -@Test -public void testNoDuplicatesAfterUpdateStats() throws Throwable { +private void testNoDuplicatesAfterUpdateStats(String splitKey) throws Throwable { Connection conn; PreparedStatement stmt; ResultSet rs; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); conn = DriverManager.getConnection(getUrl(), props); conn.createStatement() -.execute("CREATE TABLE " + fullTableName +" ( k VARCHAR, c1.a bigint,c2.b bigint CONSTRAINT pk PRIMARY KEY (k))" + tableDDLOptions ); -conn.createStatement().execute("upsert into " + fullTableName +" values ('abc',1,3)"); -conn.createStatement().execute("upsert into " + fullTableName +" values ('def',2,4)"); +.execute("CREATE TABLE " + fullTableName ++ " ( k VARCHAR, c1.a bigint,c2.b bigint CONSTRAINT pk PRIMARY KEY (k)) " ++ (splitKey != null ? "split on (" + splitKey + ")" : "")); +conn.createStatement().execute("upsert into " + fullTableName + " values ('abc',1,3)"); +conn.createStatement().execute("upsert into " + fullTableName + " values ('def',2,4)"); conn.commit(); -// CAll the update statistics query here stmt = conn.prepareStatement("UPDATE STATISTICS " + fullTableName);
[35/50] [abbrv] phoenix git commit: PHOENIX-2631 Exception when parsing boundary timestamp values
PHOENIX-2631 Exception when parsing boundary timestamp values Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/818683aa Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/818683aa Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/818683aa Branch: refs/heads/calcite Commit: 818683aac866fe31b48135209158c84942a80fb6 Parents: 9e2b433 Author: James TaylorAuthored: Tue Feb 16 13:01:45 2016 -0800 Committer: James Taylor Committed: Wed Feb 17 09:14:13 2016 -0800 -- .../end2end/ClientTimeArithmeticQueryIT.java| 11 +- .../org/apache/phoenix/end2end/DateTimeIT.java | 5 +- .../apache/phoenix/end2end/DistinctCountIT.java | 2 +- .../apache/phoenix/end2end/PercentileIT.java| 2 +- .../phoenix/end2end/ProductMetricsIT.java | 6 +- .../phoenix/end2end/RowValueConstructorIT.java | 4 +- .../phoenix/end2end/VariableLengthPKIT.java | 2 +- .../end2end/index/IndexExpressionIT.java| 7 +- .../apache/phoenix/end2end/index/IndexIT.java | 5 +- .../apache/phoenix/schema/types/PDataType.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 407 +++ .../phoenix/compile/WhereOptimizerTest.java | 5 +- .../java/org/apache/phoenix/query/BaseTest.java | 7 +- .../org/apache/phoenix/query/QueryPlanTest.java | 24 +- .../phoenix/schema/types/PDataTypeTest.java | 60 +++ .../java/org/apache/phoenix/util/TestUtil.java | 7 +- 16 files changed, 344 insertions(+), 213 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/818683aa/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java index e617673..8347370 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java @@ -19,9 +19,9 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.query.QueryConstants.MILLIS_IN_DAY; import static org.apache.phoenix.util.TestUtil.B_VALUE; import static org.apache.phoenix.util.TestUtil.E_VALUE; -import static org.apache.phoenix.util.TestUtil.MILLIS_IN_DAY; import static org.apache.phoenix.util.TestUtil.ROW1; import static org.apache.phoenix.util.TestUtil.ROW2; import static org.apache.phoenix.util.TestUtil.ROW3; @@ -51,7 +51,6 @@ import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; -import org.apache.phoenix.util.TestUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -614,10 +613,10 @@ public class ClientTimeArithmeticQueryIT extends BaseQueryIT { statement.setDate(3, date); statement.execute(); statement.setString(2, ROW4); -statement.setDate(3, new Date(date.getTime() + TestUtil.MILLIS_IN_DAY - 1)); +statement.setDate(3, new Date(date.getTime() + MILLIS_IN_DAY - 1)); statement.execute(); statement.setString(2, ROW6); -statement.setDate(3, new Date(date.getTime() + TestUtil.MILLIS_IN_DAY - 1)); +statement.setDate(3, new Date(date.getTime() + MILLIS_IN_DAY - 1)); statement.execute(); statement.setString(2, ROW9); statement.setDate(3, date); @@ -738,7 +737,7 @@ public class ClientTimeArithmeticQueryIT extends BaseQueryIT { conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT ts + 1 FROM time_table"); assertTrue(rs.next()); - assertEquals(time.getTime() + TestUtil.MILLIS_IN_DAY,rs.getTimestamp(1).getTime()); + assertEquals(time.getTime() + MILLIS_IN_DAY,rs.getTimestamp(1).getTime()); } @Test @@ -772,7 +771,7 @@ public class ClientTimeArithmeticQueryIT extends BaseQueryIT { conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT ts - 1 FROM time_table"); assertTrue(rs.next()); - assertEquals(time.getTime() - TestUtil.MILLIS_IN_DAY,rs.getTimestamp(1).getTime()); + assertEquals(time.getTime() - MILLIS_IN_DAY,rs.getTimestamp(1).getTime()); } @Test http://git-wip-us.apache.org/repos/asf/phoenix/blob/818683aa/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java -- diff --git
[27/50] [abbrv] phoenix git commit: PHOENIX-2684 LiteralExpression.getBooleanLiteralExpression should compare with .equals() (Julian Eberius)
PHOENIX-2684 LiteralExpression.getBooleanLiteralExpression should compare with .equals() (Julian Eberius) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/60ef7cd5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/60ef7cd5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/60ef7cd5 Branch: refs/heads/calcite Commit: 60ef7cd54e26fd1635e503c7d7981ba2cdf4c6fc Parents: 43b34da Author: James TaylorAuthored: Mon Feb 15 09:50:43 2016 -0800 Committer: James Taylor Committed: Mon Feb 15 10:14:58 2016 -0800 -- .../phoenix/end2end/CompareDecimalToLongIT.java | 241 -- .../apache/phoenix/end2end/PrimitiveTypeIT.java | 245 +++ .../phoenix/expression/LiteralExpression.java | 2 +- .../java/org/apache/phoenix/query/BaseTest.java | 14 +- 4 files changed, 252 insertions(+), 250 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/60ef7cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/CompareDecimalToLongIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CompareDecimalToLongIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CompareDecimalToLongIT.java deleted file mode 100644 index 3a358c4..000 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CompareDecimalToLongIT.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.Properties; - -import org.apache.phoenix.util.PhoenixRuntime; -import org.junit.Test; - - -public class CompareDecimalToLongIT extends BaseClientManagedTimeIT { -protected static void initTableValues(byte[][] splits, long ts) throws Exception { -ensureTableCreated(getUrl(),"LongInKeyTest",splits, ts-2); - -// Insert all rows at ts -String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; -Connection conn = DriverManager.getConnection(url); -conn.setAutoCommit(true); -PreparedStatement stmt = conn.prepareStatement( -"upsert into " + -"LongInKeyTest VALUES(?)"); -stmt.setLong(1, 2); -stmt.execute(); -conn.close(); -} - -@Test -public void testCompareLongGTDecimal() throws Exception { -long ts = nextTimestamp(); -initTableValues(null, ts); -String query = "SELECT l FROM LongInKeyTest where l > 1.5"; -Properties props = new Properties(); -props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 -Connection conn = DriverManager.getConnection(getUrl(), props); -try { -PreparedStatement statement = conn.prepareStatement(query); -ResultSet rs = statement.executeQuery(); -assertTrue (rs.next()); -assertEquals(2, rs.getLong(1)); -assertFalse(rs.next()); -} finally { -conn.close(); -} -} - -@Test -public void testCompareLongGTEDecimal() throws Exception { -long ts = nextTimestamp(); -initTableValues(null, ts); -String query = "SELECT l FROM LongInKeyTest where l >= 1.5"; -Properties props = new Properties(); -props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 -Connection conn = DriverManager.getConnection(getUrl(), props); -try { -PreparedStatement statement = conn.prepareStatement(query); -ResultSet rs = statement.executeQuery(); -/* - * Failing because we're
[25/50] [abbrv] phoenix git commit: PHOENIX-2221 Option to make data regions not writable when index regions are not available (Alicia Ying Shu, James Taylor)
PHOENIX-2221 Option to make data regions not writable when index regions are not available (Alicia Ying Shu, James Taylor) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e2a6386f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e2a6386f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e2a6386f Branch: refs/heads/calcite Commit: e2a6386f3b9343aec74c5f96f0e0124e80b9f8b1 Parents: 6881aef Author: James TaylorAuthored: Sun Feb 14 09:06:14 2016 -0800 Committer: James Taylor Committed: Mon Feb 15 00:33:18 2016 -0800 -- .../end2end/index/MutableIndexFailureIT.java| 31 +- .../end2end/index/ReadOnlyIndexFailureIT.java | 289 +++ .../apache/phoenix/compile/FromCompiler.java| 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../compile/TupleProjectionCompiler.java| 4 +- .../apache/phoenix/compile/UnionCompiler.java | 2 +- .../coprocessor/MetaDataEndpointImpl.java | 92 +++--- .../coprocessor/MetaDataRegionObserver.java | 27 +- .../coprocessor/generated/PTableProtos.java | 103 ++- .../phoenix/exception/SQLExceptionCode.java | 2 + .../apache/phoenix/execute/MutationState.java | 39 ++- .../index/write/DelegateIndexFailurePolicy.java | 58 .../index/PhoenixIndexFailurePolicy.java| 48 ++- .../org/apache/phoenix/query/QueryServices.java | 3 + .../phoenix/query/QueryServicesOptions.java | 1 + .../apache/phoenix/schema/DelegateTable.java| 5 + .../apache/phoenix/schema/MetaDataClient.java | 38 +-- .../java/org/apache/phoenix/schema/PTable.java | 1 + .../org/apache/phoenix/schema/PTableImpl.java | 51 ++-- .../phoenix/execute/CorrelatePlanTest.java | 2 +- phoenix-protocol/src/main/PTable.proto | 1 + 21 files changed, 660 insertions(+), 141 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e2a6386f/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java index 5f39515..176c5a0 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java @@ -172,7 +172,7 @@ public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { TableName indexTable = TableName.valueOf(localIndex ? MetaDataUtil .getLocalIndexTableName(fullTableName) : fullIndexName); -HBaseAdmin admin = this.getUtility().getHBaseAdmin(); +HBaseAdmin admin = getUtility().getHBaseAdmin(); HTableDescriptor indexTableDesc = admin.getTableDescriptor(indexTable); try{ admin.disableTable(indexTable); @@ -184,20 +184,10 @@ public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { stmt.setString(2, "x2"); stmt.setString(3, "2"); stmt.execute(); -if (transactional) { -try { -conn.commit(); -fail(); -} catch (SQLException e) { -conn.rollback(); -} -} -else { -try { -conn.commit(); -fail(); -} catch (SQLException e) { -} +try { +conn.commit(); +fail(); +} catch (SQLException e) { } // Verify the metadata for index is correct. @@ -341,9 +331,9 @@ public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { // find a RS which doesn't has CATALOG table TableName catalogTable = TableName.valueOf("SYSTEM.CATALOG"); TableName indexTable = TableName.valueOf(fullIndexName); -final HBaseCluster cluster = this.getUtility().getHBaseCluster(); +final HBaseCluster cluster = getUtility().getHBaseCluster(); Collection rss = cluster.getClusterStatus().getServers(); -HBaseAdmin admin = this.getUtility().getHBaseAdmin(); +HBaseAdmin admin = getUtility().getHBaseAdmin(); List regions = admin.getTableRegions(catalogTable); ServerName catalogRS = cluster.getServerHoldingRegion(regions.get(0).getTable(), regions.get(0).getRegionName()); @@ -363,7 +353,7 @@ public
[01/50] [abbrv] phoenix git commit: PHOENIX-2649 - GC/OOM during BulkLoad
Repository: phoenix Updated Branches: refs/heads/calcite 69a2f2437 -> 9ac854ae5 PHOENIX-2649 - GC/OOM during BulkLoad Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/12f6a6f4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/12f6a6f4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/12f6a6f4 Branch: refs/heads/calcite Commit: 12f6a6f48c4a4739e09f1842d885d53e2e5550e2 Parents: 5c25a72 Author: ravimaghamAuthored: Wed Feb 3 14:15:16 2016 -0800 Committer: ravimagham Committed: Wed Feb 3 14:15:16 2016 -0800 -- .../mapreduce/bulkload/TableRowkeyPair.java | 41 +++- .../mapreduce/bulkload/TestTableRowkeyPair.java | 67 2 files changed, 75 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/12f6a6f4/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java index 412226f..e3032be 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/bulkload/TableRowkeyPair.java @@ -84,6 +84,13 @@ public class TableRowkeyPair implements WritableComparable { WritableUtils.writeString(output,tableName); rowkey.write(output); } + +@Override +public int hashCode() { +int result = this.tableName.hashCode(); +result = 31 * result + this.rowkey.hashCode(); +return result; +} @Override public int compareTo(TableRowkeyPair other) { @@ -95,40 +102,8 @@ public class TableRowkeyPair implements WritableComparable { } } -/** Comparator optimized for TableRowkeyPair. */ -public static class Comparator extends WritableComparator { -private BytesWritable.Comparator comparator = new BytesWritable.Comparator(); - -public Comparator() { -super(TableRowkeyPair.class); -} - -@Override -public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { -try { -int vintL1 = WritableUtils.decodeVIntSize(b1[s1]); -int vintL2 = WritableUtils.decodeVIntSize(b2[s2]); -int strL1 = readVInt(b1, s1); -int strL2 = readVInt(b2, s2); -int cmp = compareBytes(b1, s1 + vintL1, strL1, b2, s2 + vintL2, strL2); -if (cmp != 0) { - return cmp; -} -int vintL3 = WritableUtils.decodeVIntSize(b1[s1 + vintL1 + strL1]); -int vintL4 = WritableUtils.decodeVIntSize(b2[s2 + vintL2 + strL2]); -int strL3 = readVInt(b1, s1 + vintL1 + strL1); -int strL4 = readVInt(b2, s2 + vintL2 + strL2); -return comparator.compare(b1, s1 + vintL1 + strL1 + vintL3, strL3, b2, s2 -+ vintL2 + strL2 + vintL4, strL4); - -} catch(Exception ex) { -throw new IllegalArgumentException(ex); -} -} -} - static { -WritableComparator.define(TableRowkeyPair.class, new Comparator()); +WritableComparator.define(TableRowkeyPair.class, new BytesWritable.Comparator()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/12f6a6f4/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java -- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java b/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java new file mode 100644 index 000..1fee4bb --- /dev/null +++ b/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/bulkload/TestTableRowkeyPair.java @@ -0,0 +1,67 @@ +/* + * 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
[50/50] [abbrv] phoenix git commit: 1. Expose and correct (new issue to be opened) the byte estimate interface from ResultIterators and apply it in costing; 2. Remove walk-around for PHOENIX-2647 and
1. Expose and correct (new issue to be opened) the byte estimate interface from ResultIterators and apply it in costing; 2. Remove walk-around for PHOENIX-2647 and verify the tests all work; 3. Apply temporary fix for PHOENIX-2712 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9ac854ae Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9ac854ae Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9ac854ae Branch: refs/heads/calcite Commit: 9ac854ae5335a00d2a61ec6f1929ebc64e7137e2 Parents: bc4b891 Author: maryannxue <maryann@gmail.com> Authored: Wed Feb 24 16:12:25 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Wed Feb 24 16:12:25 2016 -0500 -- .../apache/phoenix/calcite/BaseCalciteIT.java | 52 -- .../org/apache/phoenix/calcite/CalciteIT.java | 163 ++- .../apache/phoenix/calcite/CalciteIndexIT.java | 36 ++-- .../phoenix/calcite/rel/PhoenixTableScan.java | 74 + .../org/apache/phoenix/execute/ScanPlan.java| 5 + .../phoenix/iterate/BaseResultIterators.java| 12 +- .../apache/phoenix/iterate/ResultIterators.java | 1 + .../phoenix/iterate/UnionResultIterators.java | 5 + .../apache/phoenix/schema/MetaDataClient.java | 3 + .../iterate/AggregateResultScannerTest.java | 5 + .../iterate/ConcatResultIteratorTest.java | 10 ++ .../iterate/MergeSortResultIteratorTest.java| 15 ++ 12 files changed, 204 insertions(+), 177 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ac854ae/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java index 35c46e7..65a9c6e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java @@ -168,14 +168,28 @@ public class BaseCalciteIT extends BaseClientManagedTimeIT { start.close(); } -public Sql resultIs(boolean ordered, Object[][] expected) throws SQLException { +public Sql resultIs(Object[][] expected) throws SQLException { final Statement statement = start.getConnection().createStatement(); final ResultSet resultSet = statement.executeQuery(sql); -if (ordered) { -checkResultOrdered(resultSet, expected); -} else { -checkResultUnordered(resultSet, expected); -} +checkResultOrdered(resultSet, expected); +resultSet.close(); +statement.close(); +return this; +} + +public Sql resultIs(int orderedCount, Object[][] expected) throws SQLException { +final Statement statement = start.getConnection().createStatement(); +final ResultSet resultSet = statement.executeQuery(sql); +checkResultUnordered(resultSet, expected, orderedCount, null); +resultSet.close(); +statement.close(); +return this; +} + +public Sql resultIsSomeOf(int count, Object[][] expected) throws SQLException { +final Statement statement = start.getConnection().createStatement(); +final ResultSet resultSet = statement.executeQuery(sql); +checkResultUnordered(resultSet, expected, 0, count); resultSet.close(); statement.close(); return this; @@ -198,21 +212,28 @@ public class BaseCalciteIT extends BaseClientManagedTimeIT { assertFalse("Got more rows than expected.", resultSet.next()); } -private void checkResultUnordered(ResultSet resultSet, Object[][] expected) throws SQLException { +private void checkResultUnordered(ResultSet resultSet, Object[][] expected, int orderedCount, Integer checkContains) throws SQLException { List<List> expectedResults = Lists.newArrayList(); List<List> actualResults = Lists.newArrayList(); List<List> errorResults = Lists.newArrayList(); int columnCount = expected.length > 0 ? expected[0].length : 0; for (Object[] e : expected) { List row = Lists.newArrayList(); -for (Object o : e) { -row.add(canonicalize(o)); +for (int i = orderedCount; i < e.length; i++) { +row.add(canonicalize(e[i])); } expectedResults.add(row); } while (resultSet.n
phoenix git commit: PHOENIX-2678 Replace calcite default RelOptCostFactory
Repository: phoenix Updated Branches: refs/heads/calcite 52ba5d24d -> 69a2f2437 PHOENIX-2678 Replace calcite default RelOptCostFactory Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/69a2f243 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/69a2f243 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/69a2f243 Branch: refs/heads/calcite Commit: 69a2f2437bf0d6513d3f6c46ec34094279f0f411 Parents: 52ba5d2 Author: maryannxue <maryann@gmail.com> Authored: Sat Feb 13 22:53:03 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Sat Feb 13 22:53:03 2016 -0500 -- .../org/apache/phoenix/calcite/CalciteIT.java | 8 +- .../apache/phoenix/calcite/CalciteIndexIT.java | 2 +- .../calcite/jdbc/PhoenixPrepareImpl.java| 2 + .../phoenix/calcite/plan/PhoenixCost.java | 227 +++ .../calcite/rel/PhoenixAbstractAggregate.java | 2 +- .../calcite/rel/PhoenixAbstractSort.java| 2 +- .../calcite/rel/PhoenixClientAggregate.java | 3 +- .../phoenix/calcite/rel/PhoenixClientJoin.java | 4 +- .../calcite/rel/PhoenixClientProject.java | 3 +- .../calcite/rel/PhoenixClientSemiJoin.java | 4 +- .../phoenix/calcite/rel/PhoenixClientSort.java | 3 +- .../calcite/rel/PhoenixCompactClientSort.java | 3 +- .../phoenix/calcite/rel/PhoenixCorrelate.java | 21 +- .../phoenix/calcite/rel/PhoenixFilter.java | 4 +- .../phoenix/calcite/rel/PhoenixLimit.java | 4 +- .../calcite/rel/PhoenixMergeSortUnion.java | 4 +- .../apache/phoenix/calcite/rel/PhoenixRel.java | 7 - .../calcite/rel/PhoenixServerAggregate.java | 3 +- .../phoenix/calcite/rel/PhoenixServerJoin.java | 4 +- .../calcite/rel/PhoenixServerProject.java | 3 +- .../calcite/rel/PhoenixServerSemiJoin.java | 4 +- .../phoenix/calcite/rel/PhoenixServerSort.java | 3 +- .../phoenix/calcite/rel/PhoenixTableScan.java | 6 +- .../phoenix/calcite/rel/PhoenixUncollect.java | 15 +- .../phoenix/calcite/rel/PhoenixUnion.java | 4 +- .../phoenix/calcite/rel/PhoenixValues.java | 5 +- .../calcite/rules/PhoenixConverterRules.java| 3 +- 27 files changed, 293 insertions(+), 60 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/69a2f243/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java index df6ac81..820c2d4 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java @@ -293,17 +293,17 @@ public class CalciteIT extends BaseCalciteIT { start(false, 1000f).sql("select t1.entity_id, t2.a_string, t3.organization_id from aTable t1 join aTable t2 on t1.entity_id = t2.entity_id and t1.organization_id = t2.organization_id join atable t3 on t1.entity_id = t3.entity_id and t1.organization_id = t3.organization_id") .explainIs("PhoenixToEnumerableConverter\n" + - " PhoenixClientProject(ENTITY_ID=[$1], A_STRING=[$6], ORGANIZATION_ID=[$2])\n" + - "PhoenixClientJoin(condition=[AND(=($1, $5), =($0, $4))], joinType=[inner])\n" + + " PhoenixClientProject(ENTITY_ID=[$1], A_STRING=[$4], ORGANIZATION_ID=[$5])\n" + + "PhoenixClientJoin(condition=[AND(=($1, $6), =($0, $5))], joinType=[inner])\n" + " PhoenixClientJoin(condition=[AND(=($1, $3), =($0, $2))], joinType=[inner])\n" + "PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n" + " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1])\n" + "PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + "PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n" + - " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1])\n" + + " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1], A_STRING=[$2])\n" + "PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + " PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n" + -
[1/2] phoenix git commit: PHOENIX-2090 Refine PhoenixTableScan.computeSelfCost() when scanRanges is available
Repository: phoenix Updated Branches: refs/heads/calcite 751d134be -> 8b68b1c4e http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b68b1c4/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java index f200a24..3f0f754 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java @@ -55,62 +55,71 @@ public class CalciteIndexIT extends BaseCalciteIT { initATableValues(getOrganizationId(), null, url); initSaltedTables(index); initMultiTenantTables(index); -final Connection connection = DriverManager.getConnection(url); +Connection connection = DriverManager.getConnection(url); connection.createStatement().execute("CREATE " + index + " IF NOT EXISTS IDX1 ON aTable (a_string) INCLUDE (b_string, x_integer)"); connection.createStatement().execute("CREATE " + index + " IF NOT EXISTS IDX2 ON aTable (b_string) INCLUDE (a_string, y_integer)"); connection.createStatement().execute("CREATE " + index + " IF NOT EXISTS IDX_FULL ON aTable (b_string) INCLUDE (a_string, a_integer, a_date, a_time, a_timestamp, x_decimal, x_long, x_integer, y_integer, a_byte, a_short, a_float, a_double, a_unsigned_float, a_unsigned_double)"); connection.createStatement().execute("UPDATE STATISTICS ATABLE"); +connection.createStatement().execute("UPDATE STATISTICS " + NOSALT_TABLE_NAME); connection.createStatement().execute("UPDATE STATISTICS " + SALTED_TABLE_NAME); -connection.createStatement().execute("UPDATE STATISTICS IDX_" + SALTED_TABLE_NAME); -connection.createStatement().execute("UPDATE STATISTICS IDX1"); -connection.createStatement().execute("UPDATE STATISTICS IDX2"); -connection.createStatement().execute("UPDATE STATISTICS IDX_FULL"); +connection.createStatement().execute("UPDATE STATISTICS " + MULTI_TENANT_TABLE); +connection.close(); + +Properties props = new Properties(); +props.setProperty("TenantId", "10"); +connection = DriverManager.getConnection(url, props); +connection.createStatement().execute("UPDATE STATISTICS " + MULTI_TENANT_VIEW1); +connection.close(); + +props.setProperty("TenantId", "20"); +connection = DriverManager.getConnection(url, props); +connection.createStatement().execute("UPDATE STATISTICS " + MULTI_TENANT_VIEW2); connection.close(); } @Test public void testIndex() throws Exception { -start(true).sql("select * from aTable where b_string = 'b'") +start(true, 1000f).sql("select * from aTable where b_string = 'b'") .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(ORGANIZATION_ID=[$1], ENTITY_ID=[$2], A_STRING=[$3], B_STRING=[$0], A_INTEGER=[$4], A_DATE=[$5], A_TIME=[$6], A_TIMESTAMP=[$7], X_DECIMAL=[$8], X_LONG=[$9], X_INTEGER=[$10], Y_INTEGER=[$11], A_BYTE=[$12], A_SHORT=[$13], A_FLOAT=[$14], A_DOUBLE=[$15], A_UNSIGNED_FLOAT=[$16], A_UNSIGNED_DOUBLE=[$17])\n" + "PhoenixTableScan(table=[[phoenix, IDX_FULL]], filter=[=($0, 'b')])\n") .close(); -start(true).sql("select x_integer from aTable") +start(true, 1000f).sql("select x_integer from aTable") .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(X_INTEGER=[$4])\n" + "PhoenixTableScan(table=[[phoenix, IDX1]])\n") .close(); -start(true).sql("select a_string from aTable order by a_string") +start(true, 1000f).sql("select a_string from aTable order by a_string") .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(A_STRING=[$0])\n" + "PhoenixTableScan(table=[[phoenix, IDX1]], scanOrder=[FORWARD])\n") .close(); -start(true).sql("select a_string from aTable order by organization_id") +start(true, 1000f).sql("select a_string from aTable order by organization_id") .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(A_STRING=[$2], ORGANIZATION_ID=[$0])\n" + "PhoenixTableScan(table=[[phoenix, ATABLE]], scanOrder=[FORWARD])\n") .close(); -start(true).sql("select a_integer from aTable order by a_string") +start(true, 1000f).sql("select a_integer from aTable order by a_string") .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerSort(sort0=[$1],
[2/2] phoenix git commit: PHOENIX-2090 Refine PhoenixTableScan.computeSelfCost() when scanRanges is available
PHOENIX-2090 Refine PhoenixTableScan.computeSelfCost() when scanRanges is available Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8b68b1c4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8b68b1c4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8b68b1c4 Branch: refs/heads/calcite Commit: 8b68b1c4e8a68ac70c058e9d568d98af95073fc9 Parents: 751d134 Author: maryannxue <maryann@gmail.com> Authored: Fri Feb 12 13:59:54 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Fri Feb 12 13:59:54 2016 -0500 -- .../apache/phoenix/calcite/BaseCalciteIT.java | 102 .../org/apache/phoenix/calcite/CalciteIT.java | 234 ++- .../apache/phoenix/calcite/CalciteIndexIT.java | 155 ++-- .../apache/phoenix/calcite/PhoenixTable.java| 68 +- .../calcite/metadata/PhoenixRelMdSize.java | 75 ++ .../metadata/PhoenixRelMetadataProvider.java| 1 + .../calcite/rel/PhoenixAbstractSort.java| 16 +- .../calcite/rel/PhoenixCompactClientSort.java | 2 +- .../apache/phoenix/calcite/rel/PhoenixRel.java | 7 +- .../phoenix/calcite/rel/PhoenixServerJoin.java | 4 +- .../calcite/rel/PhoenixServerSemiJoin.java | 4 +- .../phoenix/calcite/rel/PhoenixTableScan.java | 86 +-- .../coprocessor/MetaDataEndpointImpl.java | 20 +- .../phoenix/schema/stats/StatisticsUtil.java| 18 +- .../phoenix/schema/stats/StatisticsWriter.java | 2 +- 15 files changed, 510 insertions(+), 284 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b68b1c4/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java index 9afddab..35c46e7 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java @@ -32,6 +32,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import java.text.DecimalFormat; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -39,6 +40,7 @@ import java.util.Properties; import org.apache.calcite.avatica.util.ArrayImpl; import org.apache.calcite.config.CalciteConnectionProperty; +import org.apache.phoenix.calcite.rel.PhoenixRel; import org.apache.phoenix.end2end.BaseClientManagedTimeIT; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.TableAlreadyExistsException; @@ -59,8 +61,8 @@ public class BaseCalciteIT extends BaseClientManagedTimeIT { setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } -public static Start start(boolean materializationEnabled) { -return new Start(getConnectionProps(materializationEnabled)); +public static Start start(boolean materializationEnabled, float rowCountFactor) { +return new Start(getConnectionProps(materializationEnabled, rowCountFactor)); } public static Start start(Properties props) { @@ -308,7 +310,7 @@ public class BaseCalciteIT extends BaseClientManagedTimeIT { return connection; } -protected static Properties getConnectionProps(boolean enableMaterialization) { +protected static Properties getConnectionProps(boolean enableMaterialization, float rowCountFactor) { Properties props = new Properties(); props.setProperty( CalciteConnectionProperty.MATERIALIZATIONS_ENABLED.camelName(), @@ -316,6 +318,7 @@ public class BaseCalciteIT extends BaseClientManagedTimeIT { props.setProperty( CalciteConnectionProperty.CREATE_MATERIALIZATIONS.camelName(), Boolean.toString(false)); +props.setProperty(PhoenixRel.ROW_COUNT_FACTOR, Float.toString(rowCountFactor)); return props; } @@ -364,21 +367,13 @@ public class BaseCalciteIT extends BaseClientManagedTimeIT { PreparedStatement stmt = conn.prepareStatement( "UPSERT INTO " + NOSALT_TABLE_NAME + " VALUES(?, ?, ?, ?)"); -stmt.setInt(1, 1); -stmt.setInt(2, 2); -stmt.setInt(3, 3); -stmt.setInt(4, 4); -stmt.execute(); -stmt.setInt(1, 2); -stmt.setInt(2, 3); -stmt.setInt(3, 4); -stmt.setInt(4, 5); -stmt.execute(); -stmt.setInt(1, 3); -stmt.setInt(2, 4); -stmt.setInt(3, 5); -stmt.setInt(
phoenix git commit: PHOENIX-2090 Refine PhoenixTableScan.computeSelfCost() when scanRanges is available
Repository: phoenix Updated Branches: refs/heads/calcite 8b68b1c4e -> 52ba5d24d PHOENIX-2090 Refine PhoenixTableScan.computeSelfCost() when scanRanges is available Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/52ba5d24 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/52ba5d24 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/52ba5d24 Branch: refs/heads/calcite Commit: 52ba5d24d6217b0f619f3dd143142ef86cbab02e Parents: 8b68b1c Author: maryannxue <maryann@gmail.com> Authored: Fri Feb 12 21:43:12 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Fri Feb 12 21:43:12 2016 -0500 -- .../it/java/org/apache/phoenix/calcite/CalciteIndexIT.java | 2 +- .../main/java/org/apache/phoenix/calcite/PhoenixTable.java | 5 + .../phoenix/calcite/rel/PhoenixAbstractAggregate.java | 3 ++- .../java/org/apache/phoenix/calcite/rel/PhoenixRel.java | 2 +- .../org/apache/phoenix/calcite/rel/PhoenixTableScan.java| 9 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/52ba5d24/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java index 3f0f754..d1aea74 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java @@ -93,7 +93,7 @@ public class CalciteIndexIT extends BaseCalciteIT { " PhoenixServerProject(A_STRING=[$0])\n" + "PhoenixTableScan(table=[[phoenix, IDX1]], scanOrder=[FORWARD])\n") .close(); -start(true, 1000f).sql("select a_string from aTable order by organization_id") +start(true, 100f).sql("select a_string from aTable order by organization_id") .explainIs("PhoenixToEnumerableConverter\n" + " PhoenixServerProject(A_STRING=[$2], ORGANIZATION_ID=[$0])\n" + "PhoenixTableScan(table=[[phoenix, ATABLE]], scanOrder=[FORWARD])\n") http://git-wip-us.apache.org/repos/asf/phoenix/blob/52ba5d24/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java index 1539dcd..fea4c8a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java @@ -21,7 +21,6 @@ import org.apache.calcite.schema.impl.AbstractTable; import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.util.ImmutableBitSet; import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.phoenix.calcite.rel.PhoenixRel; import org.apache.phoenix.calcite.rel.PhoenixTableScan; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.QueryServices; @@ -185,9 +184,7 @@ public class PhoenixTable extends AbstractTable implements TranslatableTable { return new Statistic() { @Override public Double getRowCount() { -float f = pc.getQueryServices().getProps().getFloat( -PhoenixRel.ROW_COUNT_FACTOR, 1f); -return (double) (rowCount * f); +return (double) rowCount; } @Override http://git-wip-us.apache.org/repos/asf/phoenix/blob/52ba5d24/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractAggregate.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractAggregate.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractAggregate.java index 9d76f59..de9f0c2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractAggregate.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractAggregate.java @@ -105,6 +105,7 @@ abstract public class PhoenixAbstractAggregate extends Aggregate implements Phoe return planner.getCostFactory().makeInfiniteCost(); double rowCount = mq.getRowCount(this); +double bytesPerRow = mq.getAverageRowSize(this); if (isOrderedGroupBy) { rowCount = (rowCou
phoenix git commit: Update calcite dependence to 1.7.0-SNAPSHOT; Update test cases now that CALCITE-864 is in; Change calcite log level
Repository: phoenix Updated Branches: refs/heads/calcite 74409be82 -> 751d134be Update calcite dependence to 1.7.0-SNAPSHOT; Update test cases now that CALCITE-864 is in; Change calcite log level Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/751d134b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/751d134b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/751d134b Branch: refs/heads/calcite Commit: 751d134be13b7a2e40a9ed162bb2f80a05aef819 Parents: 74409be Author: maryannxue <maryann@gmail.com> Authored: Wed Feb 3 22:16:39 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Wed Feb 3 22:16:39 2016 -0500 -- .../org/apache/phoenix/calcite/CalciteIT.java | 79 +++- .../calcite/rules/PhoenixConverterRules.java| 4 - .../src/test/resources/log4j.properties | 1 + pom.xml | 2 +- 4 files changed, 46 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/751d134b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java index 41d0542..0d9e789 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java @@ -1014,41 +1014,50 @@ public class CalciteIT extends BaseCalciteIT { "PhoenixTableScan(table=[[phoenix, Join, OrderTable]])\n"; start(decorrelProps).sql(q4).explainIs(p4Decorrelated).resultIs(false, r4).close(); -// CALCITE-864 -//String q5 = "select \"order_id\" from " + JOIN_ITEM_TABLE_FULL_NAME + " i JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " o on o.\"item_id\" = i.\"item_id\" where quantity = (select max(quantity) from " + JOIN_ORDER_TABLE_FULL_NAME + " o2 JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i2 on o2.\"item_id\" = i2.\"item_id\" where i.\"supplier_id\" = i2.\"supplier_id\")"; -//Object [][] r5 = new Object[][] { -//{"003"}, -//{"005"}, -//{"004"}}; -//String p5Correlate = -//"PhoenixToEnumerableConverter\n" + -//" PhoenixClientProject(order_id=[$7])\n" + -//"PhoenixFilter(condition=[=($11, $14)])\n" + -//" PhoenixCorrelate(correlation=[$cor0], joinType=[LEFT], requiredColumns=[{5}])\n" + -//"PhoenixServerJoin(condition=[=($9, $0)], joinType=[inner])\n" + -//" PhoenixTableScan(table=[[phoenix, Join, ItemTable]])\n" + -//" PhoenixTableScan(table=[[phoenix, Join, OrderTable]])\n" + -//"PhoenixServerAggregate(group=[{}], EXPR$0=[MAX($4)])\n" + -//" PhoenixServerJoin(condition=[=($2, $7)], joinType=[inner])\n" + -//"PhoenixTableScan(table=[[phoenix, Join, OrderTable]])\n" + -//"PhoenixTableScan(table=[[phoenix, Join, ItemTable]], filter=[=($cor0.supplier_id, $5)])\n"; -//String p5Decorrelated = -//"PhoenixToEnumerableConverter\n" + -//" PhoenixClientProject(order_id=[$7])\n" + -//"PhoenixServerJoin(condition=[AND(=($9, $0), =($5, $14))], joinType=[inner])\n" + -//" PhoenixTableScan(table=[[phoenix, Join, ItemTable]])\n" + -//" PhoenixServerJoin(condition=[=($4, $8)], joinType=[inner])\n" + -//"PhoenixTableScan(table=[[phoenix, Join, OrderTable]])\n" + -//"PhoenixServerAggregate(group=[{14}], EXPR$0=[MAX($4)], isOrdered=[false])\n" + -//" PhoenixServerJoin(condition=[=($2, $7)], joinType=[inner])\n" + -//"PhoenixTableScan(table=[[phoenix, Join, OrderTable]])\n" + -//"PhoenixServerJoin(condition=[=($7, $5)], joinType=[inner])\n" + -//" PhoenixTableScan(table=[[phoenix, Join, ItemTable]])\n" + -//" PhoenixServerAggregate(group=[{5}], isOrde
[30/50] [abbrv] phoenix git commit: PHOENIX-2625 Add @Ignore tag for IndexLoadBalancerIT#testRoundRobinAssignmentDuringMasterStartUp
PHOENIX-2625 Add @Ignore tag for IndexLoadBalancerIT#testRoundRobinAssignmentDuringMasterStartUp Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a6cd4925 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a6cd4925 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a6cd4925 Branch: refs/heads/calcite Commit: a6cd49253de8d198c3772bbfa414cef9c361076d Parents: 5d61fb8 Author: SamarthAuthored: Fri Jan 22 13:15:33 2016 -0800 Committer: Samarth Committed: Fri Jan 22 13:15:33 2016 -0800 -- .../apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6cd4925/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java index 1fdc8cd..1bec821 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java @@ -54,6 +54,7 @@ import org.apache.phoenix.hbase.index.Indexer; import org.apache.phoenix.hbase.index.master.IndexMasterObserver; import org.apache.phoenix.util.ConfigUtil; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -389,6 +390,7 @@ public class IndexLoadBalancerIT { } +@Ignore // FIXME: PHOENIX-2625 @Test public void testRoundRobinAssignmentDuringMasterStartUp() throws Exception { MiniHBaseCluster cluster = UTIL.getHBaseCluster();
[17/50] [abbrv] phoenix git commit: PHOENIX-2589 Fix a few resource leaks, NULL dereference, NULL_RETURNS issues (Samarth Jain, Alicia Ying Shu)
PHOENIX-2589 Fix a few resource leaks, NULL dereference, NULL_RETURNS issues (Samarth Jain, Alicia Ying Shu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6911770e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6911770e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6911770e Branch: refs/heads/calcite Commit: 6911770e8a1d05775f3780f623ae01e9122d59f0 Parents: 6ecbbb2 Author: SamarthAuthored: Wed Jan 20 17:07:12 2016 -0800 Committer: Samarth Committed: Wed Jan 20 17:07:12 2016 -0800 -- .../query/ConnectionQueryServicesImpl.java | 20 +- .../apache/phoenix/schema/MetaDataClient.java | 235 ++- pom.xml | 1 + 3 files changed, 137 insertions(+), 119 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6911770e/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index a246e63..4522cf8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -3311,8 +3311,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement wait = false; } // It is guaranteed that this poll won't hang indefinitely because this is the -// only thread that removes items from the queue. -WeakReference connRef = connectionsQueue.poll(); +// only thread that removes items from the queue. Still adding a 1 ms timeout +// for sanity check. +WeakReference connRef = +connectionsQueue.poll(1, TimeUnit.MILLISECONDS); +if (connRef == null) { +throw new IllegalStateException( +"Connection ref found to be null. This is a bug. Some other thread removed items from the connection queue."); +} PhoenixConnection conn = connRef.get(); if (conn != null && !conn.isClosed()) { LinkedBlockingQueue scannerQueue = @@ -3323,7 +3329,15 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement int renewed = 0; long start = System.currentTimeMillis(); while (numScanners > 0) { -WeakReference ref = scannerQueue.poll(); +// It is guaranteed that this poll won't hang indefinitely because this is the +// only thread that removes items from the queue. Still adding a 1 ms timeout +// for sanity check. +WeakReference ref = +scannerQueue.poll(1, TimeUnit.MILLISECONDS); +if (ref == null) { +throw new IllegalStateException( +"TableResulIterator ref found to be null. This is a bug. Some other thread removed items from the scanner queue."); +} TableResultIterator scanningItr = ref.get(); if (scanningItr != null) { RenewLeaseStatus status = scanningItr.renewLease(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/6911770e/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 0b446b3..064007f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -1450,25 +1450,26 @@ public class MetaDataClient { List functionData = Lists.newArrayListWithExpectedSize(function.getFunctionArguments().size() + 1); List args = function.getFunctionArguments(); -PreparedStatement argUpsert = connection.prepareStatement(INSERT_FUNCTION_ARGUMENT); - -for (int i = 0; i < args.size(); i++) { -
[14/50] [abbrv] phoenix git commit: PHOENIX-2417 Compress memory used by row key byte[] of guideposts (Ankit Singhal)
http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a27cecc/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java index 1611466..f5c9295 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java @@ -75,6 +75,7 @@ import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.protobuf.HBaseZeroCopyByteString; import com.sun.istack.NotNull; import co.cask.tephra.TxConstants; @@ -1016,27 +1017,17 @@ public class PTableImpl implements PTable { boolean isImmutableRows = table.getIsImmutableRows(); SortedMaptableGuidePosts = new TreeMap (Bytes.BYTES_COMPARATOR); -for (PTableProtos.PTableStats pTableStatsProto : table.getGuidePostsList()) { -List value = Lists.newArrayListWithExpectedSize(pTableStatsProto.getValuesCount()); -for (int j = 0; j < pTableStatsProto.getValuesCount(); j++) { -value.add(pTableStatsProto.getValues(j).toByteArray()); -} -// No op -pTableStatsProto.getGuidePostsByteCount(); -value = Lists.newArrayListWithExpectedSize(pTableStatsProto.getValuesCount()); -PGuidePosts pGuidePosts = pTableStatsProto.getPGuidePosts(); -for(int j = 0; j < pGuidePosts.getGuidePostsCount(); j++) { -value.add(pGuidePosts.getGuidePosts(j).toByteArray()); -} -long guidePostsByteCount = pGuidePosts.getByteCount(); -long rowCount = pGuidePosts.getRowCount(); -// TODO : Not exposing MIN/MAX key outside to client -GuidePostsInfo info = -new GuidePostsInfo(guidePostsByteCount, value, rowCount); -tableGuidePosts.put(pTableStatsProto.getKey().toByteArray(), info); + for (PTableProtos.PTableStats pTableStatsProto : table.getGuidePostsList()) { + PGuidePosts pGuidePosts = pTableStatsProto.getPGuidePosts(); + long guidePostsByteCount = pGuidePosts.getByteCount(); + long rowCount = pGuidePosts.getRowCount(); + int maxLength = pGuidePosts.getMaxLength(); + int guidePostsCount = pGuidePosts.getEncodedGuidePostsCount(); + GuidePostsInfo info = new GuidePostsInfo(guidePostsByteCount, + new ImmutableBytesWritable(HBaseZeroCopyByteString.zeroCopyGetBytes(pGuidePosts.getEncodedGuidePosts())), rowCount, maxLength, guidePostsCount); + tableGuidePosts.put(pTableStatsProto.getKey().toByteArray(), info); } PTableStats stats = new PTableStatsImpl(tableGuidePosts, table.getStatsTimeStamp()); - PName dataTableName = null; if (table.hasDataTableNameBytes()) { dataTableName = PNameFactory.newName(table.getDataTableNameBytes().toByteArray()); @@ -1141,16 +1132,14 @@ public class PTableImpl implements PTable { for (Map.Entry entry : table.getTableStats().getGuidePosts().entrySet()) { PTableProtos.PTableStats.Builder statsBuilder = PTableProtos.PTableStats.newBuilder(); statsBuilder.setKey(ByteStringer.wrap(entry.getKey())); - for (byte[] stat : entry.getValue().getGuidePosts()) { - statsBuilder.addValues(ByteStringer.wrap(stat)); - } statsBuilder.setGuidePostsByteCount(entry.getValue().getByteCount()); + statsBuilder.setGuidePostsCount(entry.getValue().getGuidePostsCount()); PGuidePostsProtos.PGuidePosts.Builder guidePstsBuilder = PGuidePostsProtos.PGuidePosts.newBuilder(); - for (byte[] stat : entry.getValue().getGuidePosts()) { - guidePstsBuilder.addGuidePosts(ByteStringer.wrap(stat)); - } + guidePstsBuilder.setEncodedGuidePosts(ByteStringer.wrap(entry.getValue().getGuidePosts().get())); guidePstsBuilder.setByteCount(entry.getValue().getByteCount()); guidePstsBuilder.setRowCount(entry.getValue().getRowCount()); + guidePstsBuilder.setMaxLength(entry.getValue().getMaxLength()); + guidePstsBuilder.setEncodedGuidePostsCount(entry.getValue().getGuidePostsCount()); statsBuilder.setPGuidePosts(guidePstsBuilder); builder.addGuidePosts(statsBuilder.build()); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a27cecc/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfo.java -- diff --git
[40/50] [abbrv] phoenix git commit: PHOENIX-2638 Move spark version properties main pom (Ankit Singhal)
PHOENIX-2638 Move spark version properties main pom (Ankit Singhal) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/dceaaeb8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/dceaaeb8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/dceaaeb8 Branch: refs/heads/calcite Commit: dceaaeb8aa6eb4213ca5868e03cf1cca16fa4d01 Parents: a6646d7 Author: Josh MahoninAuthored: Thu Jan 28 11:06:51 2016 -0500 Committer: Josh Mahonin Committed: Thu Jan 28 11:06:51 2016 -0500 -- phoenix-spark/pom.xml | 3 --- pom.xml | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/dceaaeb8/phoenix-spark/pom.xml -- diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml index 4091afa..79a029a 100644 --- a/phoenix-spark/pom.xml +++ b/phoenix-spark/pom.xml @@ -34,9 +34,6 @@ Phoenix - Spark -1.5.2 -2.10.4 -2.10 ${project.basedir}/.. http://git-wip-us.apache.org/repos/asf/phoenix/blob/dceaaeb8/pom.xml -- diff --git a/pom.xml b/pom.xml index 388df2e..4373753 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,9 @@ 1.6.0 8.1.7.v20120910 0.6.4 +1.5.2 +2.10.4 +2.10 1.8.5
[24/50] [abbrv] phoenix git commit: PHOENIX-2584 - Support Array datatype in phoenix-pig module
PHOENIX-2584 - Support Array datatype in phoenix-pig module Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8574d431 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8574d431 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8574d431 Branch: refs/heads/calcite Commit: 8574d4311dcb5fc7a76465b32f24daf045ffb562 Parents: 4625096 Author: ravimaghamAuthored: Thu Jan 21 18:31:28 2016 -0800 Committer: ravimagham Committed: Thu Jan 21 18:31:28 2016 -0800 -- .../mapreduce/PhoenixRecordWritable.java| 28 ++-- .../phoenix/pig/PhoenixHBaseLoaderIT.java | 167 ++- .../phoenix/pig/PhoenixHBaseStorerIT.java | 37 .../apache/phoenix/pig/PhoenixHBaseLoader.java | 22 +-- .../apache/phoenix/pig/PhoenixHBaseStorage.java | 33 +++- .../org/apache/phoenix/pig/util/TypeUtil.java | 49 -- .../pig/writable/PhoenixPigDBWritable.java | 121 -- .../apache/phoenix/pig/util/TypeUtilTest.java | 39 +++-- 8 files changed, 319 insertions(+), 177 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8574d431/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWritable.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWritable.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWritable.java index 8d7d97a..0d3e724 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWritable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWritable.java @@ -17,11 +17,6 @@ */ package org.apache.phoenix.mapreduce; -import org.apache.hadoop.mapreduce.lib.db.DBWritable; -import org.apache.phoenix.schema.types.*; -import org.apache.phoenix.util.ColumnInfo; -import org.joda.time.DateTime; - import java.sql.Array; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -29,16 +24,24 @@ import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.apache.hadoop.mapreduce.lib.db.DBWritable; +import org.apache.phoenix.schema.types.PBinary; +import org.apache.phoenix.schema.types.PDataType; +import org.apache.phoenix.schema.types.PDate; +import org.apache.phoenix.schema.types.PVarbinary; +import org.apache.phoenix.util.ColumnInfo; +import org.joda.time.DateTime; + public class PhoenixRecordWritable implements DBWritable { private final List upsertValues = new ArrayList<>(); -private final Map resultMap = new HashMap<>(); -private List columnMetaDataList; +private final Map resultMap = new LinkedHashMap<>(); +private List columnMetaDataList; /** For serialization; do not use. */ public PhoenixRecordWritable() { @@ -147,9 +150,10 @@ public class PhoenixRecordWritable implements DBWritable { // PVarbinary and PBinary are provided as byte[] but are treated as SQL objects if (PDataType.equalsAny(finalType, PVarbinary.INSTANCE, PBinary.INSTANCE)) { statement.setObject(i + 1, finalObj); +} else { +// otherwise set as array type +setArrayInStatement(statement, finalType, primativeArrayToObjectArray((byte[]) finalObj), i + 1); } -// otherwise set as array type -setArrayInStatement(statement, finalType, primativeArrayToObjectArray((byte[]) finalObj), i + 1); } else if (finalObj instanceof short[]) { setArrayInStatement(statement, finalType, primativeArrayToObjectArray((short[]) finalObj), i + 1); } else if (finalObj instanceof int[]) { @@ -171,10 +175,6 @@ public class PhoenixRecordWritable implements DBWritable { for (int i = 1; i <= metaData.getColumnCount(); i++) { // return the contents of a PhoenixArray, if necessary Object value = resultSet.getObject(i); -if (value instanceof PhoenixArray) { -value = ((PhoenixArray) value).getArray(); -} - // put a (ColumnLabel -> value) entry into the result map resultMap.put(metaData.getColumnLabel(i), value); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/8574d431/phoenix-pig/src/it/java/org/apache/phoenix/pig/PhoenixHBaseLoaderIT.java -- diff --git
[29/50] [abbrv] phoenix git commit: PHOENIX-2613 Uncomment test
PHOENIX-2613 Uncomment test Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5d61fb81 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5d61fb81 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5d61fb81 Branch: refs/heads/calcite Commit: 5d61fb818e9dedef00b8d511cde7c3aeca490136 Parents: 9e90fab Author: SamarthAuthored: Fri Jan 22 12:22:53 2016 -0800 Committer: Samarth Committed: Fri Jan 22 12:22:53 2016 -0800 -- .../phoenix/filter/SkipScanFilterTest.java | 62 ++-- 1 file changed, 31 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d61fb81/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java -- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java b/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java index 8ed0add..d691535 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java @@ -106,37 +106,37 @@ public class SkipScanFilterTest extends TestCase { public static Collection data() { List testCases = Lists.newArrayList(); // Variable length tests -//testCases.addAll( -//foreach(new KeyRange[][]{{ -//PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("a"), true, Bytes.toBytes("a"), true), -//PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("e"), true, Bytes.toBytes("e"), true), -//PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("f"), true, Bytes.toBytes("f"), true), -//}, -//{ -//PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("b"), true, Bytes.toBytes("b"), true), -//}, -//{ -//KeyRange.EVERYTHING_RANGE, -//}, -//{ -//PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("1"), true, Bytes.toBytes("1"), true), -//}}, -//new int[4], -//new Include(ByteUtil.concat(Bytes.toBytes("a"),QueryConstants.SEPARATOR_BYTE_ARRAY, -//Bytes.toBytes("b"), QueryConstants.SEPARATOR_BYTE_ARRAY, -// QueryConstants.SEPARATOR_BYTE_ARRAY, -//Bytes.toBytes("1") ) ), -//new SeekNext(ByteUtil.concat(Bytes.toBytes("e.f"),QueryConstants.SEPARATOR_BYTE_ARRAY, -// Bytes.toBytes("b"), QueryConstants.SEPARATOR_BYTE_ARRAY, -// QueryConstants.SEPARATOR_BYTE_ARRAY, -// Bytes.toBytes("1") ), -// ByteUtil.concat(Bytes.toBytes("f"),QueryConstants.SEPARATOR_BYTE_ARRAY, -//Bytes.toBytes("b") )), -//new Include(ByteUtil.concat(Bytes.toBytes("f"),QueryConstants.SEPARATOR_BYTE_ARRAY, -//Bytes.toBytes("b"), QueryConstants.SEPARATOR_BYTE_ARRAY, -// QueryConstants.SEPARATOR_BYTE_ARRAY, -//Bytes.toBytes("1") ) ) ) -//); +testCases.addAll( +foreach(new KeyRange[][]{{ +PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("a"), true, Bytes.toBytes("a"), true), +PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("e"), true, Bytes.toBytes("e"), true), +PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("f"), true, Bytes.toBytes("f"), true), +}, +{ +PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("b"), true, Bytes.toBytes("b"), true), +}, +{ +KeyRange.EVERYTHING_RANGE, +}, +{ +PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("1"), true, Bytes.toBytes("1"), true), +}}, +new int[4], +new Include(ByteUtil.concat(Bytes.toBytes("a"),QueryConstants.SEPARATOR_BYTE_ARRAY, +Bytes.toBytes("b"), QueryConstants.SEPARATOR_BYTE_ARRAY, + QueryConstants.SEPARATOR_BYTE_ARRAY, +Bytes.toBytes("1") ) ), +new
[41/50] [abbrv] phoenix git commit: PHOENIX-2630 Ensure commit fails if mutable secondary index write fails
PHOENIX-2630 Ensure commit fails if mutable secondary index write fails Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c9594e83 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c9594e83 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c9594e83 Branch: refs/heads/calcite Commit: c9594e83e144ebc3830922401de2addb3df0c81d Parents: dceaaeb Author: James TaylorAuthored: Wed Jan 27 14:28:34 2016 -0800 Committer: James Taylor Committed: Thu Jan 28 10:15:01 2016 -0800 -- .../apache/phoenix/end2end/index/MutableIndexFailureIT.java | 6 +- .../hbase/index/write/KillServerOnFailurePolicy.java| 5 ++--- .../org/apache/phoenix/index/PhoenixIndexFailurePolicy.java | 9 +++-- 3 files changed, 14 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9594e83/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java index b34a70e..5f39515 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java @@ -193,7 +193,11 @@ public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { } } else { -conn.commit(); +try { +conn.commit(); +fail(); +} catch (SQLException e) { +} } // Verify the metadata for index is correct. http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9594e83/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java index 2fb43b5..cba2459 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java @@ -25,11 +25,10 @@ import org.apache.hadoop.hbase.Abortable; import org.apache.hadoop.hbase.Stoppable; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; +import org.apache.phoenix.hbase.index.table.HTableInterfaceReference; import com.google.common.collect.Multimap; -import org.apache.phoenix.hbase.index.table.HTableInterfaceReference; - /** * Naive failure policy - kills the server on which it resides */ @@ -61,7 +60,7 @@ public class KillServerOnFailurePolicy implements IndexFailurePolicy { @Override public void - handleFailure(Multimap attempted, Exception cause){ + handleFailure(Multimap attempted, Exception cause) throws IOException{ // cleanup resources this.stop("Killing ourselves because of an error:" + cause); // notify the regionserver of the failure http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9594e83/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java index 806a20a..09a8676 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java @@ -61,6 +61,7 @@ import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; +import org.apache.phoenix.util.ServerUtil; import com.google.common.collect.Multimap; @@ -99,13 +100,17 @@ public class PhoenixIndexFailurePolicy extends KillServerOnFailurePolicy { * @param cause root cause of the failure */ @Override -public void handleFailure(Multimap attempted, Exception cause) { - +public void handleFailure(Multimap attempted, Exception cause) throws IOException { +
[15/50] [abbrv] phoenix git commit: PHOENIX-2417 Compress memory used by row key byte[] of guideposts (Ankit Singhal)
PHOENIX-2417 Compress memory used by row key byte[] of guideposts (Ankit Singhal) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6a27cecc Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6a27cecc Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6a27cecc Branch: refs/heads/calcite Commit: 6a27cecce312002f9b7f76ffdcafcb694f5e3ea8 Parents: 4d323b6 Author: James TaylorAuthored: Wed Jan 20 09:57:14 2016 -0800 Committer: James Taylor Committed: Wed Jan 20 10:20:45 2016 -0800 -- .../coprocessor/MetaDataRegionObserver.java | 71 +- .../generated/PGuidePostsProtos.java| 287 +++- .../generated/StatCollectorProtos.java | 1269 -- .../org/apache/phoenix/execute/ScanPlan.java|2 +- .../phoenix/iterate/BaseResultIterators.java| 138 +- .../org/apache/phoenix/schema/PTableImpl.java | 39 +- .../phoenix/schema/stats/GuidePostsInfo.java| 106 +- .../schema/stats/GuidePostsInfoBuilder.java | 113 ++ .../phoenix/schema/stats/PTableStatsImpl.java | 45 +- .../schema/stats/StatisticsCollector.java | 46 +- .../phoenix/schema/stats/StatisticsScanner.java |3 +- .../phoenix/schema/stats/StatisticsUtil.java| 36 +- .../phoenix/schema/stats/StatisticsWriter.java | 46 +- .../java/org/apache/phoenix/util/ByteUtil.java |2 + .../apache/phoenix/util/PrefixByteCodec.java| 104 ++ .../apache/phoenix/util/PrefixByteDecoder.java | 90 ++ .../apache/phoenix/util/PrefixByteEncoder.java | 99 ++ .../org/apache/phoenix/util/UpgradeUtil.java| 68 +- .../phoenix/filter/SkipScanBigFilterTest.java |8 +- .../util/PrefixByteEncoderDecoderTest.java | 96 ++ phoenix-protocol/src/main/PGuidePosts.proto |3 + 21 files changed, 1140 insertions(+), 1531 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a27cecc/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java index c40e3cd..7950ac8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java @@ -18,10 +18,6 @@ package org.apache.phoenix.coprocessor; import java.io.IOException; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.phoenix.jdbc.PhoenixDriver; import java.sql.DriverManager; import java.sql.SQLException; import java.util.ArrayList; @@ -36,28 +32,34 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CoprocessorEnvironment; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; import org.apache.hadoop.hbase.coprocessor.ObserverContext; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; -import org.apache.hadoop.hbase.filter.SingleColumnValueFilter; import org.apache.hadoop.hbase.filter.CompareFilter; +import org.apache.hadoop.hbase.filter.SingleColumnValueFilter; import org.apache.hadoop.hbase.regionserver.RegionScanner; import org.apache.hadoop.hbase.util.Bytes; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; import org.apache.phoenix.cache.GlobalCache; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; +import org.apache.phoenix.jdbc.PhoenixDriver; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; import org.apache.phoenix.schema.MetaDataClient; import org.apache.phoenix.schema.PIndexState; -import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.schema.PTable; import org.apache.phoenix.schema.TableRef; +import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.SchemaUtil; +import org.apache.phoenix.util.UpgradeUtil; /** @@ -96,10 +98,52 @@ public class MetaDataRegionObserver extends BaseRegionObserver { rebuildIndexTimeInterval = env.getConfiguration().getLong(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_INTERVAL_ATTRIB,
[48/50] [abbrv] phoenix git commit: Sync with master; Bug fix for ResultSet object of Float type; Walkaround for PHOENIX-2647
http://git-wip-us.apache.org/repos/asf/phoenix/blob/74409be8/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java -- diff --cc phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java index 1197193,000..f200a24 mode 100644,00..100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIndexIT.java @@@ -1,283 -1,0 +1,283 @@@ +/* + * 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.calcite; + +import static org.junit.Assert.fail; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class CalciteIndexIT extends BaseCalciteIT { + +private final boolean localIndex; + +public CalciteIndexIT(boolean localIndex) { +this.localIndex = localIndex; +} + +@Parameters(name="localIndex = {0}") +public static Collectiondata() { +return Arrays.asList(new Boolean[][] { + { false }, { true } + }); +} + +@Before +public void initTable() throws Exception { +final String url = getUrl(); +final String index = localIndex ? "LOCAL INDEX" : "INDEX"; +initATableValues(getOrganizationId(), null, url); +initSaltedTables(index); +initMultiTenantTables(index); +final Connection connection = DriverManager.getConnection(url); +connection.createStatement().execute("CREATE " + index + " IF NOT EXISTS IDX1 ON aTable (a_string) INCLUDE (b_string, x_integer)"); +connection.createStatement().execute("CREATE " + index + " IF NOT EXISTS IDX2 ON aTable (b_string) INCLUDE (a_string, y_integer)"); +connection.createStatement().execute("CREATE " + index + " IF NOT EXISTS IDX_FULL ON aTable (b_string) INCLUDE (a_string, a_integer, a_date, a_time, a_timestamp, x_decimal, x_long, x_integer, y_integer, a_byte, a_short, a_float, a_double, a_unsigned_float, a_unsigned_double)"); +connection.createStatement().execute("UPDATE STATISTICS ATABLE"); +connection.createStatement().execute("UPDATE STATISTICS " + SALTED_TABLE_NAME); +connection.createStatement().execute("UPDATE STATISTICS IDX_" + SALTED_TABLE_NAME); +connection.createStatement().execute("UPDATE STATISTICS IDX1"); +connection.createStatement().execute("UPDATE STATISTICS IDX2"); +connection.createStatement().execute("UPDATE STATISTICS IDX_FULL"); +connection.close(); +} + +@Test public void testIndex() throws Exception { +start(true).sql("select * from aTable where b_string = 'b'") +.explainIs("PhoenixToEnumerableConverter\n" + + " PhoenixServerProject(ORGANIZATION_ID=[$1], ENTITY_ID=[$2], A_STRING=[$3], B_STRING=[$0], A_INTEGER=[$4], A_DATE=[$5], A_TIME=[$6], A_TIMESTAMP=[$7], X_DECIMAL=[$8], X_LONG=[$9], X_INTEGER=[$10], Y_INTEGER=[$11], A_BYTE=[$12], A_SHORT=[$13], A_FLOAT=[$14], A_DOUBLE=[$15], A_UNSIGNED_FLOAT=[$16], A_UNSIGNED_DOUBLE=[$17])\n" + + "PhoenixTableScan(table=[[phoenix, IDX_FULL]], filter=[=($0, 'b')])\n") +.close(); +start(true).sql("select x_integer from aTable") +.explainIs("PhoenixToEnumerableConverter\n" + + " PhoenixServerProject(X_INTEGER=[$4])\n" + + "PhoenixTableScan(table=[[phoenix, IDX1]])\n") +.close(); +start(true).sql("select a_string from aTable order by a_string") +.explainIs("PhoenixToEnumerableConverter\n" + + " PhoenixServerProject(A_STRING=[$0])\n" + + "
[11/50] [abbrv] phoenix git commit: PHOENIX-2610 Allow passing PHOENIX_OPTS to command line utils
PHOENIX-2610 Allow passing PHOENIX_OPTS to command line utils Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/588f449b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/588f449b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/588f449b Branch: refs/heads/calcite Commit: 588f449b0bfc5ba6398c30ee76745a78c4996976 Parents: 0b7a3c4 Author: Nick DimidukAuthored: Tue Jan 19 20:17:55 2016 -0800 Committer: Nick Dimiduk Committed: Tue Jan 19 20:50:37 2016 -0800 -- bin/performance.py | 2 +- bin/phoenix_sandbox.py | 2 +- bin/psql.py| 3 ++- bin/queryserver.py | 2 +- bin/sqlline-thin.py| 3 ++- bin/sqlline.py | 3 ++- bin/traceserver.py | 3 ++- 7 files changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/588f449b/bin/performance.py -- diff --git a/bin/performance.py b/bin/performance.py index fe39ddf..c16dd5a 100755 --- a/bin/performance.py +++ b/bin/performance.py @@ -96,7 +96,7 @@ if java_home: else: java_cmd = 'java' -execute = ('%s -cp "%s%s%s" -Dlog4j.configuration=file:' + +execute = ('%s $PHOENIX_OPTS -cp "%s%s%s" -Dlog4j.configuration=file:' + os.path.join(phoenix_utils.current_dir, "log4j.properties") + ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \ (java_cmd, hbase_config_path, os.pathsep, phoenix_utils.phoenix_client_jar, table, zookeeper) http://git-wip-us.apache.org/repos/asf/phoenix/blob/588f449b/bin/phoenix_sandbox.py -- diff --git a/bin/phoenix_sandbox.py b/bin/phoenix_sandbox.py index 433bc98..4279dd6 100755 --- a/bin/phoenix_sandbox.py +++ b/bin/phoenix_sandbox.py @@ -43,7 +43,7 @@ cp_components = [phoenix_target_dir + "/*"] with open(cp_file_path, 'rb') as cp_file: cp_components.append(cp_file.read()) -java_cmd = ("java -Dlog4j.configuration=file:%s " + +java_cmd = ("java $PHOENIX_OPTS -Dlog4j.configuration=file:%s " + "-cp %s org.apache.phoenix.Sandbox") % ( logging_config, ":".join(cp_components)) http://git-wip-us.apache.org/repos/asf/phoenix/blob/588f449b/bin/psql.py -- diff --git a/bin/psql.py b/bin/psql.py index d4269d1..973d3de 100755 --- a/bin/psql.py +++ b/bin/psql.py @@ -62,7 +62,8 @@ if java_home: else: java = 'java' -java_cmd = java +' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + \ +java_cmd = java + ' $PHOENIX_OPTS ' + \ +' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + \ os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \ os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " org.apache.phoenix.util.PhoenixRuntime " + args http://git-wip-us.apache.org/repos/asf/phoenix/blob/588f449b/bin/queryserver.py -- diff --git a/bin/queryserver.py b/bin/queryserver.py index 78d340c..d4228b3 100755 --- a/bin/queryserver.py +++ b/bin/queryserver.py @@ -119,7 +119,7 @@ else: #" -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \ #" -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \ -java_cmd = '%(java)s -cp ' + hbase_config_path + os.pathsep + hadoop_config_path + os.pathsep + \ +java_cmd = '%(java)s $PHOENIX_OPTS -cp ' + hbase_config_path + os.pathsep + hadoop_config_path + os.pathsep + \ phoenix_utils.phoenix_queryserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \ " -Dproc_phoenixserver" + \ " -Dlog4j.configuration=file:" + os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ http://git-wip-us.apache.org/repos/asf/phoenix/blob/588f449b/bin/sqlline-thin.py -- diff --git a/bin/sqlline-thin.py b/bin/sqlline-thin.py index d17d756..b37cd90 100755 --- a/bin/sqlline-thin.py +++ b/bin/sqlline-thin.py @@ -145,7 +145,8 @@ if java_home: else: java = 'java' -java_cmd = java + ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_thin_client_jar + \ +java_cmd = java + ' $PHOENIX_OPTS ' + \ +' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_thin_client_jar + \ os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \
[08/50] [abbrv] phoenix git commit: PHOENIX-2478 Rows committed in transaction overlapping index creation are not populated
PHOENIX-2478 Rows committed in transaction overlapping index creation are not populated Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f572fa63 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f572fa63 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f572fa63 Branch: refs/heads/calcite Commit: f572fa630a5bdfe5f1eab074838a82344d38063d Parents: 1717f12 Author: James TaylorAuthored: Tue Jan 19 20:23:51 2016 -0800 Committer: James Taylor Committed: Tue Jan 19 20:44:47 2016 -0800 -- .../phoenix/end2end/index/ImmutableIndexIT.java | 6 +- .../end2end/index/IndexExpressionIT.java| 16 +-- .../phoenix/compile/PostIndexDDLCompiler.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 108 +-- .../apache/phoenix/execute/MutationState.java | 39 --- .../apache/phoenix/jdbc/PhoenixStatement.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 2 +- .../org/apache/phoenix/schema/TableRef.java | 8 +- .../phoenix/compile/QueryCompilerTest.java | 2 +- 9 files changed, 98 insertions(+), 87 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f572fa63/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java index c4ecfbb..7171382 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java @@ -219,7 +219,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { futureList.add(threadPool.submit(new UpsertRunnable(fullTableName))); } // upsert some rows before creating the index -Thread.sleep(5000); +Thread.sleep(500); // create the index try (Connection conn2 = DriverManager.getConnection(getUrl(), props)) { @@ -230,14 +230,14 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { } // upsert some rows after creating the index -Thread.sleep(1000); +Thread.sleep(100); // cancel the running threads for (Future future : futureList) { future.cancel(true); } threadPool.shutdownNow(); threadPool.awaitTermination(30, TimeUnit.SECONDS); -Thread.sleep(1000); +Thread.sleep(100); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ COUNT(*) FROM " + fullTableName); http://git-wip-us.apache.org/repos/asf/phoenix/blob/f572fa63/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java index 7da0d85..7be8d41 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java @@ -95,7 +95,7 @@ public class IndexExpressionIT extends BaseHBaseManagedTimeIT { private void verifyResult(ResultSet rs, int i) throws SQLException { assertTrue(rs.next()); -assertEquals("VARCHAR" + String.valueOf(i) + "_" + StringUtils.rightPad("CHAR" + String.valueOf(i), 6, ' ') +assertEquals("VARCHAR" + String.valueOf(i) + "_" + StringUtils.rightPad("CHAR" + String.valueOf(i), 10, ' ') + "_A.VARCHAR" + String.valueOf(i) + "_" + StringUtils.rightPad("B.CHAR" + String.valueOf(i), 10, ' '), rs.getString(1)); assertEquals(i * 3, rs.getInt(2)); @@ -141,7 +141,7 @@ public class IndexExpressionIT extends BaseHBaseManagedTimeIT { // DECIMAL in the index (which is not fixed width) + " AND date_pk+1=? AND date1+1=? AND date2+1=?"; stmt = conn.prepareStatement(whereSql); -stmt.setString(1, "VARCHAR1_CHAR1 _A.VARCHAR1_B.CHAR1 "); +stmt.setString(1, "VARCHAR1_CHAR1 _A.VARCHAR1_B.CHAR1 "); stmt.setInt(2, 3); Date date = DateUtil.parseDate("2015-01-02 00:00:00"); stmt.setDate(3, date); @@ -153,8 +153,8 @@ public class IndexExpressionIT extends BaseHBaseManagedTimeIT { assertEquals(
[22/50] [abbrv] phoenix git commit: PHOENIX-2616 Indexes over immutable tables not marked as immutable
PHOENIX-2616 Indexes over immutable tables not marked as immutable Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6251f8f8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6251f8f8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6251f8f8 Branch: refs/heads/calcite Commit: 6251f8f8c035ecf50051b974ca99499913e001c1 Parents: dab79cb Author: James TaylorAuthored: Wed Jan 20 21:40:00 2016 -0800 Committer: James Taylor Committed: Wed Jan 20 21:40:00 2016 -0800 -- .../phoenix/query/ConnectionQueryServicesImpl.java | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6251f8f8/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index e8c5e1a..cf21452 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -187,12 +187,6 @@ import org.apache.twill.zookeeper.ZKClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import co.cask.tephra.TransactionSystemClient; -import co.cask.tephra.TxConstants; -import co.cask.tephra.distributed.PooledClientProvider; -import co.cask.tephra.distributed.TransactionServiceClient; -import co.cask.tephra.hbase11.coprocessor.TransactionProcessor; - import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Throwables; @@ -205,6 +199,12 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import co.cask.tephra.TransactionSystemClient; +import co.cask.tephra.TxConstants; +import co.cask.tephra.distributed.PooledClientProvider; +import co.cask.tephra.distributed.TransactionServiceClient; +import co.cask.tephra.hbase11.coprocessor.TransactionProcessor; + public class ConnectionQueryServicesImpl extends DelegateQueryServices implements ConnectionQueryServices { private static final Logger logger = LoggerFactory.getLogger(ConnectionQueryServicesImpl.class); @@ -2259,6 +2259,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement SQLException sqlE = null; try { metaConnection.createStatement().executeUpdate("ALTER TABLE " + tableName + " ADD " + (addIfNotExists ? " IF NOT EXISTS " : "") + columns ); +} catch (NewerTableAlreadyExistsException e) { +logger.warn("Table already modified at this timestamp, so assuming add of these columns already done: " + columns); } catch (SQLException e) { logger.warn("Add column failed due to:" + e); sqlE = e; @@ -2553,7 +2555,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement ")\n" + "WHERE A.COLUMN_FAMILY IS NULL AND\n" + " B.COLUMN_FAMILY IS NOT NULL AND\n" + -" A.IMMUTABLE_ROWS = TRUE;"); +" A.IMMUTABLE_ROWS = TRUE"); } finally { metaConnection.setAutoCommit(autoCommit); }
[05/50] [abbrv] phoenix git commit: PHOENIX-2478 Rows committed in transaction overlapping index creation are not populated
PHOENIX-2478 Rows committed in transaction overlapping index creation are not populated Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/13699371 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/13699371 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/13699371 Branch: refs/heads/calcite Commit: 13699371820928cf14e0e2c5bbffe338c7aa2e93 Parents: f591da4 Author: James TaylorAuthored: Mon Jan 18 21:14:34 2016 -0800 Committer: James Taylor Committed: Mon Jan 18 21:14:34 2016 -0800 -- .../apache/phoenix/execute/MutationState.java | 478 ++- .../apache/phoenix/schema/MetaDataClient.java | 31 +- 2 files changed, 265 insertions(+), 244 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/13699371/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java index ee694e7..a6fe98d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java @@ -121,6 +121,7 @@ public class MutationState implements SQLCloseable { private static final Logger logger = LoggerFactory.getLogger(MutationState.class); private static final TransactionCodec CODEC = new TransactionCodec(); private static final int[] EMPTY_STATEMENT_INDEX_ARRAY = new int[0]; +private static final int MAX_COMMIT_RETRIES = 3; private final PhoenixConnection connection; private final long maxSize; @@ -160,37 +161,37 @@ public class MutationState implements SQLCloseable { } private MutationState(long maxSize, PhoenixConnection connection, Transaction tx, TransactionContext txContext, long sizeOffset) { - this(maxSize, connection, Maps. >newHashMapWithExpectedSize(5), tx, txContext); +this(maxSize, connection, Maps. >newHashMapWithExpectedSize(5), tx, txContext); this.sizeOffset = sizeOffset; } - MutationState(long maxSize, PhoenixConnection connection, - Map > mutations, - Transaction tx, TransactionContext txContext) { - this.maxSize = maxSize; - this.connection = connection; - this.mutations = mutations; - boolean isMetricsEnabled = connection.isRequestLevelMetricsEnabled(); - this.mutationMetricQueue = isMetricsEnabled ? new MutationMetricQueue() - : NoOpMutationMetricsQueue.NO_OP_MUTATION_METRICS_QUEUE; - this.tx = tx; - if (tx == null) { +MutationState(long maxSize, PhoenixConnection connection, +Map > mutations, +Transaction tx, TransactionContext txContext) { +this.maxSize = maxSize; +this.connection = connection; +this.mutations = mutations; +boolean isMetricsEnabled = connection.isRequestLevelMetricsEnabled(); +this.mutationMetricQueue = isMetricsEnabled ? new MutationMetricQueue() +: NoOpMutationMetricsQueue.NO_OP_MUTATION_METRICS_QUEUE; +this.tx = tx; +if (tx == null) { this.txAwares = Collections.emptyList(); - if (txContext == null) { - TransactionSystemClient txServiceClient = this.connection - .getQueryServices().getTransactionSystemClient(); - this.txContext = new TransactionContext(txServiceClient); - } else { - isExternalTxContext = true; - this.txContext = txContext; - } - } else { - // this code path is only used while running child scans, we can't pass the txContext to child scans - // as it is not thread safe, so we use the tx member variable - this.txAwares = Lists.newArrayList(); - this.txContext = null; - } - } +if (txContext == null) { +TransactionSystemClient txServiceClient = this.connection +.getQueryServices().getTransactionSystemClient(); +this.txContext = new TransactionContext(txServiceClient); +} else { +
[02/50] [abbrv] phoenix git commit: PHOENIX-2520 Create DDL property for metadata update frequency
PHOENIX-2520 Create DDL property for metadata update frequency Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/59b336ec Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/59b336ec Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/59b336ec Branch: refs/heads/calcite Commit: 59b336ec84b7cf5189bb2e67f07f9ef20da898d9 Parents: 3e5fa3e Author: James TaylorAuthored: Sun Jan 17 11:24:26 2016 -0800 Committer: James Taylor Committed: Sun Jan 17 11:49:00 2016 -0800 -- .../org/apache/phoenix/rpc/UpdateCacheIT.java | 92 ++ .../phoenix/rpc/UpdateCacheWithScnIT.java | 17 ++- phoenix-core/src/main/antlr3/PhoenixSQL.g | 3 +- .../apache/phoenix/compile/FromCompiler.java| 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../compile/TupleProjectionCompiler.java| 4 +- .../apache/phoenix/compile/UnionCompiler.java | 2 +- .../coprocessor/MetaDataEndpointImpl.java | 13 +- .../phoenix/coprocessor/MetaDataProtocol.java | 2 +- .../coprocessor/generated/PTableProtos.java | 104 +-- .../apache/phoenix/jdbc/PhoenixConnection.java | 6 +- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 3 + .../query/ConnectionQueryServicesImpl.java | 43 +++ .../query/ConnectionlessQueryServicesImpl.java | 4 +- .../query/DelegateConnectionQueryServices.java | 4 +- .../apache/phoenix/query/MetaDataMutated.java | 2 +- .../apache/phoenix/query/QueryConstants.java| 4 +- .../apache/phoenix/schema/DelegateTable.java| 6 + .../apache/phoenix/schema/MetaDataClient.java | 123 -- .../org/apache/phoenix/schema/PMetaData.java| 3 +- .../apache/phoenix/schema/PMetaDataImpl.java| 15 ++- .../java/org/apache/phoenix/schema/PTable.java | 1 + .../org/apache/phoenix/schema/PTableImpl.java | 65 ++ .../org/apache/phoenix/schema/PTableRef.java| 17 ++- .../apache/phoenix/schema/TableProperty.java| 26 .../phoenix/execute/CorrelatePlanTest.java | 4 +- .../phoenix/schema/PMetaDataImplTest.java | 125 --- phoenix-protocol/src/main/PTable.proto | 1 + 28 files changed, 487 insertions(+), 206 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/59b336ec/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java index 13ed8aa..20a3c48 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java @@ -49,8 +49,8 @@ import org.apache.phoenix.schema.types.PVarchar; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.ReadOnlyProps; +import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.TestUtil; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; @@ -73,48 +73,86 @@ public class UpdateCacheIT extends BaseHBaseManagedTimeIT { setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } -@Before -public void setUp() throws SQLException { -ensureTableCreated(getUrl(), MUTABLE_INDEX_DATA_TABLE); -ensureTableCreated(getUrl(), TRANSACTIONAL_DATA_TABLE); -} - -private static void setupSystemTable(Long scn) throws SQLException { +private static void setupSystemTable(String fullTableName) throws SQLException { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); -if (scn != null) { -props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(scn)); -} try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute( -"create table " + QueryConstants.SYSTEM_SCHEMA_NAME + QueryConstants.NAME_SEPARATOR + MUTABLE_INDEX_DATA_TABLE + TEST_TABLE_SCHEMA); +"create table " + fullTableName + TEST_TABLE_SCHEMA); } } @Test public void testUpdateCacheForTxnTable() throws Exception { -helpTestUpdateCache(true, false, null); +String fullTableName = INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + TRANSACTIONAL_DATA_TABLE; +ensureTableCreated(getUrl(), TRANSACTIONAL_DATA_TABLE); +helpTestUpdateCache(fullTableName, null, new int[] {1, 1}); } @Test public void testUpdateCacheForNonTxnTable() throws Exception { -
[04/50] [abbrv] phoenix git commit: PHOENIX-2591 Minimize transaction commit/rollback for DDL
PHOENIX-2591 Minimize transaction commit/rollback for DDL Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f591da44 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f591da44 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f591da44 Branch: refs/heads/calcite Commit: f591da44c9ee85ee7ab0fa910e3b18e649d86cdf Parents: 9a44b49 Author: James TaylorAuthored: Mon Jan 18 21:09:44 2016 -0800 Committer: James Taylor Committed: Mon Jan 18 21:09:44 2016 -0800 -- .../apache/phoenix/execute/MutationState.java | 30 ++-- .../apache/phoenix/util/TransactionUtil.java| 23 ++- .../java/org/apache/phoenix/util/TestUtil.java | 2 +- 3 files changed, 24 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f591da44/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java index 35a36e6..ee694e7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java @@ -37,18 +37,6 @@ import java.util.concurrent.TimeoutException; import javax.annotation.Nonnull; import javax.annotation.concurrent.Immutable; -import co.cask.tephra.Transaction; -import co.cask.tephra.Transaction.VisibilityLevel; -import co.cask.tephra.TransactionAware; -import co.cask.tephra.TransactionCodec; -import co.cask.tephra.TransactionConflictException; -import co.cask.tephra.TransactionContext; -import co.cask.tephra.TransactionFailureException; -import co.cask.tephra.TransactionSystemClient; -import co.cask.tephra.hbase11.TransactionAwareHTable; -import co.cask.tephra.visibility.FenceWait; -import co.cask.tephra.visibility.VisibilityFence; - import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.HTableInterface; @@ -110,6 +98,18 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import co.cask.tephra.Transaction; +import co.cask.tephra.Transaction.VisibilityLevel; +import co.cask.tephra.TransactionAware; +import co.cask.tephra.TransactionCodec; +import co.cask.tephra.TransactionConflictException; +import co.cask.tephra.TransactionContext; +import co.cask.tephra.TransactionFailureException; +import co.cask.tephra.TransactionSystemClient; +import co.cask.tephra.hbase11.TransactionAwareHTable; +import co.cask.tephra.visibility.FenceWait; +import co.cask.tephra.visibility.VisibilityFence; + /** * * Tracks the uncommitted state @@ -369,9 +369,9 @@ public class MutationState implements SQLCloseable { return getTransaction() != null; } -public long getReadPointer() { - Transaction tx = getTransaction(); - return tx == null ? HConstants.LATEST_TIMESTAMP : tx.getReadPointer(); +public long getInitialWritePointer() { +Transaction tx = getTransaction(); +return tx == null ? HConstants.LATEST_TIMESTAMP : tx.getTransactionId(); // First write pointer - won't change with checkpointing } // For testing http://git-wip-us.apache.org/repos/asf/phoenix/blob/f591da44/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java index 9f16e52..041c12e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java @@ -19,6 +19,11 @@ package org.apache.phoenix.util; import java.sql.SQLException; +import co.cask.tephra.TransactionConflictException; +import co.cask.tephra.TransactionFailureException; +import co.cask.tephra.TxConstants; +import co.cask.tephra.hbase11.TransactionAwareHTable; + import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult; import org.apache.phoenix.exception.SQLExceptionCode; @@ -27,11 +32,6 @@ import org.apache.phoenix.execute.MutationState; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.schema.PTable; -import co.cask.tephra.TransactionConflictException; -import co.cask.tephra.TransactionFailureException; -import co.cask.tephra.TxConstants; -import
[39/50] [abbrv] phoenix git commit: PHOENIX-2542 - CSV bulk loading with --schema option is broken
PHOENIX-2542 - CSV bulk loading with --schema option is broken Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a6646d7e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a6646d7e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a6646d7e Branch: refs/heads/calcite Commit: a6646d7ebdac53e4b011c6c6b57b8fc5b679d3ff Parents: aaab87a Author: ravimaghamAuthored: Thu Jan 28 07:42:04 2016 -0800 Committer: ravimagham Committed: Thu Jan 28 07:42:04 2016 -0800 -- .../it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java | 5 +++-- .../java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6646d7e/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java index 87652ab..6bc03bf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java @@ -95,7 +95,7 @@ public class CsvBulkLoadToolIT { public void testBasicImport() throws Exception { Statement stmt = conn.createStatement(); -stmt.execute("CREATE TABLE TABLE1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, T DATE) SPLIT ON (1,2)"); +stmt.execute("CREATE TABLE S.TABLE1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, T DATE) SPLIT ON (1,2)"); FileSystem fs = FileSystem.get(hbaseTestUtil.getConfiguration()); FSDataOutputStream outputStream = fs.create(new Path("/tmp/input1.csv")); @@ -110,10 +110,11 @@ public class CsvBulkLoadToolIT { int exitCode = csvBulkLoadTool.run(new String[] { "--input", "/tmp/input1.csv", "--table", "table1", +"--schema", "s", "--zookeeper", zkQuorum}); assertEquals(0, exitCode); -ResultSet rs = stmt.executeQuery("SELECT id, name, t FROM table1 ORDER BY id"); +ResultSet rs = stmt.executeQuery("SELECT id, name, t FROM s.table1 ORDER BY id"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals("Name 1", rs.getString(2)); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6646d7e/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java index 4b5d618..f6ba5f6 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java @@ -208,7 +208,7 @@ public abstract class AbstractBulkLoadTool extends Configured implements Tool { FormatToKeyValueMapper.configureColumnInfoList(conf, importColumns); boolean ignoreInvalidRows = cmdLine.hasOption(IGNORE_ERRORS_OPT.getOpt()); conf.setBoolean(FormatToKeyValueMapper.IGNORE_INVALID_ROW_CONFKEY, ignoreInvalidRows); -conf.set(FormatToKeyValueMapper.TABLE_NAME_CONFKEY, tableName); +conf.set(FormatToKeyValueMapper.TABLE_NAME_CONFKEY, qualifiedTableName); // give subclasses their hook configureOptions(cmdLine, importColumns, conf);
[43/50] [abbrv] phoenix git commit: PHOENIX-2543 Modify StatsCollectorIT to test transactional test cases
PHOENIX-2543 Modify StatsCollectorIT to test transactional test cases Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/791a27cf Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/791a27cf Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/791a27cf Branch: refs/heads/calcite Commit: 791a27cfd141af969bc3e2e25ac9c14bd1b17a90 Parents: ee63702 Author: Thomas D'SilvaAuthored: Thu Jan 28 13:26:40 2016 -0800 Committer: Thomas D'Silva Committed: Thu Jan 28 14:14:33 2016 -0800 -- .../phoenix/end2end/StatsCollectorIT.java | 73 ++ .../org/apache/phoenix/tx/TransactionIT.java| 137 +++ 2 files changed, 152 insertions(+), 58 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/791a27cf/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java index 706ae4a..caba259 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java @@ -30,6 +30,8 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Properties; @@ -43,14 +45,23 @@ import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.ReadOnlyProps; +import org.apache.phoenix.util.SchemaUtil; +import org.apache.phoenix.util.TestUtil; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import com.google.common.collect.Maps; - +@RunWith(Parameterized.class) public class StatsCollectorIT extends StatsCollectorAbstractIT { private static final String STATS_TEST_TABLE_NAME = "S"; + +private final String tableDDLOptions; +private final String tableName; +private final String fullTableName; @BeforeClass public static void doSetup() throws Exception { @@ -62,30 +73,31 @@ public class StatsCollectorIT extends StatsCollectorAbstractIT { props.put(QueryServices.TRANSACTIONS_ENABLED, Boolean.toString(true)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } - -@Test -public void testUpdateStatsForNonTxnTable() throws Throwable { -helpTestUpdateStats(false); + +public StatsCollectorIT( boolean transactional) { +this.tableDDLOptions= transactional ? " TRANSACTIONAL=true" : ""; +this.tableName = TestUtil.DEFAULT_DATA_TABLE_NAME + ( transactional ? "_TXN" : ""); +this.fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName); } -@Test -public void testUpdateStatsForTxnTable() throws Throwable { -helpTestUpdateStats(true); +@Parameters(name="transactional = {0}") +public static Collection data() { +return Arrays.asList(false,true); } - private void helpTestUpdateStats(boolean transactional) throws SQLException, IOException, +@Test +public void testUpdateStats() throws SQLException, IOException, InterruptedException { Connection conn; PreparedStatement stmt; ResultSet rs; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); -String tableName = "T" + (transactional ? "_TXN" : ""); // props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute( -"CREATE TABLE " + tableName +" ( k VARCHAR, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4] \n" -+ " CONSTRAINT pk PRIMARY KEY (k, b_string_array DESC))" - + (transactional ? " TRANSACTIONAL=true" : "")); +"CREATE TABLE " + fullTableName +" ( k VARCHAR, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4] \n" ++ " CONSTRAINT pk PRIMARY KEY (k, b_string_array DESC))" + + tableDDLOptions ); String[] s; Array array; conn = upsertValues(props, tableName); @@ -119,14 +131,14 @@ public
[13/50] [abbrv] phoenix git commit: PHOENIX-2478 Rows committed in transaction overlapping index creation are not populated
PHOENIX-2478 Rows committed in transaction overlapping index creation are not populated Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4d323b66 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4d323b66 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4d323b66 Branch: refs/heads/calcite Commit: 4d323b66b8f685872c7b94f3d243c940f7fa37d9 Parents: b63ca5f Author: James TaylorAuthored: Tue Jan 19 22:10:48 2016 -0800 Committer: James Taylor Committed: Tue Jan 19 22:11:00 2016 -0800 -- .../src/main/java/org/apache/phoenix/execute/MutationState.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d323b66/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java index 3dfae46..f1a9c02 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java @@ -1234,7 +1234,7 @@ public class MutationState implements SQLCloseable { if (updatedDataTable == null) { throw new TableNotFoundException(dataTable.getSchemaName().getString(), dataTable.getTableName().getString()); } -allImmutableTables |= updatedDataTable.isImmutableRows(); +allImmutableTables &= updatedDataTable.isImmutableRows(); tableRef.setTable(updatedDataTable); if (!addedAnyIndexes) { // TODO: in theory we should do a deep equals check here, as it's possible
[21/50] [abbrv] phoenix git commit: PHOENIX-2612 RuleGeneartorTest updated with right pattern (Karan Singhal)
PHOENIX-2612 RuleGeneartorTest updated with right pattern (Karan Singhal) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/dab79cbe Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/dab79cbe Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/dab79cbe Branch: refs/heads/calcite Commit: dab79cbe0e4d10e1c259198de8e95b7e93d66b57 Parents: d345b88 Author: James TaylorAuthored: Wed Jan 20 21:06:32 2016 -0800 Committer: James Taylor Committed: Wed Jan 20 21:06:32 2016 -0800 -- .../main/java/org/apache/phoenix/pherf/PherfConstants.java| 1 + .../src/test/java/org/apache/phoenix/pherf/ResourceTest.java | 2 +- .../test/java/org/apache/phoenix/pherf/RuleGeneratorTest.java | 7 +++ 3 files changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/dab79cbe/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/PherfConstants.java -- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/PherfConstants.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/PherfConstants.java index 42b5d21..bbae6ea 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/PherfConstants.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/PherfConstants.java @@ -47,6 +47,7 @@ public class PherfConstants { SCENARIO_ROOT_PATTERN = ".*" + PherfConstants.RESOURCE_SCENARIO.substring(1) + ".*" + PherfConstants.RESOURCE_SCENARIO.substring(1) + ".*"; public static final String SCHEMA_ROOT_PATTERN = ".*"; +public static final String TEST_SCENARIO_ROOT_PATTERN = ".*" + "test" + "_" + PherfConstants.RESOURCE_SCENARIO.substring(1); public static final String PHERF_PROPERTIES = "pherf.properties"; public static final String EXPORT_DIR = "CSV_EXPORT"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/dab79cbe/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResourceTest.java -- diff --git a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResourceTest.java b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResourceTest.java index cd567cb..d8cad48 100644 --- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResourceTest.java +++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResourceTest.java @@ -43,7 +43,7 @@ public class ResourceTest { @Test public void testScenarioResourceList() throws Exception { String extension = ".xml"; -assertResources(PherfConstants.SCENARIO_ROOT_PATTERN + extension, PherfConstants.RESOURCE_SCENARIO, extension); +assertResources(PherfConstants.TEST_SCENARIO_ROOT_PATTERN + extension, PherfConstants.RESOURCE_SCENARIO, extension); } @Test http://git-wip-us.apache.org/repos/asf/phoenix/blob/dab79cbe/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/RuleGeneratorTest.java -- diff --git a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/RuleGeneratorTest.java b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/RuleGeneratorTest.java index 71b785b..b26b2f7 100644 --- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/RuleGeneratorTest.java +++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/RuleGeneratorTest.java @@ -47,9 +47,8 @@ import org.junit.Ignore; import org.junit.Test; public class RuleGeneratorTest { -private static final String matcherScenario = PherfConstants.SCENARIO_ROOT_PATTERN + ".xml"; +private static final String matcherScenario = PherfConstants.TEST_SCENARIO_ROOT_PATTERN + ".xml"; -@Ignore("Flapping - see PHOENIX-2592") @Test public void testDateGenerator() throws Exception { XMLConfigParser parser = new XMLConfigParser(matcherScenario); @@ -252,7 +251,7 @@ public class RuleGeneratorTest { expectedValues.add("bBByYhnNbBs9kWu"); expectedValues.add("cCCyYhnNbBs9kWr"); -XMLConfigParser parser = new XMLConfigParser(".*test_scenario.xml"); +XMLConfigParser parser = new XMLConfigParser(matcherScenario); WriteWorkload loader = new WriteWorkload(parser); RulesApplier rulesApplier = loader.getRulesApplier(); Scenario scenario = parser.getScenarios().get(0); @@ -270,7 +269,7 @@ public class RuleGeneratorTest { @Test public void testRuleOverrides() throws Exception { -XMLConfigParser parser = new XMLConfigParser(".*test_scenario.xml"); +XMLConfigParser parser = new XMLConfigParser(matcherScenario); WriteWorkload loader = new WriteWorkload(parser);
[33/50] [abbrv] phoenix git commit: Set version to 4.7.0-HBase-1.1 for release
Set version to 4.7.0-HBase-1.1 for release Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/551cc7db Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/551cc7db Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/551cc7db Branch: refs/heads/calcite Commit: 551cc7db93a8a2c3cc9ff15e7cf9425e311ab125 Parents: 424083d Author: MujtabaAuthored: Fri Jan 22 22:29:53 2016 -0800 Committer: Mujtaba Committed: Fri Jan 22 22:29:53 2016 -0800 -- phoenix-assembly/pom.xml | 2 +- phoenix-core/pom.xml | 2 +- phoenix-flume/pom.xml | 2 +- phoenix-pherf/pom.xml | 2 +- phoenix-pig/pom.xml| 2 +- phoenix-server-client/pom.xml | 2 +- phoenix-server/pom.xml | 2 +- phoenix-spark/pom.xml | 2 +- phoenix-tracing-webapp/pom.xml | 2 +- pom.xml| 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-assembly/pom.xml -- diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml index ab8f42b..a598e61 100644 --- a/phoenix-assembly/pom.xml +++ b/phoenix-assembly/pom.xml @@ -26,7 +26,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-assembly Phoenix Assembly http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-core/pom.xml -- diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml index c57f5d5..2b6d287 100644 --- a/phoenix-core/pom.xml +++ b/phoenix-core/pom.xml @@ -4,7 +4,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-core Phoenix Core http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-flume/pom.xml -- diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml index 24290ac..15a921b 100644 --- a/phoenix-flume/pom.xml +++ b/phoenix-flume/pom.xml @@ -26,7 +26,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-flume Phoenix - Flume http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-pherf/pom.xml -- diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml index 568a47f..b94828a 100644 --- a/phoenix-pherf/pom.xml +++ b/phoenix-pherf/pom.xml @@ -15,7 +15,7 @@ org.apache.phoenix phoenix - 4.7.0-HBase-1.1-SNAPSHOT + 4.7.0-HBase-1.1 phoenix-pherf http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-pig/pom.xml -- diff --git a/phoenix-pig/pom.xml b/phoenix-pig/pom.xml index c579436..fcaa489 100644 --- a/phoenix-pig/pom.xml +++ b/phoenix-pig/pom.xml @@ -26,7 +26,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-pig Phoenix - Pig http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-server-client/pom.xml -- diff --git a/phoenix-server-client/pom.xml b/phoenix-server-client/pom.xml index dae204e..8bff95c 100644 --- a/phoenix-server-client/pom.xml +++ b/phoenix-server-client/pom.xml @@ -4,7 +4,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-server-client Phoenix Query Server Client http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-server/pom.xml -- diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml index 98a771b..36bf726 100644 --- a/phoenix-server/pom.xml +++ b/phoenix-server/pom.xml @@ -4,7 +4,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-server Phoenix Query Server http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-spark/pom.xml -- diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml index f82e9a2..4091afa 100644 --- a/phoenix-spark/pom.xml +++ b/phoenix-spark/pom.xml @@ -28,7 +28,7 @@ org.apache.phoenix phoenix -4.7.0-HBase-1.1-SNAPSHOT +4.7.0-HBase-1.1 phoenix-spark Phoenix - Spark http://git-wip-us.apache.org/repos/asf/phoenix/blob/551cc7db/phoenix-tracing-webapp/pom.xml
[01/50] [abbrv] phoenix git commit: PHOENIX-2520 Create DDL property for metadata update frequency
Repository: phoenix Updated Branches: refs/heads/calcite 518356479 -> 74409be82 http://git-wip-us.apache.org/repos/asf/phoenix/blob/59b336ec/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java index 1805d94..1611466 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java @@ -135,6 +135,7 @@ public class PTableImpl implements PTable { private boolean rowKeyOrderOptimizable; // TODO: remove when required that tables have been upgrade for PHOENIX-2067 private boolean hasColumnsRequiringUpgrade; // TODO: remove when required that tables have been upgrade for PHOENIX-2067 private int rowTimestampColPos; +private long updateCacheFrequency; public PTableImpl() { this.indexes = Collections.emptyList(); @@ -205,7 +206,7 @@ public class PTableImpl implements PTable { table.getSequenceNumber(), table.getPKName(), table.getBucketNum(), getColumnsToClone(table), parentSchemaName, table.getParentTableName(), indexes, table.isImmutableRows(), table.getPhysicalNames(), table.getDefaultFamilyName(), viewStatement, table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), table.getIndexType(), -table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional()); +table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); } public static PTableImpl makePTable(PTable table, List columns) throws SQLException { @@ -214,7 +215,7 @@ public class PTableImpl implements PTable { table.getSequenceNumber(), table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), table.isImmutableRows(), table.getPhysicalNames(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), table.getIndexType(), -table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional()); +table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); } public static PTableImpl makePTable(PTable table, long timeStamp, long sequenceNumber, List columns) throws SQLException { @@ -223,7 +224,7 @@ public class PTableImpl implements PTable { sequenceNumber, table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), table.isImmutableRows(), table.getPhysicalNames(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), table.getIndexType(), table.getTableStats(), -table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional()); +table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); } public static PTableImpl makePTable(PTable table, long timeStamp, long sequenceNumber, List columns, boolean isImmutableRows) throws SQLException { @@ -232,16 +233,17 @@ public class PTableImpl implements PTable { sequenceNumber, table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), isImmutableRows, table.getPhysicalNames(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), -table.getIndexType(), table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional()); +table.getIndexType(), table.getTableStats(), table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), table.isTransactional(), table.getUpdateCacheFrequency()); } -public static PTableImpl makePTable(PTable table, long timeStamp, long sequenceNumber, List columns, boolean isImmutableRows, boolean isWalDisabled, boolean isMultitenant, boolean storeNulls, boolean isTransactional) throws SQLException { +public static PTableImpl makePTable(PTable table, long timeStamp,
[10/50] [abbrv] phoenix git commit: PHOENIX-2303 Fix for performance.py not using JAVA_HOME (bpanneton)
PHOENIX-2303 Fix for performance.py not using JAVA_HOME (bpanneton) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0b7a3c46 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0b7a3c46 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0b7a3c46 Branch: refs/heads/calcite Commit: 0b7a3c460e1171b5e67934684bf8ee71f07927cb Parents: 15432d1 Author: MujtabaAuthored: Mon Oct 5 10:57:35 2015 -0700 Committer: Nick Dimiduk Committed: Tue Jan 19 20:49:52 2016 -0800 -- bin/performance.py | 36 +--- 1 file changed, 33 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0b7a3c46/bin/performance.py -- diff --git a/bin/performance.py b/bin/performance.py index 2f7fad1..fe39ddf 100755 --- a/bin/performance.py +++ b/bin/performance.py @@ -66,10 +66,40 @@ phoenix_utils.setPath() # HBase/Phoenix client side property override hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.current_dir) -execute = ('java -cp "%s%s%s" -Dlog4j.configuration=file:' + +java_home = os.getenv('JAVA_HOME') + +# load hbase-env.??? to extract JAVA_HOME, HBASE_PID_DIR, HBASE_LOG_DIR +hbase_env_path = None +hbase_env_cmd = None +if os.name == 'posix': +hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.sh') +hbase_env_cmd = ['bash', '-c', 'source %s && env' % hbase_env_path] +elif os.name == 'nt': +hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.cmd') +hbase_env_cmd = ['cmd.exe', '/c', 'call %s & set' % hbase_env_path] +if not hbase_env_path or not hbase_env_cmd: +print >> sys.stderr, "hbase-env file unknown on platform %s" % os.name +sys.exit(-1) + +hbase_env = {} +if os.path.isfile(hbase_env_path): +p = subprocess.Popen(hbase_env_cmd, stdout = subprocess.PIPE) +for x in p.stdout: +(k, _, v) = x.partition('=') +hbase_env[k.strip()] = v.strip() + +if hbase_env.has_key('JAVA_HOME'): +java_home = hbase_env['JAVA_HOME'] + +if java_home: +java_cmd = os.path.join(java_home, 'bin', 'java') +else: +java_cmd = 'java' + +execute = ('%s -cp "%s%s%s" -Dlog4j.configuration=file:' + os.path.join(phoenix_utils.current_dir, "log4j.properties") + ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \ -(hbase_config_path, os.pathsep, phoenix_utils.phoenix_client_jar, table, zookeeper) +(java_cmd, hbase_config_path, os.pathsep, phoenix_utils.phoenix_client_jar, table, zookeeper) # Create Table DDL createtable = "CREATE TABLE IF NOT EXISTS %s (HOST CHAR(2) NOT NULL,\ @@ -98,7 +128,7 @@ queryex("4 - Truncate + Group By", "SELECT TRUNC(DATE,'DAY') DAY FROM %s GROUP B queryex("5 - Filter + Count", "SELECT COUNT(1) FROM %s WHERE CORE<10;" % (table)) print "\nGenerating and upserting data..." -exitcode = subprocess.call('java -jar %s %s %s' % (phoenix_utils.testjar, data, rowcount), +exitcode = subprocess.call('%s -jar %s %s %s' % (java_cmd, phoenix_utils.testjar, data, rowcount), shell=True) if exitcode != 0: sys.exit(exitcode)
[28/50] [abbrv] phoenix git commit: PHOENIX-2624 Update pom to Calcite 1.6
PHOENIX-2624 Update pom to Calcite 1.6 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9e90faba Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9e90faba Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9e90faba Branch: refs/heads/calcite Commit: 9e90fabaee2378196c83c9d9ae9aaff332833b16 Parents: 79d109e Author: James TaylorAuthored: Fri Jan 22 12:03:55 2016 -0800 Committer: James Taylor Committed: Fri Jan 22 12:03:55 2016 -0800 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9e90faba/pom.xml -- diff --git a/pom.xml b/pom.xml index e635ae7..02639b5 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ 3.2.1 2.7 2.1.2 -1.5.0 +1.6.0 8.1.7.v20120910 0.6.4
[38/50] [abbrv] phoenix git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/phoenix
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/phoenix Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/aaab87a8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/aaab87a8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/aaab87a8 Branch: refs/heads/calcite Commit: aaab87a88f162384cbd94ab1703f7fc5daec5751 Parents: de4f174 bd06dfb Author: maryannxue <maryann@gmail.com> Authored: Tue Jan 26 20:27:17 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Tue Jan 26 20:27:17 2016 -0500 -- .../query/ConnectionQueryServicesImpl.java | 82 .../phoenix/query/QueryServicesOptions.java | 2 +- 2 files changed, 14 insertions(+), 70 deletions(-) --
[37/50] [abbrv] phoenix git commit: PHOENIX-1854 Investigate not setting ProjectedColumnExpression in TupleProjector expressions array
PHOENIX-1854 Investigate not setting ProjectedColumnExpression in TupleProjector expressions array Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/de4f1742 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/de4f1742 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/de4f1742 Branch: refs/heads/calcite Commit: de4f174272be4fddcc8bf6dada048b4e70394f52 Parents: e2b6009 Author: maryannxue <maryann@gmail.com> Authored: Tue Jan 26 20:27:10 2016 -0500 Committer: maryannxue <maryann@gmail.com> Committed: Tue Jan 26 20:27:10 2016 -0500 -- .../org/apache/phoenix/compile/OrderPreservingTracker.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/de4f1742/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java index 65245f3..7715747 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java @@ -216,10 +216,8 @@ public class OrderPreservingTracker { return super.visit(node); } Expression expression = projector.getExpressions()[node.getPosition()]; -// FIXME: prevents infinite recursion for union all in subquery, but -// should a ProjectedColumnExpression be used in this case? Wouldn't -// it make more sense to not create this wrapper in this case? -if (expression == node) { +// Only look one level down the projection. +if (expression instanceof ProjectedColumnExpression) { return super.visit(node); } return expression.accept(this);