[jira] [Commented] (PHOENIX-2535) Create shaded clients (thin + thick)

2016-04-06 Thread Thomas D'Silva (JIRA)

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

Thomas D'Silva commented on PHOENIX-2535:
-

I'm not sure what client-without-hbase and client-minimal are used for.

> Create shaded clients (thin + thick) 
> -
>
> Key: PHOENIX-2535
> URL: https://issues.apache.org/jira/browse/PHOENIX-2535
> Project: Phoenix
>  Issue Type: Bug
>Reporter: Enis Soztutar
>Assignee: Sergey Soldatov
> Fix For: 4.8.0
>
> Attachments: PHOENIX-2535-1.patch, PHOENIX-2535-2.patch, 
> PHOENIX-2535-3.patch, PHOENIX-2535-4.patch
>
>
> Having shaded client artifacts helps greatly in minimizing the dependency 
> conflicts at the run time. We are seeing more of Phoenix JDBC client being 
> used in Storm topologies and other settings where guava versions become a 
> problem. 
> I think we can do a parallel artifact for the thick client with shaded 
> dependencies and also using shaded hbase. For thin client, maybe shading 
> should be the default since it is new? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2320) Not able to run upsert query over phoenix query server.

2016-04-06 Thread Srinivas Tirupati (JIRA)

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

Srinivas Tirupati commented on PHOENIX-2320:


I guess this link has the information you are asking for 

https://azure.microsoft.com/en-us/documentation/articles/hdinsight-component-versioning/

I just want to track the change which added the requirement of creating a 
statement explicitly to run a query. 

> Not able to run upsert query over phoenix query server.
> ---
>
> Key: PHOENIX-2320
> URL: https://issues.apache.org/jira/browse/PHOENIX-2320
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Appasaheb Sawant
>Assignee: Josh Elser
>
> Not able to run upsert query over phoenix query server. Select query works 
> but for upsert query records are not inserted into phoenix.
> This is CODE
>  $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL,"http://localhost:8765/";);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> $headers = array();
> // For Select.
> //$headers[] = 'request: 
> {"request":"prepareAndExecute","connectionId":"----","sql":"select
>  * from BLOG.POST"}';
> // For Upsert.
> $headers[] = 'request: 
> {"request":"prepareAndExecute","connectionId":"----","sql":"UPSERT
>  INTO BLOG.POST (POST_ID,TITLE,CONTENT) values (\'aa1\',\'Test 
> Title\',\'this is test post content\')"}';
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
> $server_output = curl_exec ($ch);
> curl_close ($ch);
> OUTPUT
>  
> {"response":"Service$ExecuteResponse","results":[{"response":"resultSet","connectionId":"----","statementId":1164383384,"ownStatement":false,"signature":null,"firstFrame":null,"updateCount":1}]}
> But record is not inserted ...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2535) Create shaded clients (thin + thick)

2016-04-06 Thread James Taylor (JIRA)

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

James Taylor commented on PHOENIX-2535:
---

I don't think we need  {{client-without-hbase}} and {{client-minimal}} jars any 
longer, especially given the shading you're doing. Any opinions, [~tdsilva] or 
[~mujtabachohan]?

> Create shaded clients (thin + thick) 
> -
>
> Key: PHOENIX-2535
> URL: https://issues.apache.org/jira/browse/PHOENIX-2535
> Project: Phoenix
>  Issue Type: Bug
>Reporter: Enis Soztutar
>Assignee: Sergey Soldatov
> Fix For: 4.8.0
>
> Attachments: PHOENIX-2535-1.patch, PHOENIX-2535-2.patch, 
> PHOENIX-2535-3.patch, PHOENIX-2535-4.patch
>
>
> Having shaded client artifacts helps greatly in minimizing the dependency 
> conflicts at the run time. We are seeing more of Phoenix JDBC client being 
> used in Storm topologies and other settings where guava versions become a 
> problem. 
> I think we can do a parallel artifact for the thick client with shaded 
> dependencies and also using shaded hbase. For thin client, maybe shading 
> should be the default since it is new? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2535) Create shaded clients (thin + thick)

2016-04-06 Thread Sergey Soldatov (JIRA)

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

Sergey Soldatov commented on PHOENIX-2535:
--

I want just to confirm that the stuff I'm doing is correct:
* new {{phoenix-client}} module with the {{phoenix-client}} artifact (full 
shaded client) and update for command line utils to use it
* no more {{client-spark}} jar since there is no problems with different 
versions of libraries
* {{phoenix-server}} jar file will be created in the existing 
{{phoenix-server}} module
* {{phoenix-assemble}} will contains only tarball 

Open questions:
Why we need {{client-without-hbase}} and {{client-minimal}} jars if we do not 
ship it in the tarball  nor publish them in the artifactory?
If we want them published, whether it's ok to create a separate modules for 
them?

[~jamestaylor], [~enis], [~elserj], [~jmahonin] any comments/suggestions?

 

> Create shaded clients (thin + thick) 
> -
>
> Key: PHOENIX-2535
> URL: https://issues.apache.org/jira/browse/PHOENIX-2535
> Project: Phoenix
>  Issue Type: Bug
>Reporter: Enis Soztutar
>Assignee: Sergey Soldatov
> Fix For: 4.8.0
>
> Attachments: PHOENIX-2535-1.patch, PHOENIX-2535-2.patch, 
> PHOENIX-2535-3.patch, PHOENIX-2535-4.patch
>
>
> Having shaded client artifacts helps greatly in minimizing the dependency 
> conflicts at the run time. We are seeing more of Phoenix JDBC client being 
> used in Storm topologies and other settings where guava versions become a 
> problem. 
> I think we can do a parallel artifact for the thick client with shaded 
> dependencies and also using shaded hbase. For thin client, maybe shading 
> should be the default since it is new? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2320) Not able to run upsert query over phoenix query server.

2016-04-06 Thread Josh Elser (JIRA)

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

Josh Elser commented on PHOENIX-2320:
-

[~tsriniv...@gmail.com], I'm not sure what versions of HDI correspond to the 
Apache Phoenix/Calcite versions. I'd recommend contacting the vendor for help, 
or, if you can provide the information to correlate this back to Apache 
versions, I'd be happy to try to help out.

> Not able to run upsert query over phoenix query server.
> ---
>
> Key: PHOENIX-2320
> URL: https://issues.apache.org/jira/browse/PHOENIX-2320
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Appasaheb Sawant
>Assignee: Josh Elser
>
> Not able to run upsert query over phoenix query server. Select query works 
> but for upsert query records are not inserted into phoenix.
> This is CODE
>  $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL,"http://localhost:8765/";);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> $headers = array();
> // For Select.
> //$headers[] = 'request: 
> {"request":"prepareAndExecute","connectionId":"----","sql":"select
>  * from BLOG.POST"}';
> // For Upsert.
> $headers[] = 'request: 
> {"request":"prepareAndExecute","connectionId":"----","sql":"UPSERT
>  INTO BLOG.POST (POST_ID,TITLE,CONTENT) values (\'aa1\',\'Test 
> Title\',\'this is test post content\')"}';
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
> $server_output = curl_exec ($ch);
> curl_close ($ch);
> OUTPUT
>  
> {"response":"Service$ExecuteResponse","results":[{"response":"resultSet","connectionId":"----","statementId":1164383384,"ownStatement":false,"signature":null,"firstFrame":null,"updateCount":1}]}
> But record is not inserted ...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2320) Not able to run upsert query over phoenix query server.

2016-04-06 Thread Srinivas Tirupati (JIRA)

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

Srinivas Tirupati commented on PHOENIX-2320:


Where can I find more information about this ? I was using Microsoft Azure 
HBase (HDI 3.3) and I was able run queries without calling CreateStatement. 
After I migrated to newer version (HDI 3.4), these calls are failing if I do 
not call CreateStatement. 

> Not able to run upsert query over phoenix query server.
> ---
>
> Key: PHOENIX-2320
> URL: https://issues.apache.org/jira/browse/PHOENIX-2320
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Appasaheb Sawant
>Assignee: Josh Elser
>
> Not able to run upsert query over phoenix query server. Select query works 
> but for upsert query records are not inserted into phoenix.
> This is CODE
>  $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL,"http://localhost:8765/";);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> $headers = array();
> // For Select.
> //$headers[] = 'request: 
> {"request":"prepareAndExecute","connectionId":"----","sql":"select
>  * from BLOG.POST"}';
> // For Upsert.
> $headers[] = 'request: 
> {"request":"prepareAndExecute","connectionId":"----","sql":"UPSERT
>  INTO BLOG.POST (POST_ID,TITLE,CONTENT) values (\'aa1\',\'Test 
> Title\',\'this is test post content\')"}';
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
> $server_output = curl_exec ($ch);
> curl_close ($ch);
> OUTPUT
>  
> {"response":"Service$ExecuteResponse","results":[{"response":"resultSet","connectionId":"----","statementId":1164383384,"ownStatement":false,"signature":null,"firstFrame":null,"updateCount":1}]}
> But record is not inserted ...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2810) Fixing IndexTool Dependencies

2016-04-06 Thread James Taylor (JIRA)

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

James Taylor commented on PHOENIX-2810:
---

[~maghamravikiran] - would you mind reviewing and committing if it looks ok?

> Fixing IndexTool Dependencies
> -
>
> Key: PHOENIX-2810
> URL: https://issues.apache.org/jira/browse/PHOENIX-2810
> Project: Phoenix
>  Issue Type: Bug
>Reporter: churro morales
>Priority: Minor
>  Labels: HBASEDEPENDENCIES
> Attachments: PHOENIX-2810.patch
>
>
> IndexTool uses HFileOutputFormat which is deprecated.  Use HFileOutputFormat2 
> instead and fix other private dependencies for this class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2810) Fixing IndexTool Dependencies

2016-04-06 Thread Sergey Soldatov (JIRA)

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

Sergey Soldatov commented on PHOENIX-2810:
--

Looks good to me. 

> Fixing IndexTool Dependencies
> -
>
> Key: PHOENIX-2810
> URL: https://issues.apache.org/jira/browse/PHOENIX-2810
> Project: Phoenix
>  Issue Type: Bug
>Reporter: churro morales
>Priority: Minor
>  Labels: HBASEDEPENDENCIES
> Attachments: PHOENIX-2810.patch
>
>
> IndexTool uses HFileOutputFormat which is deprecated.  Use HFileOutputFormat2 
> instead and fix other private dependencies for this class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2822) Tests that extend BaseHBaseManagedTimeIT are very slow

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-2822:
-

Github user churrodog commented on the pull request:

https://github.com/apache/phoenix/pull/158#issuecomment-206450571
  
I also un-ignored the memory manager test in the last commit and fixed it 
up to remove the long sleeps.


> Tests that extend BaseHBaseManagedTimeIT are very slow
> --
>
> Key: PHOENIX-2822
> URL: https://issues.apache.org/jira/browse/PHOENIX-2822
> Project: Phoenix
>  Issue Type: Improvement
>Affects Versions: 4.8.0
>Reporter: churro morales
>Assignee: churro morales
>  Labels: HBASEDEPENDENCIES
>
> Since I am trying to refactor out all the hbase private dependencies, I have 
> to constantly run tests to make sure I didn't break anything.  The tests that 
> extend BaseHBaseManagedTimeIT are very slow as they have to delete all 
> non-system tables after every test case.  This takes around 5-10 seconds to 
> accomplish.  This adds significant time to the test suite. 
> I created a new class named: BaseHBaseManagedTimeTableReuseIT and it creates 
> a random table name such that we dont have collisions for tests.  It also 
> doesn't do any cleanup after each test case or class because these table 
> names should be unique.  I moved about 30-35 tests out from 
> BaseHBaseManagedTimeIT to BaseHBaseManagedTimeTableReuseIT and it 
> significantly improved the overall time it takes to run tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-2822 - Tests that extend BaseHBaseMa...

2016-04-06 Thread churrodog
Github user churrodog commented on the pull request:

https://github.com/apache/phoenix/pull/158#issuecomment-206450571
  
I also un-ignored the memory manager test in the last commit and fixed it 
up to remove the long sleeps.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-2822) Tests that extend BaseHBaseManagedTimeIT are very slow

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-2822:
-

Github user churrodog commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/158#discussion_r58735016
  
--- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java 
---
@@ -43,9 +44,10 @@ public void initTable() throws Exception {
 Connection conn = null;
 PreparedStatement stmt = null;
 try {
+System.out.println("TABLE_NAME = " + TABLE_NAME);
--- End diff --

no problem


> Tests that extend BaseHBaseManagedTimeIT are very slow
> --
>
> Key: PHOENIX-2822
> URL: https://issues.apache.org/jira/browse/PHOENIX-2822
> Project: Phoenix
>  Issue Type: Improvement
>Affects Versions: 4.8.0
>Reporter: churro morales
>Assignee: churro morales
>  Labels: HBASEDEPENDENCIES
>
> Since I am trying to refactor out all the hbase private dependencies, I have 
> to constantly run tests to make sure I didn't break anything.  The tests that 
> extend BaseHBaseManagedTimeIT are very slow as they have to delete all 
> non-system tables after every test case.  This takes around 5-10 seconds to 
> accomplish.  This adds significant time to the test suite. 
> I created a new class named: BaseHBaseManagedTimeTableReuseIT and it creates 
> a random table name such that we dont have collisions for tests.  It also 
> doesn't do any cleanup after each test case or class because these table 
> names should be unique.  I moved about 30-35 tests out from 
> BaseHBaseManagedTimeIT to BaseHBaseManagedTimeTableReuseIT and it 
> significantly improved the overall time it takes to run tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-2822 - Tests that extend BaseHBaseMa...

2016-04-06 Thread churrodog
Github user churrodog commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/158#discussion_r58735016
  
--- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java 
---
@@ -43,9 +44,10 @@ public void initTable() throws Exception {
 Connection conn = null;
 PreparedStatement stmt = null;
 try {
+System.out.println("TABLE_NAME = " + TABLE_NAME);
--- End diff --

no problem


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-1478) Can't upsert value of 127 into column of type unsigned tinyint

2016-04-06 Thread Hudson (JIRA)

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

Hudson commented on PHOENIX-1478:
-

SUCCESS: Integrated in Phoenix-master #1185 (See 
[https://builds.apache.org/job/Phoenix-master/1185/])
PHOENIX-1478 Can't upsert value of 127 into column of type unsigned 
(rajeshbabu: rev 1e47821876af8100d5b4bc4dad03168eca7f5652)
* phoenix-core/src/main/java/org/apache/phoenix/schema/types/PInteger.java
* phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDouble.java
* phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java
* phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloat.java


> Can't upsert value of 127 into column of type unsigned tinyint
> --
>
> Key: PHOENIX-1478
> URL: https://issues.apache.org/jira/browse/PHOENIX-1478
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.2.0
>Reporter: Carter Shanklin
>Priority: Minor
>  Labels: verify
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1478-1.patch, PHOENIX-1478.patch
>
>
> The docs say values from 0 to 127 are valid. From sqlline I can upsert a 
> value of 126 but not 127. See below.
> {code}
> $ cat UnsignedTinyintFail.sql
> drop table if exists unsigned_tinyint_test;
> create table unsigned_tinyint_test (uti unsigned_tinyint primary key);
> upsert into unsigned_tinyint_test values (126);
> upsert into unsigned_tinyint_test values (127);
> {code}
> Results in:
> {code}
> Setting property: [isolation, TRANSACTION_READ_COMMITTED]
> Setting property: [run, UnsignedTinyintFail.sql]
> issuing: !connect jdbc:phoenix:localhost:2181:/hbase-unsecure none none 
> org.apache.phoenix.jdbc.PhoenixDriver
> Connecting to jdbc:phoenix:localhost:2181:/hbase-unsecure
> 14/11/15 08:19:57 WARN impl.MetricsConfig: Cannot locate configuration: tried 
> hadoop-metrics2-phoenix.properties,hadoop-metrics2.properties
> Connected to: Phoenix (version 4.2)
> Driver: PhoenixEmbeddedDriver (version 4.2)
> Autocommit status: true
> Transaction isolation: TRANSACTION_READ_COMMITTED
> Building list of tables and columns for tab-completion (set fastconnect to 
> true to skip)...
> 76/76 (100%) Done
> Done
> 1/4  drop table if exists unsigned_tinyint_test;
> No rows affected (0.015 seconds)
> 2/4  create table unsigned_tinyint_test (uti unsigned_tinyint primary 
> key);
> No rows affected (0.317 seconds)
> 3/4  upsert into unsigned_tinyint_test values (126);
> 1 row affected (0.032 seconds)
> 4/4  upsert into unsigned_tinyint_test values (127);
> Error: ERROR 203 (22005): Type mismatch. UNSIGNED_TINYINT and INTEGER for 127 
> (state=22005,code=203)
> org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type 
> mismatch. UNSIGNED_TINYINT and INTEGER for 127
>   at 
> org.apache.phoenix.schema.TypeMismatchException.newException(TypeMismatchException.java:52)
>   at 
> org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:160)
>   at 
> org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:136)
>   at 
> org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:854)
>   at 
> org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:830)
>   at 
> org.apache.phoenix.parse.LiteralParseNode.accept(LiteralParseNode.java:73)
>   at 
> org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:721)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:467)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:458)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:259)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:252)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:250)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1037)
>   at sqlline.SqlLine$Commands.execute(SqlLine.java:3673)
>   at sqlline.SqlLine$Commands.sql(SqlLine.java:3584)
>   at sqlline.SqlLine.dispatch(SqlLine.java:821)
>   at sqlline.SqlLine.runCommands(SqlLine.java:1793)
>   at sqlline.SqlLine$Commands.run(SqlLine.java:4161)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.M

[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on the pull request:

https://github.com/apache/phoenix/pull/153#issuecomment-206406674
  
Thanks @samarthjain  for the review, I have incorporated the review 
comments in last commit.
I'll write a test for upgrade code soon though I have tested it on local 
cluster for tables with views and indexes.
please proceed with your further review.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Comment Edited] (PHOENIX-1478) Can't upsert value of 127 into column of type unsigned tinyint

2016-04-06 Thread Rajeshbabu Chintaguntla (JIRA)

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

Rajeshbabu Chintaguntla edited comment on PHOENIX-1478 at 4/6/16 2:38 PM:
--

Pushed to master, 4.x branches. Thanks for the patch [~gsbiju]. [~jamestaylor] 
can you assign the issue to [~gsbiju].


was (Author: rajeshbabu):
Pushed to master, 4.x branches. Thanks for the patch [~gsbiju]. @

> Can't upsert value of 127 into column of type unsigned tinyint
> --
>
> Key: PHOENIX-1478
> URL: https://issues.apache.org/jira/browse/PHOENIX-1478
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.2.0
>Reporter: Carter Shanklin
>Priority: Minor
>  Labels: verify
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1478-1.patch, PHOENIX-1478.patch
>
>
> The docs say values from 0 to 127 are valid. From sqlline I can upsert a 
> value of 126 but not 127. See below.
> {code}
> $ cat UnsignedTinyintFail.sql
> drop table if exists unsigned_tinyint_test;
> create table unsigned_tinyint_test (uti unsigned_tinyint primary key);
> upsert into unsigned_tinyint_test values (126);
> upsert into unsigned_tinyint_test values (127);
> {code}
> Results in:
> {code}
> Setting property: [isolation, TRANSACTION_READ_COMMITTED]
> Setting property: [run, UnsignedTinyintFail.sql]
> issuing: !connect jdbc:phoenix:localhost:2181:/hbase-unsecure none none 
> org.apache.phoenix.jdbc.PhoenixDriver
> Connecting to jdbc:phoenix:localhost:2181:/hbase-unsecure
> 14/11/15 08:19:57 WARN impl.MetricsConfig: Cannot locate configuration: tried 
> hadoop-metrics2-phoenix.properties,hadoop-metrics2.properties
> Connected to: Phoenix (version 4.2)
> Driver: PhoenixEmbeddedDriver (version 4.2)
> Autocommit status: true
> Transaction isolation: TRANSACTION_READ_COMMITTED
> Building list of tables and columns for tab-completion (set fastconnect to 
> true to skip)...
> 76/76 (100%) Done
> Done
> 1/4  drop table if exists unsigned_tinyint_test;
> No rows affected (0.015 seconds)
> 2/4  create table unsigned_tinyint_test (uti unsigned_tinyint primary 
> key);
> No rows affected (0.317 seconds)
> 3/4  upsert into unsigned_tinyint_test values (126);
> 1 row affected (0.032 seconds)
> 4/4  upsert into unsigned_tinyint_test values (127);
> Error: ERROR 203 (22005): Type mismatch. UNSIGNED_TINYINT and INTEGER for 127 
> (state=22005,code=203)
> org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type 
> mismatch. UNSIGNED_TINYINT and INTEGER for 127
>   at 
> org.apache.phoenix.schema.TypeMismatchException.newException(TypeMismatchException.java:52)
>   at 
> org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:160)
>   at 
> org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:136)
>   at 
> org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:854)
>   at 
> org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:830)
>   at 
> org.apache.phoenix.parse.LiteralParseNode.accept(LiteralParseNode.java:73)
>   at 
> org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:721)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:467)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:458)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:259)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:252)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:250)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1037)
>   at sqlline.SqlLine$Commands.execute(SqlLine.java:3673)
>   at sqlline.SqlLine$Commands.sql(SqlLine.java:3584)
>   at sqlline.SqlLine.dispatch(SqlLine.java:821)
>   at sqlline.SqlLine.runCommands(SqlLine.java:1793)
>   at sqlline.SqlLine$Commands.run(SqlLine.java:4161)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:606)
>   at sqlline.SqlLine$ReflectiveCommandHandler.execute(SqlLine.java:2810)
>   at sqlline.SqlLine.dispatch(SqlLine.java:817)
>   at sqlline.SqlLine.initArgs(SqlLine.java:657)
>   at sqlli

[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on the pull request:

https://github.com/apache/phoenix/pull/153#issuecomment-206406674
  
Thanks @samarthjain  for the review, I have incorporated the review 
comments in last commit.
I'll write a test for upgrade code soon though I have tested it on local 
cluster for tables with views and indexes.
please proceed with your further review.


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like feature on top of the table.
> Maybe to stay close to Hbase it could also be a create DB:Table...
> or DB.Table which is a more standard annotation?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58715199
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java ---
@@ -265,12 +332,18 @@ public SingleTableColumnResolver(PhoenixConnection 
connection, NamedTableNode ta
if (def.getColumnDefName().getFamilyName() != null) {
families.add(new 
PColumnFamilyImpl(PNameFactory.newName(def.getColumnDefName().getFamilyName()),Collections.emptyList()));
}
-   }
-   Long scn = connection.getSCN();
-   PTable theTable = new PTableImpl(connection.getTenantId(), 
table.getName().getSchemaName(), table.getName().getTableName(), scn == null ? 
HConstants.LATEST_TIMESTAMP : scn, families);
+}
+Long scn = connection.getSCN();
+String schema = table.getName().getSchemaName();
+if (connection.getSchema() != null) {
--- End diff --

Actually, when the schema for the table{T} is not present, we try to 
resolve table with connection schema {.T} if set in 
connection.
I have added a test case UseSchemaIT#testMappedView, is it you are 
expecting? 


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like feature on top of the table.
> Maybe to stay close to Hbase it could also be a create DB:Table...
> or DB.Table which is a more standard annotation?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58715199
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java ---
@@ -265,12 +332,18 @@ public SingleTableColumnResolver(PhoenixConnection 
connection, NamedTableNode ta
if (def.getColumnDefName().getFamilyName() != null) {
families.add(new 
PColumnFamilyImpl(PNameFactory.newName(def.getColumnDefName().getFamilyName()),Collections.emptyList()));
}
-   }
-   Long scn = connection.getSCN();
-   PTable theTable = new PTableImpl(connection.getTenantId(), 
table.getName().getSchemaName(), table.getName().getTableName(), scn == null ? 
HConstants.LATEST_TIMESTAMP : scn, families);
+}
+Long scn = connection.getSCN();
+String schema = table.getName().getSchemaName();
+if (connection.getSchema() != null) {
--- End diff --

Actually, when the schema for the table{T} is not present, we try to 
resolve table with connection schema {.T} if set in 
connection.
I have added a test case UseSchemaIT#testMappedView, is it you are 
expecting? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58703359
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
--- End diff --

Yeah, I'll add a test for upgrade code.


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like feature on top of the table.
> Maybe to stay close to Hbase it could also be a create DB:Table...
> or DB.Table which is a more standard annotation?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58703359
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
--- End diff --

Yeah, I'll add a test for upgrade code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58701167
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
+String destTableName, ReadOnlyProps props, Long ts, String 
phoenixTableName, PTableType pTableType)
+throws SnapshotCreationException, 
IllegalArgumentException, IOException, InterruptedException,
+SQLException {
+srcTableName = SchemaUtil.normalizeIdentifier(srcTableName);
+if (!SchemaUtil.isNamespaceMappingEnabled(
+SchemaUtil.isSystemTable(srcTableName.getBytes()) ? 
PTableType.SYSTEM : null,
+props)) { throw new 
IllegalArgumentException(SchemaUtil.isSystemTable(srcTableName.getBytes())
+? "For system table " + 
QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE
++ " also needs to be enabled along with " 
+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED
+: QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " 
is not enabled"); }
+
+if (PTableType.TABLE.equals(pTableType) || 
PTableType.INDEX.equals(pTableType)) {
+admin.snapshot(srcTableName, srcTableName);
+admin.cloneSnapshot(srcTableName.getBytes(), 
destTableName.getBytes());
+admin.disableTable(srcTableName);
+admin.deleteTable(srcTableName);
+}
+if (phoenixTableName == null) {
+phoenixTableName = srcTableName;
+}
+Put put = new Put(SchemaUtil.getTableKey(null, 
SchemaUtil.getSchemaNameFromFullName(phoenixTableName),
+SchemaUtil.getTableNameFromFullName(phoenixTableName)), 
ts);
+put.addColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES, 
PhoenixDatabaseMetaData.IS_NAMESPACE_MAPPED_BYTES,
+PBoolean.INSTANCE.toBytes(Boolean.TRUE));
+metatable.put(put);
+}
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String tableName,
+ReadOnlyProps props, Long ts) throws 
SnapshotCreationException, IllegalArgumentException, IOException,
+InterruptedException, SQLException {
+String destTablename = SchemaUtil
+
.normalizeIdentifier(SchemaUtil.getPhysicalTableName(tableName, 
props).getNameAsString());
+mapTableToNamespace(admin, metatable, tableName, destTablename, 
props, ts, null, PTableType.TABLE);
+}
+
+public static void upgradeTable(PhoenixConnection conn, String 
srcTable) throws SQLException,
+SnapshotCreationException, IllegalArgumentException, 
IOException, InterruptedException {
+ReadOnlyProps readOnlyProps = conn.getQueryServices().getProps();
+if (conn.getClientInfo(PhoenixRuntime.TENANT_ID_ATTRIB) != null) { 
throw new SQLException(
--- End diff --

yes .. Now, I'm throwing exception if schema is set in connection.


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like feature on top of the table.
> Maybe to stay close to Hbase it could also be a create DB:Table...
> or DB.Table which is a more standard annotation?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58701167
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
+String destTableName, ReadOnlyProps props, Long ts, String 
phoenixTableName, PTableType pTableType)
+throws SnapshotCreationException, 
IllegalArgumentException, IOException, InterruptedException,
+SQLException {
+srcTableName = SchemaUtil.normalizeIdentifier(srcTableName);
+if (!SchemaUtil.isNamespaceMappingEnabled(
+SchemaUtil.isSystemTable(srcTableName.getBytes()) ? 
PTableType.SYSTEM : null,
+props)) { throw new 
IllegalArgumentException(SchemaUtil.isSystemTable(srcTableName.getBytes())
+? "For system table " + 
QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE
++ " also needs to be enabled along with " 
+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED
+: QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " 
is not enabled"); }
+
+if (PTableType.TABLE.equals(pTableType) || 
PTableType.INDEX.equals(pTableType)) {
+admin.snapshot(srcTableName, srcTableName);
+admin.cloneSnapshot(srcTableName.getBytes(), 
destTableName.getBytes());
+admin.disableTable(srcTableName);
+admin.deleteTable(srcTableName);
+}
+if (phoenixTableName == null) {
+phoenixTableName = srcTableName;
+}
+Put put = new Put(SchemaUtil.getTableKey(null, 
SchemaUtil.getSchemaNameFromFullName(phoenixTableName),
+SchemaUtil.getTableNameFromFullName(phoenixTableName)), 
ts);
+put.addColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES, 
PhoenixDatabaseMetaData.IS_NAMESPACE_MAPPED_BYTES,
+PBoolean.INSTANCE.toBytes(Boolean.TRUE));
+metatable.put(put);
+}
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String tableName,
+ReadOnlyProps props, Long ts) throws 
SnapshotCreationException, IllegalArgumentException, IOException,
+InterruptedException, SQLException {
+String destTablename = SchemaUtil
+
.normalizeIdentifier(SchemaUtil.getPhysicalTableName(tableName, 
props).getNameAsString());
+mapTableToNamespace(admin, metatable, tableName, destTablename, 
props, ts, null, PTableType.TABLE);
+}
+
+public static void upgradeTable(PhoenixConnection conn, String 
srcTable) throws SQLException,
+SnapshotCreationException, IllegalArgumentException, 
IOException, InterruptedException {
+ReadOnlyProps readOnlyProps = conn.getQueryServices().getProps();
+if (conn.getClientInfo(PhoenixRuntime.TENANT_ID_ATTRIB) != null) { 
throw new SQLException(
--- End diff --

yes .. Now, I'm throwing exception if schema is set in connection.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58700415
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
+String destTableName, ReadOnlyProps props, Long ts, String 
phoenixTableName, PTableType pTableType)
+throws SnapshotCreationException, 
IllegalArgumentException, IOException, InterruptedException,
+SQLException {
+srcTableName = SchemaUtil.normalizeIdentifier(srcTableName);
+if (!SchemaUtil.isNamespaceMappingEnabled(
+SchemaUtil.isSystemTable(srcTableName.getBytes()) ? 
PTableType.SYSTEM : null,
+props)) { throw new 
IllegalArgumentException(SchemaUtil.isSystemTable(srcTableName.getBytes())
+? "For system table " + 
QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE
++ " also needs to be enabled along with " 
+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED
+: QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " 
is not enabled"); }
+
+if (PTableType.TABLE.equals(pTableType) || 
PTableType.INDEX.equals(pTableType)) {
+admin.snapshot(srcTableName, srcTableName);
+admin.cloneSnapshot(srcTableName.getBytes(), 
destTableName.getBytes());
+admin.disableTable(srcTableName);
+admin.deleteTable(srcTableName);
+}
+if (phoenixTableName == null) {
--- End diff --

phoenixTableName and physical table name are different in case of indexes 
.. so it is required there .. but now in my latest commit , I have removed the 
null check and pass the phoenixTableName always.


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like feature on top of the table.
> Maybe to stay close to Hbase it could also be a create DB:Table...
> or DB.Table which is a more standard annotation?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58700415
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
+String destTableName, ReadOnlyProps props, Long ts, String 
phoenixTableName, PTableType pTableType)
+throws SnapshotCreationException, 
IllegalArgumentException, IOException, InterruptedException,
+SQLException {
+srcTableName = SchemaUtil.normalizeIdentifier(srcTableName);
+if (!SchemaUtil.isNamespaceMappingEnabled(
+SchemaUtil.isSystemTable(srcTableName.getBytes()) ? 
PTableType.SYSTEM : null,
+props)) { throw new 
IllegalArgumentException(SchemaUtil.isSystemTable(srcTableName.getBytes())
+? "For system table " + 
QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE
++ " also needs to be enabled along with " 
+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED
+: QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " 
is not enabled"); }
+
+if (PTableType.TABLE.equals(pTableType) || 
PTableType.INDEX.equals(pTableType)) {
+admin.snapshot(srcTableName, srcTableName);
+admin.cloneSnapshot(srcTableName.getBytes(), 
destTableName.getBytes());
+admin.disableTable(srcTableName);
+admin.deleteTable(srcTableName);
+}
+if (phoenixTableName == null) {
--- End diff --

phoenixTableName and physical table name are different in case of indexes 
.. so it is required there .. but now in my latest commit , I have removed the 
null check and pass the phoenixTableName always.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58692384
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
+String destTableName, ReadOnlyProps props, Long ts, String 
phoenixTableName, PTableType pTableType)
+throws SnapshotCreationException, 
IllegalArgumentException, IOException, InterruptedException,
+SQLException {
+srcTableName = SchemaUtil.normalizeIdentifier(srcTableName);
+if (!SchemaUtil.isNamespaceMappingEnabled(
+SchemaUtil.isSystemTable(srcTableName.getBytes()) ? 
PTableType.SYSTEM : null,
+props)) { throw new 
IllegalArgumentException(SchemaUtil.isSystemTable(srcTableName.getBytes())
+? "For system table " + 
QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE
++ " also needs to be enabled along with " 
+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED
+: QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " 
is not enabled"); }
+
+if (PTableType.TABLE.equals(pTableType) || 
PTableType.INDEX.equals(pTableType)) {
+admin.snapshot(srcTableName, srcTableName);
+admin.cloneSnapshot(srcTableName.getBytes(), 
destTableName.getBytes());
+admin.disableTable(srcTableName);
--- End diff --

Deleting srcTable will not delete the snapshot. 
And, Yes for restore only ,I thought we should not delete snapshot


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like feature on top of the table.
> Maybe to stay close to Hbase it could also be a create DB:Table...
> or DB.Table which is a more standard annotation?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58692384
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1279,4 +1304,129 @@ public static boolean truncateStats(HTableInterface 
metaTable, HTableInterface s
 }
 return false;
 }
+
+public static void mapTableToNamespace(HBaseAdmin admin, 
HTableInterface metatable, String srcTableName,
+String destTableName, ReadOnlyProps props, Long ts, String 
phoenixTableName, PTableType pTableType)
+throws SnapshotCreationException, 
IllegalArgumentException, IOException, InterruptedException,
+SQLException {
+srcTableName = SchemaUtil.normalizeIdentifier(srcTableName);
+if (!SchemaUtil.isNamespaceMappingEnabled(
+SchemaUtil.isSystemTable(srcTableName.getBytes()) ? 
PTableType.SYSTEM : null,
+props)) { throw new 
IllegalArgumentException(SchemaUtil.isSystemTable(srcTableName.getBytes())
+? "For system table " + 
QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE
++ " also needs to be enabled along with " 
+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED
+: QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " 
is not enabled"); }
+
+if (PTableType.TABLE.equals(pTableType) || 
PTableType.INDEX.equals(pTableType)) {
+admin.snapshot(srcTableName, srcTableName);
+admin.cloneSnapshot(srcTableName.getBytes(), 
destTableName.getBytes());
+admin.disableTable(srcTableName);
--- End diff --

Deleting srcTable will not delete the snapshot. 
And, Yes for restore only ,I thought we should not delete snapshot


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-1311) HBase namespaces surfaced in phoenix

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-1311:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58687494
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java ---
@@ -897,4 +941,86 @@ public static boolean hasRowTimestampColumn(PTable 
table) {
 PName schemaName = dataTable.getSchemaName();
 return getTableKey(tenantId == null ? ByteUtil.EMPTY_BYTE_ARRAY : 
tenantId.getBytes(), schemaName == null ? ByteUtil.EMPTY_BYTE_ARRAY : 
schemaName.getBytes(), dataTable.getTableName().getBytes());
 }
+
+public static byte[] getSchemaKey(String schemaName) {
+return SchemaUtil.getTableKey(null, schemaName, 
MetaDataClient.EMPTY_TABLE);
+}
+
+public static PName getPhysicalHBaseTableName(PName pName, boolean 
isNamespaceMapped, PTableType type) {
+return getPhysicalHBaseTableName(pName.toString(), 
isNamespaceMapped, type);
+}
+
+public static PName getPhysicalHBaseTableName(byte[] tableName, 
boolean isNamespaceMapped, PTableType type) {
+return getPhysicalHBaseTableName(Bytes.toString(tableName), 
isNamespaceMapped, type);
+}
+
+public static TableName getPhysicalTableName(String fullTableName, 
ReadOnlyProps readOnlyProps) {
+return getPhysicalName(Bytes.toBytes(fullTableName), 
readOnlyProps);
+}
+
+public static TableName getPhysicalTableName(byte[] fullTableName, 
Configuration conf) {
+return getPhysicalTableName(fullTableName, 
isNamespaceMappingEnabled(
+isSystemTable(fullTableName) ? PTableType.SYSTEM : null, 
new ReadOnlyProps(conf.iterator(;
+}
+
+public static TableName getPhysicalName(byte[] fullTableName, 
ReadOnlyProps readOnlyProps) {
+return getPhysicalTableName(fullTableName,
+isNamespaceMappingEnabled(isSystemTable(fullTableName) ? 
PTableType.SYSTEM : null, readOnlyProps));
+}
+
+public static TableName getPhysicalTableName(byte[] fullTableName, 
boolean isNamespaceMappingEnabled) {
+if (!isNamespaceMappingEnabled) { return 
TableName.valueOf(fullTableName); }
+String tableName = getTableNameFromFullName(fullTableName);
+String schemaName = getSchemaNameFromFullName(fullTableName);
+return TableName.valueOf(schemaName, tableName);
+}
+
+public static String getSchemaNameFromHBaseFullName(byte[] tableName, 
ReadOnlyProps props) {
+if (tableName == null) { return null; }
+int index = isNamespaceMappingEnabled(null, props) ? 
indexOf(tableName, QueryConstants.NAMESPACE_SEPARATOR_BYTE)
+: indexOf(tableName, QueryConstants.NAME_SEPARATOR_BYTE);
+if (index < 0) { return StringUtil.EMPTY_STRING; }
+return Bytes.toString(tableName, 0, index);
+}
+
+public static PName getPhysicalHBaseTableName(String tableName, 
boolean isNamespaceMapped, PTableType type) {
+if (!isNamespaceMapped) { return PNameFactory.newName(tableName); }
+return PNameFactory
+.newName(tableName.replace(QueryConstants.NAME_SEPARATOR, 
QueryConstants.NAMESPACE_SEPARATOR));
+}
+
+public static boolean isSchemaCheckRequired(PTableType tableType, 
ReadOnlyProps props) {
+if (PTableType.TABLE.equals(tableType) && 
isNamespaceMappingEnabled(tableType, props)) { return true; }
+return false;
+}
+
+public static boolean isNamespaceMappingEnabled(PTableType type, 
ReadOnlyProps readOnlyProps) {
+return 
readOnlyProps.getBoolean(QueryServices.IS_NAMESPACE_MAPPING_ENABLED,
+QueryServicesOptions.DEFAULT_IS_NAMESPACE_MAPPING_ENABLED)
+&& (type == null || !PTableType.SYSTEM.equals(type)
--- End diff --

Yes, null is allowed for type here. 


> HBase namespaces surfaced in phoenix
> 
>
> Key: PHOENIX-1311
> URL: https://issues.apache.org/jira/browse/PHOENIX-1311
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: nicolas maillard
>Assignee: Ankit Singhal
>Priority: Minor
> Fix For: 4.8.0
>
> Attachments: PHOENIX-1311.docx, PHOENIX-1311_v1.patch, 
> PHOENIX-1311_v2.patch, PHOENIX-1311_wip.patch, PHOENIX-1311_wip_2.patch
>
>
> Hbase (HBASE-8015) has the concept of namespaces in the form of 
> myNamespace:MyTable it would be great if Phoenix leveraged this feature to 
> give a database like 

[GitHub] phoenix pull request: PHOENIX-1311 HBase namespaces surfaced in ph...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/153#discussion_r58687494
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java ---
@@ -897,4 +941,86 @@ public static boolean hasRowTimestampColumn(PTable 
table) {
 PName schemaName = dataTable.getSchemaName();
 return getTableKey(tenantId == null ? ByteUtil.EMPTY_BYTE_ARRAY : 
tenantId.getBytes(), schemaName == null ? ByteUtil.EMPTY_BYTE_ARRAY : 
schemaName.getBytes(), dataTable.getTableName().getBytes());
 }
+
+public static byte[] getSchemaKey(String schemaName) {
+return SchemaUtil.getTableKey(null, schemaName, 
MetaDataClient.EMPTY_TABLE);
+}
+
+public static PName getPhysicalHBaseTableName(PName pName, boolean 
isNamespaceMapped, PTableType type) {
+return getPhysicalHBaseTableName(pName.toString(), 
isNamespaceMapped, type);
+}
+
+public static PName getPhysicalHBaseTableName(byte[] tableName, 
boolean isNamespaceMapped, PTableType type) {
+return getPhysicalHBaseTableName(Bytes.toString(tableName), 
isNamespaceMapped, type);
+}
+
+public static TableName getPhysicalTableName(String fullTableName, 
ReadOnlyProps readOnlyProps) {
+return getPhysicalName(Bytes.toBytes(fullTableName), 
readOnlyProps);
+}
+
+public static TableName getPhysicalTableName(byte[] fullTableName, 
Configuration conf) {
+return getPhysicalTableName(fullTableName, 
isNamespaceMappingEnabled(
+isSystemTable(fullTableName) ? PTableType.SYSTEM : null, 
new ReadOnlyProps(conf.iterator(;
+}
+
+public static TableName getPhysicalName(byte[] fullTableName, 
ReadOnlyProps readOnlyProps) {
+return getPhysicalTableName(fullTableName,
+isNamespaceMappingEnabled(isSystemTable(fullTableName) ? 
PTableType.SYSTEM : null, readOnlyProps));
+}
+
+public static TableName getPhysicalTableName(byte[] fullTableName, 
boolean isNamespaceMappingEnabled) {
+if (!isNamespaceMappingEnabled) { return 
TableName.valueOf(fullTableName); }
+String tableName = getTableNameFromFullName(fullTableName);
+String schemaName = getSchemaNameFromFullName(fullTableName);
+return TableName.valueOf(schemaName, tableName);
+}
+
+public static String getSchemaNameFromHBaseFullName(byte[] tableName, 
ReadOnlyProps props) {
+if (tableName == null) { return null; }
+int index = isNamespaceMappingEnabled(null, props) ? 
indexOf(tableName, QueryConstants.NAMESPACE_SEPARATOR_BYTE)
+: indexOf(tableName, QueryConstants.NAME_SEPARATOR_BYTE);
+if (index < 0) { return StringUtil.EMPTY_STRING; }
+return Bytes.toString(tableName, 0, index);
+}
+
+public static PName getPhysicalHBaseTableName(String tableName, 
boolean isNamespaceMapped, PTableType type) {
+if (!isNamespaceMapped) { return PNameFactory.newName(tableName); }
+return PNameFactory
+.newName(tableName.replace(QueryConstants.NAME_SEPARATOR, 
QueryConstants.NAMESPACE_SEPARATOR));
+}
+
+public static boolean isSchemaCheckRequired(PTableType tableType, 
ReadOnlyProps props) {
+if (PTableType.TABLE.equals(tableType) && 
isNamespaceMappingEnabled(tableType, props)) { return true; }
+return false;
+}
+
+public static boolean isNamespaceMappingEnabled(PTableType type, 
ReadOnlyProps readOnlyProps) {
+return 
readOnlyProps.getBoolean(QueryServices.IS_NAMESPACE_MAPPING_ENABLED,
+QueryServicesOptions.DEFAULT_IS_NAMESPACE_MAPPING_ENABLED)
+&& (type == null || !PTableType.SYSTEM.equals(type)
--- End diff --

Yes, null is allowed for type here. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] phoenix pull request: PHOENIX-2722 support mysql limit,offset clau...

2016-04-06 Thread ankitsinghal
Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/154#discussion_r58678464
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/iterate/OffsetScanGrouper.java ---
@@ -0,0 +1,44 @@
+/*
+ * 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.iterate;
+
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.phoenix.compile.QueryPlan;
+
+/**
+ * Default implementation that creates a scan group if a plan is row key 
ordered (which requires a merge sort),
+ * or if a scan crosses a region boundary and the table is salted or a 
local index.   
+ */
+public class OffsetScanGrouper implements ParallelScanGrouper {
--- End diff --

It seems for serialIterators also , we use DefaultParallelScanGrouper for 
splitting scans in groups by condition `(isSalted || table.getIndexType() == 
IndexType.LOCAL) && ScanUtil.shouldRowsBeInRowKeyOrder(orderBy, context)` and 
run each group in one thread.

Anyways, I have modified the plan to run offset on server by including this 
condition and re-use the DefaultParallelScanGrouper


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-2722) support mysql "limit,offset" clauses

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-2722:
-

Github user ankitsinghal commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/154#discussion_r58678464
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/iterate/OffsetScanGrouper.java ---
@@ -0,0 +1,44 @@
+/*
+ * 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.iterate;
+
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.phoenix.compile.QueryPlan;
+
+/**
+ * Default implementation that creates a scan group if a plan is row key 
ordered (which requires a merge sort),
+ * or if a scan crosses a region boundary and the table is salted or a 
local index.   
+ */
+public class OffsetScanGrouper implements ParallelScanGrouper {
--- End diff --

It seems for serialIterators also , we use DefaultParallelScanGrouper for 
splitting scans in groups by condition `(isSalted || table.getIndexType() == 
IndexType.LOCAL) && ScanUtil.shouldRowsBeInRowKeyOrder(orderBy, context)` and 
run each group in one thread.

Anyways, I have modified the plan to run offset on server by including this 
condition and re-use the DefaultParallelScanGrouper


> support mysql "limit,offset" clauses 
> -
>
> Key: PHOENIX-2722
> URL: https://issues.apache.org/jira/browse/PHOENIX-2722
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: Ankit Singhal
>Assignee: Ankit Singhal
>Priority: Minor
> Attachments: PHOENIX-2722.patch, PHOENIX-2722_formatted.patch
>
>
> For serial query(query with “serial" hint or  “limit" without "order by”), we 
> can limit each scan(using page filter) to “limit+offset” instead of limit 
> earlier.
> And then, for all queries, we can forward the relevant client iterators to 
> the offset provided and then return the result.
> syntax
> {code}
> [ LIMIT { count } ]
> [ OFFSET start [ ROW | ROWS ] ]
> [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
> {code}
> Some new keywords(OFFSET,FETCH,ROW, ROWS,ONLY) are getting introduced so 
> users might need to see that they are not using them as column name or 
> something.
> WDYT, [~jamestaylor]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Re: Error while attempting join query

2016-04-06 Thread Deepak Gopalakrishnan
Hello All,

Does the package available here :
http://a.mbbsindia.com/phoenix/phoenix-4.6.0-HBase-0.98/bin/ support
HBase-0.94.18 ?

If not, is there a version that is supported for HBase-0.94.18 ?

Please help!

On Wed, Apr 6, 2016 at 10:42 AM, Deepak Gopalakrishnan 
wrote:

> Adding Dev group
>
> On Wed, Apr 6, 2016 at 10:35 AM, Deepak Gopalakrishnan 
> wrote:
>
>> Hello All,
>>
>> I did move on to 4.7 and my HBase version is 0.98+. Below is the script I
>> execute in order to get it installed before HBase is started.
>>
>>
>>
>> After doing this on all nodes ( including master ), when I try a
>> ./sqline.py localhost, it just freezes and doesnt proceed. Can someone
>> please help ?
>>
>>
>> #!/bin/sh
>> mkdir /home/hadoop/phoenix/
>> wget
>> http://mirror.fibergrid.in/apache/phoenix/phoenix-4.7.0-HBase-0.98/bin/phoenix-4.7.0-HBase-0.98-bin.tar.gz
>> -P /home/hadoop/phoenix/
>> cd /home/hadoop/phoenix/
>> tar -xvf phoenix-4.7.0-HBase-0.98-bin.tar.gz
>> cp -r phoenix-4.7.0-HBase-0.98-bin/phoenix-*.jar /home/hadoop/hbase/lib/
>>
>> On Tue, Apr 5, 2016 at 10:39 PM, Deepak Gopalakrishnan 
>> wrote:
>>
>>> Hello James,
>>>
>>> Sure I understand. But any idea why JOIN fails on the server ? Is it not
>>> supported on 2.1.2 ?
>>>
>>> Thanks
>>> Deepak
>>>
>>> On Tue, Apr 5, 2016 at 9:48 PM, James Taylor 
>>> wrote:
>>>
 Support for the 2.x line was dropped over a year ago. I'd recommend
 encouraging the EMR folks to upgrade to the latest version of Phoenix and
 HBase.


 On Tuesday, April 5, 2016, Deepak Gopalakrishnan 
 wrote:

> Hello,
>
> I'm trying to join two tables that I created using Phoenix. My tables
> are A and B. I've setup phoenix on EMR using
> https://phoenix.apache.org/phoenix_on_emr.html. I've used the
> phoenix-2.1.2 version and I can do basic queries like SELECT. But when I
> try a join, I get an error. It looks like the SQL query is not even being
> parsed. I'm not sure what I'm doing here. I'm using the sqline client on
> the server itself.
>
> select A.name,B.dname from A as a inner join B as b on a.name=b.name;
>
> Error: ERROR 602 (42P00): Syntax error. Missing "EOF" at line 1,
> column 35. (state=42P00,code=602)
> Please let me know if you guys can help ?
>
> --
> Regards,
> *Deepak Gopalakrishnan*
> *Mobile*:+918891509774
> *Skype* : deepakgk87
> http://myexps.blogspot.com
>
>
>>>
>>>
>>> --
>>> Regards,
>>> *Deepak Gopalakrishnan*
>>> *Mobile*:+918891509774
>>> *Skype* : deepakgk87
>>> http://myexps.blogspot.com
>>>
>>>
>>
>>
>> --
>> Regards,
>> *Deepak Gopalakrishnan*
>> *Mobile*:+918891509774
>> *Skype* : deepakgk87
>> http://myexps.blogspot.com
>>
>>
>
>
> --
> Regards,
> *Deepak Gopalakrishnan*
> *Mobile*:+918891509774
> *Skype* : deepakgk87
> http://myexps.blogspot.com
>
>


-- 
Regards,
*Deepak Gopalakrishnan*
*Mobile*:+918891509774
*Skype* : deepakgk87
http://myexps.blogspot.com


[GitHub] phoenix pull request: PHOENIX-2722 support mysql limit,offset clau...

2016-04-06 Thread JamesRTaylor
Github user JamesRTaylor commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/154#discussion_r58661601
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/iterate/OffsetScanGrouper.java ---
@@ -0,0 +1,44 @@
+/*
+ * 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.iterate;
+
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.phoenix.compile.QueryPlan;
+
+/**
+ * Default implementation that creates a scan group if a plan is row key 
ordered (which requires a merge sort),
+ * or if a scan crosses a region boundary and the table is salted or a 
local index.   
+ */
+public class OffsetScanGrouper implements ParallelScanGrouper {
--- End diff --

Scans aren't done in parallel for SerialIterator, they're done serially. 
Have you tried it without this? I can't figure out what purpose it's serving, 
but perhaps I'm missing something?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-2722) support mysql "limit,offset" clauses

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-2722:
-

Github user JamesRTaylor commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/154#discussion_r58661601
  
--- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/iterate/OffsetScanGrouper.java ---
@@ -0,0 +1,44 @@
+/*
+ * 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.iterate;
+
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.phoenix.compile.QueryPlan;
+
+/**
+ * Default implementation that creates a scan group if a plan is row key 
ordered (which requires a merge sort),
+ * or if a scan crosses a region boundary and the table is salted or a 
local index.   
+ */
+public class OffsetScanGrouper implements ParallelScanGrouper {
--- End diff --

Scans aren't done in parallel for SerialIterator, they're done serially. 
Have you tried it without this? I can't figure out what purpose it's serving, 
but perhaps I'm missing something?


> support mysql "limit,offset" clauses 
> -
>
> Key: PHOENIX-2722
> URL: https://issues.apache.org/jira/browse/PHOENIX-2722
> Project: Phoenix
>  Issue Type: New Feature
>Reporter: Ankit Singhal
>Assignee: Ankit Singhal
>Priority: Minor
> Attachments: PHOENIX-2722.patch, PHOENIX-2722_formatted.patch
>
>
> For serial query(query with “serial" hint or  “limit" without "order by”), we 
> can limit each scan(using page filter) to “limit+offset” instead of limit 
> earlier.
> And then, for all queries, we can forward the relevant client iterators to 
> the offset provided and then return the result.
> syntax
> {code}
> [ LIMIT { count } ]
> [ OFFSET start [ ROW | ROWS ] ]
> [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
> {code}
> Some new keywords(OFFSET,FETCH,ROW, ROWS,ONLY) are getting introduced so 
> users might need to see that they are not using them as column name or 
> something.
> WDYT, [~jamestaylor]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2822) Tests that extend BaseHBaseManagedTimeIT are very slow

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-2822:
-

Github user JamesRTaylor commented on the pull request:

https://github.com/apache/phoenix/pull/158#issuecomment-206168313
  
@samarthjain - would you mind reviewing and committing if it looks good to 
you?


> Tests that extend BaseHBaseManagedTimeIT are very slow
> --
>
> Key: PHOENIX-2822
> URL: https://issues.apache.org/jira/browse/PHOENIX-2822
> Project: Phoenix
>  Issue Type: Improvement
>Affects Versions: 4.8.0
>Reporter: churro morales
>Assignee: churro morales
>  Labels: HBASEDEPENDENCIES
>
> Since I am trying to refactor out all the hbase private dependencies, I have 
> to constantly run tests to make sure I didn't break anything.  The tests that 
> extend BaseHBaseManagedTimeIT are very slow as they have to delete all 
> non-system tables after every test case.  This takes around 5-10 seconds to 
> accomplish.  This adds significant time to the test suite. 
> I created a new class named: BaseHBaseManagedTimeTableReuseIT and it creates 
> a random table name such that we dont have collisions for tests.  It also 
> doesn't do any cleanup after each test case or class because these table 
> names should be unique.  I moved about 30-35 tests out from 
> BaseHBaseManagedTimeIT to BaseHBaseManagedTimeTableReuseIT and it 
> significantly improved the overall time it takes to run tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-2822 - Tests that extend BaseHBaseMa...

2016-04-06 Thread JamesRTaylor
Github user JamesRTaylor commented on the pull request:

https://github.com/apache/phoenix/pull/158#issuecomment-206168313
  
@samarthjain - would you mind reviewing and committing if it looks good to 
you?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (PHOENIX-2822) Tests that extend BaseHBaseManagedTimeIT are very slow

2016-04-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on PHOENIX-2822:
-

Github user JamesRTaylor commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/158#discussion_r58660241
  
--- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java 
---
@@ -43,9 +44,10 @@ public void initTable() throws Exception {
 Connection conn = null;
 PreparedStatement stmt = null;
 try {
+System.out.println("TABLE_NAME = " + TABLE_NAME);
--- End diff --

Minor nit - remove this.


> Tests that extend BaseHBaseManagedTimeIT are very slow
> --
>
> Key: PHOENIX-2822
> URL: https://issues.apache.org/jira/browse/PHOENIX-2822
> Project: Phoenix
>  Issue Type: Improvement
>Affects Versions: 4.8.0
>Reporter: churro morales
>Assignee: churro morales
>  Labels: HBASEDEPENDENCIES
>
> Since I am trying to refactor out all the hbase private dependencies, I have 
> to constantly run tests to make sure I didn't break anything.  The tests that 
> extend BaseHBaseManagedTimeIT are very slow as they have to delete all 
> non-system tables after every test case.  This takes around 5-10 seconds to 
> accomplish.  This adds significant time to the test suite. 
> I created a new class named: BaseHBaseManagedTimeTableReuseIT and it creates 
> a random table name such that we dont have collisions for tests.  It also 
> doesn't do any cleanup after each test case or class because these table 
> names should be unique.  I moved about 30-35 tests out from 
> BaseHBaseManagedTimeIT to BaseHBaseManagedTimeTableReuseIT and it 
> significantly improved the overall time it takes to run tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] phoenix pull request: PHOENIX-2822 - Tests that extend BaseHBaseMa...

2016-04-06 Thread JamesRTaylor
Github user JamesRTaylor commented on a diff in the pull request:

https://github.com/apache/phoenix/pull/158#discussion_r58660241
  
--- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java 
---
@@ -43,9 +44,10 @@ public void initTable() throws Exception {
 Connection conn = null;
 PreparedStatement stmt = null;
 try {
+System.out.println("TABLE_NAME = " + TABLE_NAME);
--- End diff --

Minor nit - remove this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---