Member since
04-22-2016
931
Posts
46
Kudos Received
26
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 1852 | 10-11-2018 01:38 AM | |
| 2217 | 09-26-2018 02:24 AM | |
| 2244 | 06-29-2018 02:35 PM | |
| 2913 | 06-29-2018 02:34 PM | |
| 6093 | 06-20-2018 04:30 PM |
06-11-2018
09:42 PM
i found this post from 2016 https://community.hortonworks.com/questions/51846/query-versions-in-phoenix.html Is it still not possible to query all the versions of an hbase column?
... View more
Labels:
06-11-2018
04:44 PM
yes that fixed the issue ..thanks a lot
... View more
06-11-2018
03:39 PM
the 'select * from emp' command works but if i execute the command 'select count(*) from emp' from a java api it fails. i am giving the code and the error below . code # cat phoenixTest.java
import java.sql.*;
import java.util.*;
import org.apache.phoenix.jdbc.PhoenixDriver;
public class phoenixTest {
public static void main(String args[]) throws Exception {
Connection conn;
Properties prop = new Properties();
Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
conn = DriverManager.getConnection("jdbc:phoenix:hadoop1:2181:/hbase-unsecure");
System.out.println("got connection");
ResultSet rst = conn.createStatement().executeQuery("select count(*) from emp");
while (rst.next()) {
System.out.println(rst.getString(1) + " " + rst.getString(2));
}
conn.commit();
}
}
error got connection
18/06/11 11:30:23 DEBUG jdbc.PhoenixStatement: Execute query: select count(*) from emp
18/06/11 11:30:23 DEBUG compile.FromCompiler: Re-resolved stale table EMP with seqNum 2 at timestamp 1522943831949 with 3 columns: [ID, 0 .FNAME, 0.LNAME]
18/06/11 11:30:23 DEBUG compile.FromCompiler: Re-resolved stale table LNAMEIDX with seqNum 0 at timestamp 1522943474697 with 2 columns: [ 0:LNAME, :ID]
18/06/11 11:30:23 DEBUG compile.FromCompiler: Re-resolved stale table EMP with seqNum 2 at timestamp 1522943831949 with 3 columns: [ID, 0 .FNAME, 0.LNAME]
18/06/11 11:30:23 DEBUG compile.FromCompiler: Re-resolved stale table LNAMEIDXCOVER with seqNum 0 at timestamp 1522943831949 with 3 colum ns: [0:LNAME, :ID, 0.0:FNAME]
18/06/11 11:30:23 DEBUG compile.FromCompiler: Re-resolved stale table EMP with seqNum 2 at timestamp 1522943831949 with 3 columns: [ID, 0 .FNAME, 0.LNAME]
18/06/11 11:30:23 DEBUG execute.BaseQueryPlan: Scan ready for iteration: {"loadColumnFamiliesOnDemand":null,"startRow":"","stopRow":"","b atch":-1,"cacheBlocks":true,"totalColumns":0,"maxResultSize":-1,"families":{},"caching":100,"maxVersions":1,"timeRange":[0,1528731024323] }
18/06/11 11:30:23 DEBUG ipc.AbstractRpcClient: Use SIMPLE authentication for service ClientService, sasl=false
18/06/11 11:30:23 DEBUG ipc.AbstractRpcClient: Connecting to hadoop4.tolls.dot.state.fl.us/10.100.44.18:16020
18/06/11 11:30:23 DEBUG execute.BaseQueryPlan: Iterator ready: UngroupedAggregatingResultIterator [hasRows=false, aggregators=org.apache. phoenix.expression.aggregator.ClientAggregators [1]: 0) COUNT(1)]
18/06/11 11:30:23 DEBUG jdbc.PhoenixStatement: Explain plan: CLIENT 1-CHUNK 0 ROWS 0 BYTES PARALLEL 1-WAY FULL SCAN OVER LNAMEIDX
SERVER FILTER BY FIRST KEY ONLY
SERVER AGGREGATE INTO SINGLE ROW
18/06/11 11:30:23 DEBUG iterate.BaseResultIterators: Getting iterators for ResultIterators [name=PARALLEL,id=57d408d6-987a-412f-8ace-2293 2851ed10,scans=[[{"loadColumnFamiliesOnDemand":null,"filter":"FirstKeyOnlyFilter","startRow":"","stopRow":"","batch":-1,"cacheBlocks":tru e,"totalColumns":1,"maxResultSize":-1,"families":{"0":["_0"]},"caching":100,"maxVersions":1,"timeRange":[0,1528731024323]}]]]
18/06/11 11:30:23 DEBUG iterate.ParallelIterators: Id: 57d408d6-987a-412f-8ace-22932851ed10, Time: 10ms, Scan: {"loadColumnFamiliesOnDema nd":null,"filter":"FirstKeyOnlyFilter","startRow":"","stopRow":"","batch":-1,"cacheBlocks":true,"totalColumns":1,"maxResultSize":2097152, "families":{"0":["_0"]},"caching":100,"maxVersions":1,"timeRange":[0,1528731024323]}
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
at org.apache.phoenix.compile.RowProjector.getColumnProjector(RowProjector.java:167)
at org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:606)
at phoenixTest.main(phoenixTest.java:14)
18/06/11 11:30:23 DEBUG util.ShutdownHookManager: ShutdownHookManger complete shutdown.
... View more
Labels:
06-11-2018
03:32 PM
i fixed this issue by copying htrace-core-2.04.jar file in the $HBASE_HOME/lib folder.
... View more
06-11-2018
03:12 PM
do you mean put this in pom if already not there before compiling ? I don't get error compiling , I am getting run time error. also where can I find this pom file ?
... View more
06-08-2018
09:25 PM
this code is giving me compilation error ,whats wrong? [root@hadoop1 ~]# javac -classpath /usr/hdp/2.6.4.0-91/hbase/lib/hbase-client-1.1.2.2.6.4.0-91.jar:/usr/hdp/2.6.4.0-91/phoenix/*:/usr/hdp/2.6.4.0-91/hbase/conf/hbase-site.xml:. CreateHbaseTable.java
CreateHbaseTable.java:12: error: <identifier> expected
config.set("zookeeper.znode.parent","/hbase-unsecure");
^
CreateHbaseTable.java:12: error: illegal start of type
config.set("zookeeper.znode.parent","/hbase-unsecure");
^
CreateHbaseTable.java:12: error: illegal start of type
config.set("zookeeper.znode.parent","/hbase-unsecure");
^
CreateHbaseTable.java:13: error: <identifier> expected
config.set("hbase.zookeeper.quorum", "hadoop1,hadoop2");
^
CreateHbaseTable.java:13: error: illegal start of type
config.set("hbase.zookeeper.quorum", "hadoop1,hadoop2");
^
CreateHbaseTable.java:13: error: illegal start of type
config.set("hbase.zookeeper.quorum", "hadoop1,hadoop2");
[root@hadoop1 ~]# more CreateHbaseTable.java
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.util.Bytes;
public class CreateHbaseTable {
Configuration config = HBaseConfiguration.create();
config.set("zookeeper.znode.parent","/hbase-unsecure");
config.set("hbase.zookeeper.quorum", "hadoop1,hadoop2");
config.set("hbase.zookeeper.property.clientPort", "2181");
config.set("hbase.cluster.distributed", "true");
config.set("zookeeper.znode.parent","/hbase-unsecure");
public void createtable(String name,String[] colfamily) throws MasterNotRunningException,
ZooKeeperConnectionException, IOException
{
HBaseAdmin admin = new HBaseAdmin(config);
HTableDescriptor des = new HTableDescriptor(Bytes.toBytes(name));
for(int i=0;i<colfamily.length;i++){
des.addFamily(new HColumnDescriptor(colfamily[i]));
}
if(admin.tableExists(name)){
System.out.println("Table already exist");
}
else{
admin.createTable(des);
System.out.println("Table: "+name+ " Sucessfully created");
}
}
public static void main(String args[]) throws MasterNotRunningException,
ZooKeeperConnectionException,IOException{
CreateHbaseTable op = new CreateHbaseTable();
String tablename = "Acadgild";
String[] familys = {"Emp_name","sal"};
op.createtable(tablename, familys);
}
}
You have new mail in /var/spool/mail/root
... View more
06-08-2018
09:21 PM
I tried to add it but its giving compilation error. I showed the command using server based hbase-site.xml. . why its not adding it?
Configuration config = HBaseConfiguration.create();
config.set("zookeeper.znode.parent","/hbase-unsecure");
... View more
06-08-2018
08:56 PM
where in this code I will specify the parent znode? are there any examples for HBASE JAVA api ? also I am specifying the hbase-site.xml in classpath as follows : java -classpath /usr/hdp/2.6.4.0-91/hbase/lib/hbase-client-1.1.2.2.6.4.0-91.jar:/usr/hdp/2.6.4.0-91/phoenix/*:/usr/hdp/2.6.4.0-91/hbase/conf/hbase-site.xml:. CreateHbaseTable
[root@hadoop1 ~]# vi CreateHbaseTable.java
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.util.Bytes;
public class CreateHbaseTable {
Configuration config = HBaseConfiguration.create();
public void createtable(String name,String[] colfamily) throws MasterNotRunningException,
ZooKeeperConnectionException, IOException
{
HBaseAdmin admin = new HBaseAdmin(config);
HTableDescriptor des = new HTableDescriptor(Bytes.toBytes(name));
for(int i=0;i<colfamily.length;i++){
des.addFamily(new HColumnDescriptor(colfamily[i]));
}
if(admin.tableExists(name)){
System.out.println("Table already exist");
}
else{
admin.createTable(des);
System.out.println("Table: "+name+ " Sucessfully created");
}
}
public static void main(String args[]) throws MasterNotRunningException,
ZooKeeperConnectionException,IOException{
CreateHbaseTable op = new CreateHbaseTable();
String tablename = "Acadgild";
String[] familys = {"Emp_name","sal"};
op.createtable(tablename, familys);
}
}
<br>
... View more