Dear Wiki user, You have subscribed to a wiki page or wiki category on "Lucene-hadoop Wiki" for change notification.
The following page has been changed by udanax: http://wiki.apache.org/lucene-hadoop/HbaseShell ------------------------------------------------------------------------------ ---- - = Hbase Shell Syntax Definition = + = Hbase Shell Client Syntax Definition = '''Note''' that Data should be located by their row, column, and timestamp. - == Basic Commands == + == Commands == ||<bgcolor="#ececec">'''Command''' ||<bgcolor="#ececec">'''Explanation''' || ||HELP ||<99%>'''Help''' command provides information about the use of shell script.[[BR]][[BR]]~-''HELP [function_name];''-~ || ||SHOW ||<99%>'''Show''' command will list the tables.[[BR]][[BR]]~-''SHOW tables;''-~ || ||DESC ||'''Desc''' command will provides information about the columnfamilies in a table.[[BR]][[BR]]~-''DESC table_name;''-~ || ||CREATE ||'''Create''' command will create a new table.[[BR]][[BR]]~-''CREATE table_name[[BR]]COLUMNFAMILIES('columnfamily_name1'[, 'columnfamily_name2', ...])[[BR]][LIMIT=limitNumber_of_Version];''-~ || ||DROP ||'''Drop''' command will droping columnfamilies in a table or tables.[[BR]][[BR]]~-''DROP table_name1[, table_name2, ...] or columnfamily_name1[, columnfamily_name2, ...];''-~ || - ||SUBSTITUTE[[BR]] || '''Substitute''' query to [A~Z][[BR]][[BR]]~-''X = MAPSET('table_name', 'columnfamily_name');''-~|| + ||SUBSTITUTE[[BR]] || '''Substitute''' query to [A~Z][[BR]][[BR]]~-''X = Matrix(table_name, columnfamily_name);''-~|| + ||STORE ||'''STORE''' command will store results to specified table. [[BR]][[BR]]~-''A = Table('movieLog_table'); [[BR]]B = A.Selection('length' > 100); [[BR]]STORE B TO X run_style;''-~ || - ||MAPSET || '''Map Set''' || - ||ARRAY || '''Array''' || - ||MATRIX || '''Matrix''' || - ||VECTOR || '''Vector''' || - ||PRINT ||'''Print''' command will print a results to the console output. [[BR]][[BR]]~-''A = ARRAY([1, 2, 3]);[[BR]]PRINT A;[[BR]]B = SELECT table_name WHERE row='row_key';[[BR]]PRINT B;''-~ || - ||STORE ||'''STORE''' command will store results to specified table. [[BR]][[BR]]~-''M = matrix('table_name','columnfamily_name');[[BR]]A = array([[1, 2],[3, 4]]); //In this case, Key should be an integer index. [[BR]]STORE A TO M run_style;[[BR]]B = SELECT table_name WHERE row='row_key';[[BR]]STORE B TO ('table_name','columnfamily_name1'[, 'columnfamily_name2']) run_style;''-~ || ||EXIT ||<99%>'''Exit''' from the current shell script.[[BR]][[BR]]~-''EXIT;''-~ || And, Commands to manually manipulate data on more detailed parts. ||<bgcolor="#ececec">'''Command''' ||<bgcolor="#ececec">'''Explanation''' || - ||INSERT ||<99%>'''Insert''' command will insert one row into the table with a value for specified column in the table.[[BR]][[BR]]~-''INSERT table_name[[BR]] VALUES('columnfamily_name:column_key','entry')[[BR]]WHERE row='row_key';''-~ || + ||INSERT ||<99%>'''Insert''' command will insert one row into the table with a value for specified column in the table.[[BR]][[BR]]~-''INSERT table_name ('columnfamily_name1:column_key'[, 'columnfamily_name2:column_key', ...])[[BR]] VALUESVALUES ('entry1'[, 'entry2', ...])[[BR]]WHERE row='row_key';''-~ || ||SET ||'''SET''' command will change the values. [[BR]][[BR]]~-''SET table_name[[BR]] VALUES('columnfamily_name:column_key','entry')[[BR]]WHERE row='row_key' AND time='Specified_Timestamp';''-~ || ||DELETE ||'''Delete''' command will delete specified rows in table. [[BR]][[BR]]~-''DELETE table_name[[BR]]WHERE row='row_key'[[BR]][AND column='columnfamily_name:column_key'];''-~ || ||SELECT ||<99%>'''Select''' command will retrieves rows from a table.[[BR]][[BR]]~-''SELECT table_name[[BR]][WHERE row='row_key'][[BR]][AND column='columnfamily_name:column_key'];[[BR]][AND time='Specified_Timestamp'];[[BR]][LIMIT=Number_of_Version];''-~ || - === Relational Algebra Operators === + == Relational Operations == - Set Operations.. + ||<bgcolor="#ececec">'''Operators''' ||<bgcolor="#ececec">'''Explanation''' || + ||PROJECTION||<99%>is defined as the set that is obtained when all tuples in ~+R+~ are restricted to the set {a,,1,,,...,a,,n,,}.|| - ||UNION||<99%>'''Union''' AâªB contains all the elements of A and it contains all the elements of B.|| - ||INTERSECTION||<99%>'''Intersection''' Aâ©B is a subset of A and it is a subset of B.|| - ||DIFFERENCE||<99%>'''Difference''' of A and B (A-B).|| - - - A = MAPSET(table_T, columnfamily_A);[[BR]] - B = MAPSET(table_T, columnfamily_B);[[BR]] - - C = A.Union(B);[[BR]] - C = A.Intersection(B);[[BR]] - C = A.Difference(B); - - ||<bgcolor="#ececec">'''Operators''' ||<bgcolor="#ececec">'''Explanation''' || - ||PROJECTION||<99%>...|| ||SELECTION||<99%>...|| ||PRODUCT||<99%>...|| - ||RENAMING||<99%>...|| + ||RENAME||<99%>'''Rename''' r to x|| - ||GROUPING||<99%>...|| + ||GROUP||<99%>...|| ||SORT||<99%>...|| + ||<bgcolor="#ececec">'''Operators''' ||<bgcolor="#ececec">'''Explanation''' || + ||UNION ||<99%>'''Union''' AâªB contains all the elements of A and it contains all the elements of B.|| + ||INTERSECTION ||<99%>'''Intersection''' Aâ©B is a subset of A and it is a subset of B.|| + ||DIFFERENCE ||'''Difference''' of A and B (A-B).|| - A.Projection('year','length');[[BR]] - A.Selection('length' > 100); - - - === Aggregation Functions === ||<bgcolor="#ececec">'''Functions''' ||<bgcolor="#ececec">'''Explanation''' || ||AVG ||<99%>...|| @@ -107, +88 @@ ||MIN ||<99%>...|| ||MAX ||<99%>...|| - The Matrix commands are used to store a 2D array of numerical data values. [[BR]]A number of routines are provided to manipulate the matrix object directly, illustrated below by simple examples. - - '''Note''' that vectors should be defined as two-dimensional matrices to distinguish between row and column vectors [[BR]]in order to be able to perform matrix operations consistently. - - === Matrix Construction Functions === - .. - - === Matrix Algebra Functions === + == Matrix Operations == - .. - === Special functions === - .. + ||<bgcolor="#ececec">'''Operation''' ||<bgcolor="#ececec">'''Explanation''' || + ||DOUBLEMATRIX||<99%>...|| + ||BOOLEANMATRIX||<99%>...|| + + ||<bgcolor="#ececec">'''Functions''' ||<bgcolor="#ececec">'''Explanation''' || + ||QR ||<99%>...|| + ||LU||<99%>...|| + ||SVD ||<99%>...|| + ---- = Example Of Hbase Shell Use = == Basic Usage == - {{{ + === Create the table in a HBase === + - Hbase > CREATE movieLog_table + ~-''CREATE movieLog_table - --> COLUMNFAMILIES('year','length','inColor','studioName',vote','producer') + [[BR]]COLUMNFAMILIES('year', 'length', 'inColor', 'studioName', 'vote', 'producer') - --> limit=10; + [[BR]]LIMIT=1;''-~ - }}} + === Insert data into a table === + ~-''INSERT table_name ('year:', 'length:', 'inColor:', 'studioName:', 'vote:user_1', 'producer') + [[BR]]VALUES ('1977', '124', 'true', 'Fox', '5', 'George Lucas') + [[BR]]WHERE row='Star Wars';''-~ - '''movieLog_table''' + === Show all data in a table === + ~-''SELECT movieLog_table;''-~ + ||Row Key ||<-12>Column Families || - ||<rowbgcolor="#ececec">title ||<-2> year ||<-2>length ||<-2>inColor ||<-2> studioName ||<-2> vote ||<-2> producer || + ||<rowbgcolor="#ececec">title ||<-2> year ||<-2>length ||<-2>inColor ||<-2> studioName ||<-2> vote ||<-2> producer || ||Star Wars ||year: || 1977 ||length: || 124 ||inColor: || true ||studioName: || Fox || vote:''user_1'' || 5 || producer: || George Lucas || || || || || || || || || || || vote:''user_2'' || 2 || || || ||Mighty Ducks ||year: || 1991 ||length: || 104 ||inColor: || true ||studioName: || Disney || vote:''user_1'' || 2 || producer: || Blair Peters || @@ -141, +127 @@ || || || || || || || || || || vote:''user_3'' || 4 || || || - == Relation Algebra Operations == + == Relation Operations == - '''Projection''' + === Projection === + + ~-''A = Table('movieLog_table'); + [[BR]]B = A.Projection('year','length');''-~ '''~+^Ï^+~'''~-title-~,~-year-~,~-length-~'''~+^(movieLog_table)^+~''' @@ -154, +143 @@ - '''Selection''' + === Selection === + + ~-''A = Table('movieLog_table'); + [[BR]]B = A.Selection('length' > 100);''-~ '''~+^Ï^+~'''~-length>100-~'''~+^(movieLog_table)^+~''' @@ -163, +155 @@ ||Mighty Ducks ||1991 ||104 ||true ||Disney ||67890 || - '''Example''' + === Example === + ~-''A = Table('movieLog_table'); + [[BR]]B = A.Selection(length > 100 AND studioName = 'Fox'); + [[BR]]C = B.Projection('year');''-~ + - '''~+^Ï^+~'''~-title-~,~-year-~'''~+^Ï^+~'''~-length>100-~'''~+^(movieLog_table)â©Ï^+~'''~-studioName='Fox'-~'''~+^(movieLog_table))^+~''' + '''~+^Ï^+~'''~-title-~,~-year-~'''~+^(Ï^+~'''~-length>100-~'''~+^(movieLog_table)â©Ï^+~'''~-studioName='Fox'-~'''~+^(movieLog_table))^+~''' + + ||<rowbgcolor="#ececec">title ||year || + ||Star Wars ||1977 || == Matrix Operations == - {{{ - Hbase > A = matrix('movieLog_table', 'vote'); - Hbase > PRINT A; - }}} + Lets construct a abstract sparse row-by-column matrix. + + ~-''A = doubleMatrix('movieLog_table','vote');''-~ ||<rowbgcolor="#ececec"> ||user_1 ||user_2 ||user_3 || - ||<bgcolor="#ececec">Star Wars || 5 || 2 || 0 || + ||<bgcolor="#ececec">Star Wars || 5.0 || 2.0 || || - ||<bgcolor="#ececec">Mighty Ducks || 2 || 0 || 4 || + ||<bgcolor="#ececec">Mighty Ducks || 2.0 || || 4.0 || - ||<bgcolor="#ececec">Wayne's World || 0 || 3 || 4 || + ||<bgcolor="#ececec">Wayne's World || || 3.0 || 4.0 || + ---- = Matrix Extension Example On Hbase Shell = @@ -194, +193 @@ == Scalable Collaborative Filtering With A Large User-By-Item Matrix == - .. + + Title-By-Title Triangular Matrix + + ||<rowbgcolor="#ececec"> ||Star Wars ||Mighty Ducks ||Wayne's World || + ||<bgcolor="#ececec">Star Wars || || 0.415 || 0.222 || + ||<bgcolor="#ececec">Mighty Ducks || || || 0.715 || + ||<bgcolor="#ececec">Wayne's World || || || || + == Consistency Assessment Of Topological Relationship By Matrix-Union == .. + + ---- + = Performance Reports = + .. + ---- = People Involved =