[jira] [Created] (PHOENIX-4068) Atomic Upsert salted table with error(java.lang.NullPointerException).

2017-08-06 Thread tian.yang (JIRA)
tian.yang created PHOENIX-4068:
--

 Summary: Atomic Upsert salted table with 
error(java.lang.NullPointerException).
 Key: PHOENIX-4068
 URL: https://issues.apache.org/jira/browse/PHOENIX-4068
 Project: Phoenix
  Issue Type: Bug
Affects Versions: 4.10.0
 Environment: CentOS release 6.5 (Final)
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Hbase 1.1
Reporter: tian.yang


0: jdbc:phoenix:> drop table MY_TABLE;
No rows affected (4.635 seconds)
0: jdbc:phoenix:> create table my_table(id varchar not null,id1 varchar not 
null, counter1 bigint, counter2 bigint CONSTRAINT pk PRIMARY KEY (id,id1));
No rows affected (2.365 seconds)
0: jdbc:phoenix:> UPSERT INTO my_table(id,id1, counter1, counter2) VALUES 
('abc','123', 0, 0) ON DUPLICATE KEY UPDATE counter1 = counter1 + 1, counter2 = 
counter2 + 1;
1 row affected (0.024 seconds)
0: jdbc:phoenix:> drop table MY_TABLE;
No rows affected (4.62 seconds)
0: jdbc:phoenix:> create table my_table(id varchar not null,id1 varchar not 
null, counter1 bigint, counter2 bigint CONSTRAINT pk PRIMARY KEY 
(id,id1))SALT_BUCKETS = 6;
No rows affected (4.378 seconds)
0: jdbc:phoenix:> UPSERT INTO my_table(id,id1, counter1, counter2) VALUES 
('abc','123', 0, 0) ON DUPLICATE KEY UPDATE counter1 = counter1 + 1, counter2 = 
counter2 + 1;
java.lang.NullPointerException: at index 3
at 
com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:191)
at 
com.google.common.collect.ImmutableList.construct(ImmutableList.java:320)
at 
com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:290)
at org.apache.phoenix.schema.PTableImpl.init(PTableImpl.java:534)
at org.apache.phoenix.schema.PTableImpl.(PTableImpl.java:408)
at org.apache.phoenix.schema.PTableImpl.makePTable(PTableImpl.java:287)
at 
org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:979)
at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:611)
at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:597)
at 
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:351)
at 
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:341)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:339)
at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1511)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:813)
at sqlline.SqlLine.begin(SqlLine.java:686)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:291)
0: jdbc:phoenix:>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (PHOENIX-418) Support approximate COUNT DISTINCT

2017-08-06 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16115982#comment-16115982
 ] 

Hadoop QA commented on PHOENIX-418:
---

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12880580/PHOENIX-418-v4.patch
  against master branch at commit bf3c13b6d169e90e06c54a338a5931163a32d743.
  ATTACHMENT ID: 12880580

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:red}-1 tests included{color}.  The patch doesn't appear to include 
any new or modified tests.
Please justify why no new tests are needed for this 
patch.
Also please list what manual steps were performed to 
verify this patch.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:red}-1 javadoc{color}.  The javadoc tool appears to have generated 
54 warning messages.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 lineLengths{color}.  The patch introduces the following lines 
longer than 100:
+String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), (Date)null, null, getUrl(), null);
+String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), (Date)null, null, getUrl(), null);
+String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), (Date)null, null, getUrl(), null);
+String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), (Date)null, null, getUrl(), null);
+String query = "SELECT 
APPROX_COUNT_DISTINCT(ORGANIZATION_ID||A_STRING||B_STRING) FROM " + tableName;
+String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), (Date)null, null, getUrl(), null);
+String query = "SELECT 
APPROX_COUNT_DISTINCT(a.ORGANIZATION_ID||a.A_STRING||b.ENTITY_ID) FROM " 
+   + tableName + " a, "+ tableName + " b where 
a.ORGANIZATION_ID=b.ORGANIZATION_ID and a.ENTITY_ID = b.ENTITY_ID";
+String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), (Date)null, null, getUrl(), null);
+String query = "explain SELECT 
APPROX_COUNT_DISTINCT(ORGANIZATION_ID||ENTITY_ID) FROM " + tableName;

 {color:red}-1 core tests{color}.  The patch failed these unit tests:
 
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.execute.PartialCommitIT
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.end2end.ProductMetricsIT
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.end2end.ScanQueryIT
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.end2end.QueryDatabaseMetaDataIT
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.end2end.NotQueryIT
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT

Test results: 
https://builds.apache.org/job/PreCommit-PHOENIX-Build/1246//testReport/
Javadoc warnings: 
https://builds.apache.org/job/PreCommit-PHOENIX-Build/1246//artifact/patchprocess/patchJavadocWarnings.txt
Console output: 
https://builds.apache.org/job/PreCommit-PHOENIX-Build/1246//console

This message is automatically generated.

> Support approximate COUNT DISTINCT
> --
>
> Key: PHOENIX-418
> URL: https://issues.apache.org/jira/browse/PHOENIX-418
> Project: Phoenix
>  Issue Type: Task
>Reporter: James Taylor
>Assignee: Ethan Wang
>  Labels: gsoc2016
> Attachments: PHOENIX-418-v1.patch, PHOENIX-418-v2.patch, 
> PHOENIX-418-v3.patch, PHOENIX-418-v4.patch
>
>
> Support an "approximation" of count distinct to prevent having to hold on to 
> all distinct values (since this will not scale well when the number of 
> distinct values is huge). The Apache Drill folks have had some interesting 
> discussions on this 
> [here](http://mail-archives.apache.org/mod_mbox/incubator-drill-dev/201306.mbox/%3CJIRA.12650169.1369931282407.88049.1370645900553%40arcas%3E).
>  They recommend using  [Welford's 
> method](http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance_Online_algorithm).
>  I'm open to having a config option that uses exact versus approximate. I 
> don't have experience implementing an approximate implementation, so I'm not 
> sure how much state is required to keep on the server and return to the 
> client (other than realizing it'd be much less that returning all distinct 
> values and their counts).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (PHOENIX-418) Support approximate COUNT DISTINCT

2017-08-06 Thread Ethan Wang (JIRA)

 [ 
https://issues.apache.org/jira/browse/PHOENIX-418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ethan Wang updated PHOENIX-418:
---
Attachment: PHOENIX-418-v4.patch

Make DistinctCountHyperLogLogAggregateFunction extends 
DistinctCountAggregateFunction to inherit many benefits instead of reimplement 
them. 

Thanks [~jamestaylor] I should've done in this way the first place.

> Support approximate COUNT DISTINCT
> --
>
> Key: PHOENIX-418
> URL: https://issues.apache.org/jira/browse/PHOENIX-418
> Project: Phoenix
>  Issue Type: Task
>Reporter: James Taylor
>Assignee: Ethan Wang
>  Labels: gsoc2016
> Attachments: PHOENIX-418-v1.patch, PHOENIX-418-v2.patch, 
> PHOENIX-418-v3.patch, PHOENIX-418-v4.patch
>
>
> Support an "approximation" of count distinct to prevent having to hold on to 
> all distinct values (since this will not scale well when the number of 
> distinct values is huge). The Apache Drill folks have had some interesting 
> discussions on this 
> [here](http://mail-archives.apache.org/mod_mbox/incubator-drill-dev/201306.mbox/%3CJIRA.12650169.1369931282407.88049.1370645900553%40arcas%3E).
>  They recommend using  [Welford's 
> method](http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance_Online_algorithm).
>  I'm open to having a config option that uses exact versus approximate. I 
> don't have experience implementing an approximate implementation, so I'm not 
> sure how much state is required to keep on the server and return to the 
> client (other than realizing it'd be much less that returning all distinct 
> values and their counts).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)