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

Artem Ervits commented on HBASE-18269:
--------------------------------------

[~mdrob] sure thing, I made the second example work with the following code
{code:java}
import java.lang
from org.apache.hadoop.hbase import TableName, HBaseConfiguration
from org.apache.hadoop.hbase.client import Connection, ConnectionFactory, 
Result, ResultScanner, Table, Admin
from org.apache.hadoop.conf import Configuration
conf = HBaseConfiguration.create()
connection = ConnectionFactory.createConnection(conf)
admin = connection.getAdmin()
tableName = TableName.valueOf('wiki')
table = connection.getTable(tableName)

cf = "title"
attr = "attr"
scanner = table.getScanner(cf)
while 1:
   result = scanner.next()
   if not result:
      break
   print java.lang.String(result.row), java.lang.String(result.getValue(cf, 
attr)){code}
Let me know if this suffices as the example uses result.get(col).value and I'm 
getting
{code:java}
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
AttributeError: 'org.apache.hadoop.hbase.client.Result' object has no attribute 
'get'{code}
I changed to getValue instead and now actually use the CF and Qualifier. So the 
only change in functionality is that I don't do cf="title:.*$" unless you can 
hint at how I can do that here. I can work on the second example after that.

> Jython docs out of date
> -----------------------
>
>                 Key: HBASE-18269
>                 URL: https://issues.apache.org/jira/browse/HBASE-18269
>             Project: HBase
>          Issue Type: Bug
>          Components: documentation
>            Reporter: Mike Drob
>            Assignee: Artem Ervits
>            Priority: Major
>              Labels: beginner
>
> The documentation describing how to launch Jython + HBase is out of date. - 
> https://hbase.apache.org/book.html#jython
> First, we would set the classpath differently:
> {noformat}
> HBASE_CLASSPATH=/home/hbase/jython.jar bin/hbase org.python.util.jython
> {noformat}
> Then, the actual code example is out of date too:
> {noformat}
> >>> desc = HTableDescriptor(tablename)
> >>> desc.addFamily(HColumnDescriptor("content:"))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>       at 
> org.apache.hadoop.hbase.HColumnDescriptor.isLegalFamilyName(HColumnDescriptor.java:566)
>       at 
> org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:470)
>       at 
> org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:425)
>       at 
> org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:390)
>       at 
> org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:338)
>       at 
> org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:327)
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>       at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>       at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>       at 
> org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:211)
> {noformat}
> We should make sure that the examples we claim are runnable actually are.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to