Сreate a note using Phoenix
NOTE
Before creating a note, make sure that your Phoenix interpreter is configured as described in the Add a custom interpreter to a group article.
|
-
In the Zeppelin web UI, click the Create new note list item or click the main menu item Notebook → Create new note.
Adding a new noteAdding a new note -
In the opened dialog, enter the note name and select the default interpreter that will be used in cases when the interpreter type is not specified explicitly. Notice that you can create different folders for your notes. Then, click Create.
Describing a new noteDescribing a new note -
In the opened window, click the Interpreter binding icon to view the available interpreters.
Switch to binding interpretersSwitch to binding interpreters -
Verify that the interpreters
%jdbc
and%phoenix
are selected in the opened list, select them otherwise. Click Save.NOTEYou can use only one interpreter, however this section shows working with both of them.Binding necessary interpretersBinding necessary interpreters -
First, use the %jdbc interpreter with the settings marked with the
phoenix_
prefix. Enter the following code in the first paragraph of your note. This query returns the number of books grouped by their first publication year.%jdbc(phoenix) SELECT PUBLIC_YEAR as "Year", (PUBLIC_YEAR + 99) / 100 as "Century", COUNT(*) as "Count" FROM BEST_BOOKS GROUP BY PUBLIC_YEAR
NOTEThis query uses theBEST_BOOKS
table. Its creation is described in Bulk loading in Phoenix. If you did not create this table, you can run any other query on your Phoenix tables. -
To run the code, click Run this paragraph.
Running the codeRunning the code -
View the query results in the table form.
Results tableResults tableTIPYou can also use other result visualization types. To do this, click the icon that corresponds to the specified view mode, expand the settings pane, and distribute output fields of your query between available axes. Use drag-and-drop method for this purpose.
Bar chart with resultsBar chart with resultsAvailable result visualization typesA pie chartA pie chartAn area chartAn area chartA line chartA line chartA scatter chartA scatter chart -
Create the second note paragraph to use the %phoenix interpreter. You can use the paragraph that is automatically created after successful running of the first paragraph. Or you can add a new paragraph by clicking the Add Paragraph button that becomes visible on hover.
Adding a new note paragraphAdding a new note paragraph -
Enter the following code in the second paragraph and run it. This query returns the rows count from the
BEST_BOOKS
table.%phoenix SELECT COUNT(*) FROM BEST_BOOKS
Running the codeRunning the code