opensap: Big Data with SAP HANA Vora Course Week 03 - Exercises

Similar documents
HA215 SAP HANA Monitoring and Performance Analysis

Device Operation Process Diagrams. SAP Mobile Secure rapid-deployment solution September 2014

HA100 SAP HANA Introduction

HA300 SAP HANA Modeling

HA100 SAP HANA Introduction

HA100 SAP HANA Introduction

HA215 SAP HANA Monitoring and Performance Analysis

SAP Analytics Cloud model maintenance Restoring invalid model data caused by hierarchy conflicts

HA301. SAP HANA 2.0 SPS03 - Advanced Modeling COURSE OUTLINE. Course Version: 15 Course Duration:

BC414. Programming Database Updates COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

HA300 SAP HANA Modeling

HA150 SQL Basics for SAP HANA

Device Application Onboarding Process Diagrams. SAP Mobile Secure: SAP Afaria 7 SP5 September 2014

ADM505. Oracle Database Administration COURSE OUTLINE. Course Version: 15 Course Duration: 3 Day(s)

S4D430 Building Views in Core Data Services ABAP (CDS ABAP)

HA355. SAP HANA Smart Data Integration COURSE OUTLINE. Course Version: 12 Course Duration: 3 Day(s)

MDG100 Master Data Governance

SLT100. Real Time Replication with SAP LT Replication Server COURSE OUTLINE. Course Version: 13 Course Duration: 3 Day(s)

S4H01. Introduction to SAP S/4HANA COURSE OUTLINE. Course Version: 04 Course Duration: 2 Day(s)

Complementary Demo Guide

SAP Hybris Billing, Pricing Simulation Extended Functions Release 2.0, SP03

DS10. Data Services - Platform and Transforms COURSE OUTLINE. Course Version: 15 Course Duration: 3 Day(s)

SAP 3D Visual Enterprise 9.0: Localization of Authoring Content

HA150. SAP HANA 2.0 SPS02 - SQL and SQLScript for SAP HANA COURSE OUTLINE. Course Version: 14 Course Duration: 3 Day(s)

BC403 Advanced ABAP Debugging

BC404. ABAP Programming in Eclipse COURSE OUTLINE. Course Version: 16 Course Duration: 3 Day(s)

C4C30. SAP Cloud Applications Studio COURSE OUTLINE. Course Version: 21 Course Duration: 4 Day(s)

BW305H. Query Design and Analysis with SAP Business Warehouse Powered by SAP HANA COURSE OUTLINE. Course Version: 15 Course Duration: 5 Day(s)

ADM506. Database Administration Oracle II COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

BOD410 SAP Lumira 2.0 Designer

BC405 Programming ABAP Reports

opensap TEXT ANALYTICS WITH SAP HANA PLATFORM WEEK 1

BW405. BW/4HANA Query Design and Analysis COURSE OUTLINE. Course Version: 14 Course Duration: 5 Day(s)

HA150. SAP HANA 2.0 SPS03 - SQL and SQLScript for SAP HANA COURSE OUTLINE. Course Version: 15 Course Duration:

Week 2 Unit 3: Creating a JDBC Application. January, 2015

CA611 Testing with ecatt

S4H410. SAP S/4HANA Embedded Analytics and Modeling with Core Data Services (CDS) Views COURSE OUTLINE. Course Version: 05 Course Duration: 2 Day(s)

CLD100. Cloud for SAP COURSE OUTLINE. Course Version: 16 Course Duration: 2 Day(s)

Device Configuration Process Diagrams. SAP Mobile Secure: SAP Afaria 7 SP5 September 2014

D75AW. Delta ABAP Workbench SAP NetWeaver 7.0 to SAP NetWeaver 7.51 COURSE OUTLINE. Course Version: 18 Course Duration:

HA 450. Application Development for SAP HANA COURSE OUTLINE. Course Version: 12 Course Duration:

BW305. SAP Business Warehouse Query Design and Analysis COURSE OUTLINE. Course Version: 15 Course Duration: 5 Day(s)

ADM110. Installing and Patching SAP S/4HANA and SAP Business Suite Systems COURSE OUTLINE. Course Version: 17 Course Duration: 4 Day(s)

SAP HANA SPS 08 - What s New? SAP HANA Web-based Development Workbench. (Delta from SPS 07 to SPS 08) SAP HANA Product Management May, 2014

SAP EarlyWatch Alert. SAP HANA Deployment Best Practices Active Global Support, SAP AG 2015

ADM110. Installing and Patching SAP S/4HANA and SAP Business Suite Systems COURSE OUTLINE. Course Version: 18 Course Duration: 4 Day(s)

BC470. Form Printing with SAP Smart Forms COURSE OUTLINE. Course Version: 18 Course Duration:

FAQs Data Workbench SAP Hybris Cloud for Customer PUBLIC

Week 2 Unit 1: Introduction and First Steps with EJB. January, 2015

HA240 Authorization, Security and Scenarios

UX402 SAP SAPUI5 Development

HA240 SAP HANA 2.0 SPS02

BOCRC. SAP Crystal Reports Compact Course COURSE OUTLINE. Course Version: 15 Course Duration: 3 Day(s)

opensap Extending SAP S/4HANA Cloud and SAP S/4HANA SAP S/4HANA UX Fundamentals PUBLIC

FAQs OData Services SAP Hybris Cloud for Customer PUBLIC

HA400 ABAP Programming for SAP HANA

FAQs Data Sources SAP Hybris Cloud for Customer PUBLIC

TADM51. SAP NetWeaver AS - DB Operation (Oracle) COURSE OUTLINE. Course Version: 15 Course Duration: 5 Day(s)

FAQs Data Cleansing SAP Hybris Cloud for Customer PUBLIC

Let s Exploit DITA: How to automate an App Catalog

BIT660 Data Archiving

HA100 SAP HANA Introduction

SAP Business One Integration Framework

How-to Guide for Exercise Access the Demo Appliance Landscape (Week 1, Unit 6, Part 1)

UX400. OpenUI5 Development Foundations COURSE OUTLINE. Course Version: 02 Course Duration: 5 Day(s)

BC401. ABAP Objects COURSE OUTLINE. Course Version: 18 Course Duration:

BOID10. SAP BusinessObjects Information Design Tool COURSE OUTLINE. Course Version: 17 Course Duration: 5 Day(s)

ADM535. DB2 LUW Administration for SAP COURSE OUTLINE. Course Version: Course Duration: 3 Day(s)

BW310H. Data Warehousing with SAP Business Warehouse powered by SAP HANA COURSE OUTLINE. Course Version: 15 Course Duration: 5 Day(s)

SAP Mobile Secure Rapiddeployment. Software Requirements

Using SAP SuccessFactors Integration Center for generating exports on Interview Central. SAP SuccessFactors Recruiting Management

SAP HANA SPS 08 - What s New? SAP HANA Modeling (Delta from SPS 07 to SPS 08) SAP HANA Product Management May, 2014

SAP SMS 365 SAP Messaging Proxy 365 Product Description August 2016 Version 1.0

SAP HANA SPS 09 - What s New? SAP River

SAP 3D Visual Enterprise 9.0: Identifiers in VDS Files

BW462 SAP BW/4HANA COURSE OUTLINE. Course Version: 16 Course Duration: 5 Day(s)

DBW4H. Data Warehousing with SAP BW/4HANA - Delta from SAP BW powered by SAP HANA COURSE OUTLINE. Course Version: 13 Course Duration: 2 Day(s)

How-to Guide for Exercise Familiarize Yourself with SAP Fiori UX (Week 1, Unit 6, Part 2)

SAP HANA Cloud Integration for data services What s new in (Sept 2015) Ben Hofmans, Product Manager

UX300 SAP Screen Personas 3.0 Development

Software and Delivery Requirements

SAP Fiori Launchpad Process Flow. SAP Fiori UX launchpad Configuration: End to End CEG: November 2014

BW350H. SAP BW Powered by SAP HANA - Data Acquisition COURSE OUTLINE. Course Version: 15 Course Duration: 5 Day(s)

SAP: Speeding GRC Control Testing by 90% with SAP Solutions for GRC

DMM 163 Introduction to Data Modeling in SAP HANA

Week 1 Unit 1: Introduction to Data Science

SAP Workforce Performance Builder 9.5

Alert Consumption for Business Process Monitoring on MAI with SAP Solution Manager 7.1 SP12 Setup and features of notifications and incidents

COURSE LISTING. Courses Listed. Training for Database & Technology with Modeling in SAP HANA. Einsteiger. Fortgeschrittene.

COURSE LISTING. Courses Listed. Training for Database & Technology with Modeling in SAP HANA. Last updated on: 30 Nov 2018.

FAQs Facebook Integration with SAP Hybris Cloud for Customer SAP Hybris Cloud for Customer PUBLIC

Getting Started with FPM BOPF Integration (FBI)

SAP HANA Operation Expert Summit PLAN - Hardware Landscapes. Addi Brosig, SAP HANA Product Management May 2014

How to create a What If simulation in SAP Analytics Cloud

Analyze Big Data Faster and Store It Cheaper

User Interface Layouts

An Approach for Hybrid-Memory Scaling Columnar In-Memory Databases

BW362. SAP BW Powered by SAP HANA COURSE OUTLINE. Course Version: 11 Course Duration: 5 Day(s)

SAP Hybris Billing, pricing simulation Application Operations Guide Release 2.0, SP03

SAP HANA SPS 08 - What s New? SAP HANA Interactive Education - SHINE (Delta from SPS 07 to SPS 08) SAP HANA Product Management May, 2014

Transcription:

opensap: Big Data with SAP HANA Vora Course Week 03 - Exercises

opensap TABLE OF CONTENTS 1 TABLES AND VIEWS... 3 Create tables... 4 Select from the table... 4 Listing tables and views... 4 Loading tables from Vora into Spark... 5 Appending tables... 5 Dropping tables... 5 Creating views... 5 SQL VIEW... 5 Dimension View... 6 Cube view... 6 Drop views... 7 Check how the view is created... 7 2 DIFFERENT DATA TYPES... 9 Parquet Files... 10 Creating a table in Vora loading data from parquet format... 10 Check the result... 10 ORC Files... 11 Check the result... 11 3 HIERARCHIES... 12 Create Hierarchies... 13 Check the table... 13 Joining Hierarchies with regular tables... 13 Create the ADDRESSES table and check the values... 13 Create a view of Hierarchy which will make it easier to play with later:... 14 Join the ADDRESSES and OFFICERS tables... 15 Running UDF s on the Hierarchies... 15 Returns the rank of the descendants of the root... 15 Returns the address and the rank for the officers from level 2... 16 2

1 TABLES AND VIEWS Start Zeppelin: - Click on the connect button next to your opensap instance on CAL - A window will pop up. Click on Open next to Zeppelin to connect to Vora Data Modeler for the purpose of this exercise. - Zeppelin opens up in your browser. As you can see you ll have access to the solutions of the exercises and the create table statements via zeppelin notebooks: - You can use the solutions as a guide while running the exercises or creating a new notebook by clicking on Create new note and write your own solution. - In order to run a command on your Zeppelin notebook, click on the play button as below: 3

Create tables %vora CREATE TABLE CUSTOMER (CUSTOMER_ID string, REGION string, LONGITUDE int, LATITUDE int, CUSTOMER_GROUP string, LOCATION string) USING com.sap.spark.vora OPTIONS (tablename "CUSTOMER", paths "/user/vora/customer_data.csv") Select from the table %vora SELECT * FROM CUSTOMER Listing tables and views %vora SHOW TABLES using com.sap.spark.vora ** The result may look differently on your system 4

Loading tables from Vora into Spark %vora REGISTER TABLE SALES USING com.sap.spark.vora IGNORING CONFLICTS or %vora REGISTER ALL TABLES USING com.sap.spark.vora IGNORING CONFLICTS Appending tables %vora APPEND TABLE SALES OPTIONS (paths "/user/vora/sales_2015_data.csv,/user/vora/sales_data.csv", eagerload "true") ** Now you can see the sales from 2015 data is also added Sales from 2013 and 2014 Dropping tables %vora DROP TABLE CUSTOMER Creating views SQL VIEW %vora CREATE VIEW SALES_2014 AS (SELECT * FROM SALES WHERE YEAR = 2014) USING com.sap.spark.vora %vora SELECT * FROM SALES_2014 5

Dimension View Creating a CUSTOMER Dimension from the SALES data: %vora CREATE DIMENSION VIEW CUSTOMERDIM AS SELECT CUSTOMER_ID, YEAR FROM SALES USING com.sap.spark.vora %vora SELECT * FROM CUSTOMERDIM Cube view Jouining the Customer dimension with the sales table to create a sales cube (To show how you could join different tables and dimensions to create a cube) %vora CREATE CUBE VIEW SALESCUBE AS (SELECT * FROM CUSTOMERDIM C JOIN SALES S ON C.CUSTOMER_ID = S.CUSTOMER_ID) USING com.sap.spark.vora 6

Drop views %vora DROP VIEW SALESCUBE using com.sap.spark.vora Checking the initial SQL statement used to create the view %vora DROP VIEW SALESCUBE using com.sap.spark.vora Check how the view is created %vora DESCRIBE TABLE SALES_2014 USING com.sap.spark.vora 7

8

2 DIFFERENT DATA TYPES Start Zeppelin: - Click on the connect button next to your opensap instance on CAL - A window will pop up. Click on Open next to Zeppelin to connect to Vora Data Modeler for the purpose of this exercise. - Zeppelin opens up in your browser. As you can see you ll have access to the solutions of the exercises and the create table statements via zeppelin notebooks: - You can use the solutions as a guide while running the exercises or creating a new notebook by clicking on Create new note and write your own solution. - In order to run a command on your Zeppelin notebook, click on the play button as below: 9

Follow the first steps in exercise 2 to open Zeppelin and run the following exercises. Parquet Files Creating a table in Vora loading data from parquet format %vora CREATE TABLE SALES_P(CUSTOMER_ID string, YEAR string, REVENUE bigint) USING com.sap.spark.vora OPTIONS(tablename "SALES_P", paths "/user/vora/sales_p.parquet/*",format "parquet ) Check the result %vora SELECT * FROM SALES_P 10

ORC Files %vora CREATE TABLE SALES_O(CUSTOMER_ID string, YEAR string, REVENUE bigint) USING com.sap.spark.vora OPTIONS (tablename "SALES_O",paths "/user/vora/sales_o.orc/*",format "orc") Check the result %vora SELECT * FROM SALES_0 11

3 HIERARCHIES Start Zeppelin: - Click on the connect button next to your opensap instance on CAL - A window will pop up. Click on Open next to Zeppelin to connect to Vora Data Modeler for the purpose of this exercise. - Zeppelin opens up in your browser. As you can see you ll have access to the solutions of the exercises and the create table statements via zeppelin notebooks: - You can use the solutions as a guide while running the exercises or creating a new notebook by clicking on Create new note and write your own solution. - In order to run a command on your Zeppelin notebook, click on the play button as below: 12

Create Hierarchies %vora CREATE TABLE OFFICERS (id int, pred int, ord int, rank string) USING com.sap.spark.vora OPTIONS ( tablename "OFFICERS", paths "/user/vora/officers.csv ) Check the table %vora SELECT * FROM OFFICERS Joining Hierarchies with regular tables Create the ADDRESSES table and check the values %vora CREATE TABLE ADDRESSES (rank string, address string) USING com.sap.spark.vora OPTIONS (tablename "ADDRESSES", paths "/user/vora/addresses.csv") %vora SELECT * FROM ADDRESSES 13

Create a view of Hierarchy which will make it easier to play with later: %vora CREATE VIEW HV AS SELECT * FROM HIERARCHY ( USING OFFICERS AS child JOIN PARENT par ON child.pred = par.id SEARCH BY ord ASC START WHERE pred=0 SET node) AS H %vora SELECT * FROM HV 14

Join the ADDRESSES and OFFICERS tables %vora SELECT HV.rank, A.address FROM HV, ADDRESSES A WHERE HV.rank = A.rank Running UDF s on the Hierarchies Returns the rank of the descendants of the root %vora SELECT Children.rank FROM HV Children, HV Parents WHERE IS_ROOT(Parents.node) AND IS_PARENT(Parents.node, Children.node) 15

Returns the address and the rank for the officers from level 2 %vora SELECT OFFICERS.rank, ADDRESSES.address FROM (SELECT Descendants.rank AS rank FROM HV Parents, HV Descendants WHERE IS_DESCENDANT(Descendants.node, Parents.node) AND LEVEL(Parents.node) = 2 ) OFFICERS,ADDRESSES WHERE OFFICERS.rank = ADDRESSES.rank 16

Coding Samples Any software coding or code lines/strings ( Code ) provided in this documentation are only examples and are not intended for use in a production system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules for certain SAP coding. SAP does not warrant the correctness or completeness of the Code provided herein and SAP shall not be liable for errors or damages cause by use of the Code, except where such damages were caused by SAP with intent or with gross negligence. 17

www.sap.com 2016 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE s or its affiliated companies strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.