Category: data warehousing

  • Everything is SQL – the story of OBIEE

    As one can imagine, SQL is the main engine to start loading a report in OBIEE. In principle, one has two kinds of queries. One query runs against the Oracle DBMS. This is the physical query that we know from any Oracle client. It can be found on the main main. Choose New > Analysis > Create Direct Database query. See image:
    Untitled
    If one enters the page where such query may be formulated, one sees a rather Spartan looking page where the query may entered. It is very rudimentary, but, heck, what do you want more. Look at my interface page:
    Untitled
    The name of the so-called connection pool can be found in the Oracle BI Administration Tool. The actual results from the query can be found in the “results” tab.

    Another type of SQL is the logical SQL. This can be found in Administration > Manage Sessions. To avoid, results being returned from cache, one may think of starting the Call SAPurgeAllCache() command. This can be run from Administration > Issue SQL.
    Under Administration > Manage Session, one may find the so-called logical SQL. This may look like:

    SET VARIABLE QUERY_SRC_CD='Report',SAW_SRC_PATH='/users/prodney/TomFinaal6',PREFERRED_CURRENCY='USD';SELECT
       0 s_0,
       "1_TOM"."WINKEL1"."COUNTRYID" s_1,
       "1_TOM"."WINKEL1"."FILNR" s_2,
       "1_TOM"."WINKEL1"."ID" s_3,
       "1_TOM"."WINKEL1"."OPGEBNR" s_4,
       "1_TOM"."WINKEL1"."PLAATS" s_5,
       "1_TOM"."WINKEL1"."REGIO" s_6,
       "1_TOM"."WINKEL1"."REGIONR" s_7,
       "1_TOM"."WINKEL1"."SOORT" s_8,
       "1_TOM"."WINKEL1"."WINKELGROEP" s_9,
       "1_TOM"."WINKELWEEKOMZET"."OMZETAH" s_10,
       AGGREGATE(NTILE("1_TOM"."WINKELWEEKOMZET"."OMZETAH",4) BY "1_TOM"."WINKEL1"."COUNTRYID") s_11,
       AGGREGATE(NTILE("1_TOM"."WINKELWEEKOMZET"."OMZETAH",4) BY "1_TOM"."WINKEL1"."OPGEBNR") s_12,
       AGGREGATE(NTILE("1_TOM"."WINKELWEEKOMZET"."OMZETAH",4) BY "1_TOM"."WINKEL1"."REGIONR") s_13,
       CAST(NULL AS INTEGER) s_14,
       REPORT_SUM("1_TOM"."WINKELWEEKOMZET"."OMZETAH" BY "1_TOM"."WINKEL1"."COUNTRYID") s_15,
       REPORT_SUM("1_TOM"."WINKELWEEKOMZET"."OMZETAH" BY "1_TOM"."WINKEL1"."ID") s_16,
       REPORT_SUM("1_TOM"."WINKELWEEKOMZET"."OMZETAH" BY "1_TOM"."WINKEL1"."OPGEBNR") s_17,
       REPORT_SUM("1_TOM"."WINKELWEEKOMZET"."OMZETAH" BY "1_TOM"."WINKEL1"."REGIONR") s_18
    FROM "1_TOM"
    WHERE
    (("JAAR"."JAAR" = 2015) AND ("WINKELWEEKOMZET"."OMZETAH" > 0))
    ORDER BY 1, 2 ASC NULLS LAST
    FETCH FIRST 5000001 ROWS ONLY\
    

    This can be run from Administration > Issue SQL.

    In the log, one sees the logical SQL, followed by a translation into a physical SQL.

    This Physical SQL needs a little rewriting and it can be fired directly from any SQL client.

    This translation is very useful as it may help to identify the fields that are used to create a report from.

  • Using OBIEE spatial reporting

    Using spatial reporting in OBIEE is not for the faint of heart. However it is also rewarding. The reports look great; it is new and henceforth exciting. It is challenging but the outcome stands out. However on the route to the reports, some obstacles must be overcome. Let me provide some thoughts on the obstacles that I encountered.
    The first obstacle is the decision what tools to use. One must use next set of tools: [a] the mapbuilder which is an independent java tool that can be run from any client and which creates some layers that will be shown on a map, [b] the mapviewer which is used to create a map with the layers that were created by the user and [c] the “manage map data” that can be found under the “map data management” in the administration of Oracle BI presentation. To know when to use what tool was not trivial. First, the layers must be created in the mapbuilder; then one must decide on the map (to be set up in the mapviewer) and finally the map must be linked to the data in the manage map data part. It took me some time to figure this out.
    Then the decision on how to set up the maps. Do we take predefined map (such as the Bing map, the Google map, the Navteq map) or do we create our own maps? Let me provide an example on a map that is created on top of an existing predefined map:
    Untitled
    and then an example with a map that is created by yourself:
    Untitled1.
    This choice has some consequences. Do you accept the default settings that are more or less imposed by the predefined map or do you want to set your own standards, labels, colours etc? Both choices have pros and cons. Something to think about. If one settles for a own map creation, one might consider using this manual. It helped me to create some maps that I created myself. If you use the predefined maps, it is somewhat trial and error. But it worked out for me.
    Another choice is the model to use. One must create a model that is propagated from physical layer to the presentation layer and that can be found in the subject area. In the subject area, we must have some labels that refer to either points in space or areas in space. As an example, one must have labels that refer to shops and which can be seen as points and municipalities that are areas and for which we must have labels. Such labels are important. Somewhere down the line we must link these labels (shops, municipalities) to spatial objects (points, polygons) in order to render them on screen.
    A final choice is where the spatial data (longitudes/ latitudes) might be derived from. Do we download them/ Do we copy them from an existing source or do we create them ourselves. Everything is possible. In short: choices, choices, choices!

  • Spatial Reporting in OBIEE

    OBIEE allows you to create spatial reports. The idea is relatively simple. Instead of a tabular reports with rows and columns, we create a reports that are createad as a layer upon a map. So we have a map, with a layer of plotted values. When we have a report with a geographical component, such as turnover per town, we map create a nice overview of turnovers as realised in different town that are plotted on a map of a particular area.
    An example:
    Untitled
    You see a map of the Netherlands with some areas that correspond to municipalities. These areas are either yellow or purple, depending upon the value that correspond to the municipality.
    How is this accomplished?
    OBIEE allows the creation of such reports. It provides several maps (Bing/ Nokia and Elocation) that are provided with OBIEE. One could interpreted this as the first layer upon which we must plot our municipalities. We must firstly create an object that holds the geographical components. We need at least two attributes:
    1: We need a geographical object
    2: We need a name for that geographical object.

    This can be stored as a record in Oracle. An example is given below:
    Record
    Here we store a geographical object in field “Geometry”. If fact, we store a series of data on latitude, longitude that together create a polygon. This is stored in Oracle. We attach a name “NLD_GOUDA” to it.
    Now we have an object with a name and geographical content. We can refer to “NLD_GOUDA” if we want to link it to that geographical object.
    Such linkage is created here in another table where address keys are linked to the name of the geographical object. See:
    Untitled
    This address key is used in this data base with customers that generate a certain turnover. If we add all turnover that are realised by customers that have an address key that is mentioned in the picture above, we have total turnover as realised in “NLD_GOUDA”.
    It might well be that we are interested in the turnover that is generated in each of the addresses. This could be realised by storing the geographical objects with a name of each address in the database. Here (see record number 5), we store “NLD_GOUDA_2804XABLOEMENDAAL” with the geographical object. See picture below:
    Untitled
    We now have several addresses within one municipality for which geographical objects are created. We may now link the addresses to the labels as shown below:
    Untitled
    We now have two types of geographical objects:
    1: municipalities for which we have geographical polygons
    2: addresses within the municipalities for which we have other geographical objects.

    The end result is shown below, where the individual addresses are displayed with a bubble and the municipality is shown in yellow:
    Untitled.
    We see one address “NLD_GOUDA_2804XABLOEMENDAAL” standing out.

  • Latitudes and longitudes in the Netherlands

    Getting geographical data on Holland is not a trivial matter. It took me a bit of tenacity to get the data. Hence I thought being a good idea to store my findings. I might need these data in the future. The first file that I found on the internet is a file with longitudes/ latitudes of municipalities.. Then nice thing about this file is that municipalities are given with a polygon. It is possible to show the municipalities with their contours on a map. Later, I found another file with six digit postal codes. Each postal code represents about 10 different addresses. This file is stored here.
    I use these data to display spatial information in Oracle. In Oracle such data must be stored in a special data type, SDO_Geometry. The import file on municipalities is stored stored here. The import file on postal code is provided here.

  • Oracle OBIEE – My First Report

    Recently, I created my first OBIEE report. To be honest, my biggest problem was to identify which tools to use. I might overlook the clues, but it took me quite some time before I could identify the important tools that I had to use. Finally, I understood that two important tools must be used: [1] the Oracle BI Administrator which allows us to create the objects that can be used to create the reports and [2] the internet page that must be used to modify the objects into a report.
    Let us first discuss the Oracle BI Administrator.
    Untitled
    This tool starts by inserting physical tables in the right columns. In my case, I inserted three tables: D1_LAND, D2_TIJD en F_FEITEN. I then dragged the tables to the business layer. There, I should be able to create the aggregations. After that I dragged the tables into the presentation layer.
    The second tool is a page that links to the OBIEE environment. In my case www.van-maanen.com:7780/analytics. After logging on, I see the items in the presentation layer that I just created. Dragging the attributes that I would like to analyse yields:
    Untitled.

    This is my starting point for further analysis.

  • Oracle OBIEE

    Recently, I came across OBIEE. This is an Oracle tool that is created to support OLAP – type investigation into a database. I have to confess: I am impressed with it. The first great thing for me as an analyst is that it closely integrated into existing Oracle tool. One may continue to use the Oracle SQL Developer, the data are stored in an Oracle database. So one really extends the usage of existing tools.
    Moreover, the tool is relative easy to work with.
    To show how easy it is is to work with, I created a small model having two dimensions and one fact table. One dimension is related to date. It has four levels: date, month, year and total. The metadata can be inserted in Analytic Workspace Manager. In that tool, we seen the possibility to add additional dimensions. As attributes, we have to include the levels, the hierarchies and the mappings to an existing table. See the screenshot below:
    Untitled
    In that screenshot from the Analytic Workspace Manager, one might see three columns: a column where the logical entities/attributes of OLAP are mentioned, with their cubes, facts and dimensions. One has a column in the middle where the value for each of the logical entities/attributes are given. And one has a column on the right where the link is created between the physical tables and the logical/attributes is provided.
    How to fill out such values can be found here.

    In a similar fashion, one could create a cube that connects facts and dimensions. See the screenshot below.
    Untitled2
    But this is not all: SQL Developer now has a subset of the functionalities that allow you to maintain these cubes as well. I started out with changing some values in the underlying tables. I was able to load these data in the cube. I must say: a very nice accomplishment from that tool. SQL Developer is yet able to support you adequately if you want o create a new cube. For that task, SQL Developer is no intuively enough. But to maintain an existing cube is perfectly possible with SQL Developer.

  • Sqoop

    Sqoop is a tool that allows you to ship data from a RDBMS to a Hadoop platform. Let us take an example to clarify this. One may have some data in a MySQL table persons, within database thom. This database is stored on server 62.51.51.999. The data can be accessed with the knowledge of the server (62.51.51.999), the database (thom), tablename (persons), the userid (thom) and a password. One may then transfer these data with this sqoop command:

    sqoop import --connect jdbc:mysql://62.131.51.999/tom --table persons -m 1 --username thom --password thom24257
    

    Looking on the Hadoop platform, one may look at the data:

    [pivhdsne:sqoop]$ hadoop dfs -cat /user/gpadmin/persons/part-m-00000
    DEPRECATED: Use of this script to execute hdfs command is deprecated.
    Instead use the hdfs command for it.
    
    Peter,Griffin,35
    Glenn,Quagmire,33
    tom,vanmaanen,99
    

    After this, I tried to retrieve data from Oracle to a file on HDFS. This proved quite similar. The only difference being that another jar was used (understandable) and the columns had to be mentioned (less obvious).
    However, I got it working via:

    sqoop import --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=192.168.2.26)(port=1521))(connect_data=(service_name=xe)))" --table scott.employees --columns "FIRST_NAME, LAST_NAME"  --num-mappers 1 --username scott --password binvegni
    

    By that time, I had collected two jars in my lib file where sqoop stores the jars. They are (being able to connect to mysql and oracle):

    -rw-r--r-- 1 gpadmin gpadmin  459094 Oct 18  2006 mysql-connector-java-3.1.14-bin.jar
    -rw-r--r-- 1 gpadmin gpadmin 2739670 Sep 26 16:30 ojdbc6.jar
    

    On another environment I undertook a similar exercise with transferral of an Oracle table. The first thing was to store an ojdbc.jar into the correct environment. I stored this jar in the same environment as the mysql*.jar:

    lrwxrwxrwx 1 root root 40 Aug 27  2015 /usr/lib/sqoop/lib/mysql-connector-java.jar 
    -rwxrwxrwx 1 root root 3698857 Dec  4 11:25 /usr/lib/sqoop/lib/ojdbc7.jar
    

    I then issued this command to transfer the data:

    sqoop import \
    --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=192.168.2.2)(port=1521))(connect_data=(service_name=orcl)))" \
    --username scott --password binvegni \
    --table accounts \
    --columns "ACCT_NUM, ACCT_CREATE_DT, ACCT_CLOSE_DT, FIRST_NAME, LAST_NAME, ADDRESS, CITY, STATE, ZIPCODE, PHONE_NUMBER, CREATED, MODIFIED" \
    --m 1 \
    --target-dir /loudacre/Oraaccounts \
    --null-non-string '\\N'
    

    I understood than the addition “–m 1” was necessary as the target table did not have a primary key. In that case one mapper needs to be included.
    I then added one record to the Oracle table. This one record could be copied to HDFS with:

    sqoop import \
    --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=192.168.2.2)(port=1521))(connect_data=(service_name=orcl)))" \
    --username scott --password binvegni \
    --incremental append \
    --null-non-string '\\N' \
    --table accounts \
    --columns "ACCT_NUM, ACCT_CREATE_DT, ACCT_CLOSE_DT, FIRST_NAME, LAST_NAME, ADDRESS, CITY, STATE, ZIPCODE, PHONE_NUMBER, CREATED, MODIFIED" \
    --m 1 \
    --target-dir /loudacre/Oraaccounts \
    --check-column acct_num \
    --last-value 129764
    

    I could verify by looking at the HDFS environment where a new file was created with the content of that one record that was added.
    untitled

    A slightly different import looked like:

    sqoop import \
    --connect jdbc:oracle:thin:@192.168.2.2:1521:orcl \
    --username C##HR \
    --password ine13258 \
    --table omzet \
    --columns "SOORT, FILNR, JAAR, OMZET" \
    --escaped-by '\\' \
    --fields-terminated-by   ',' \
    --lines-terminated-by   '\n' \
    --m 1 \
    --target-dir  /user/tom/sqoopOpvang3
    

    Another nice facility is that it is possible to issue directly a query to the Oracle table, like:

    sqoop eval \
    --query "SELECT * FROM accounts where ACCT_NUM < 10" \
    --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=192.168.2.2)(port=1521))(connect_data=(service_name=orcl)))" \
    --username scott --password binvegni 
    

    that provides something like:
    untitled
    I also became aware that we may apply a small twist to allow for strange characters (such as a comma in strings). We then apply a command like:

    sqoop import \
    --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=192.168.2.2)(port=1521))(connect_data=(service_name=orcl)))" \
    --username scott --password bunvegni \
    --table webpage \
    --columns "WEB_PAGE_NUM,WEB_PAGE_FILE_NAME,ASSOCIATED_FILES" \
    --m 1 \
    --null-non-string '\\N' \
    --target-dir /loudacre/Orawebpage \
    --fields-terminated-by "\t"
    

    It is also possible to include a filter. One thus limits the number of records to be read in HDFS:

    sqoop import \
    --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=192.168.2.2)(port=1521))(connect_data=(service_name=orcl)))" \
    --username scott --password bunvegni \
    --table accounts \
    --columns "ACCT_NUM, ACCT_CREATE_DT, ACCT_CLOSE_DT, FIRST_NAME, LAST_NAME, ADDRESS, CITY, STATE, ZIPCODE, PHONE_NUMBER, CREATED, MODIFIED" \
    --where "CITY='GOUDA'" \
    --m 1 \
    --target-dir /loudacre/Oraaccounts_Current \
    --null-non-string '\\N'
    

    Introducing SQL Server meant another jar has to added. It is the sqljdbc4.jar that can be downloaded from microsoft. There are two such files, the sqljdbc.jar class library that provides support for JDBC 3.0 and the sqljdbc4.jar class library that provides support for JDBC 4.0. After downloading this jar file and storing it in the sqoop lib directory, I could fire next line:

    sqoop import --connect "jdbc:sqlserver://192.168.2.26:1433;database=master;username=sa;password=binvegni" --table tomtest -m 1
    

    This allowed me to download data from table tomtest that is stored in the master database of a SQL server that resides on 192.168.2.26, listening to port 1433.
    And this is how you get data from a PostgreSQL server (using the postgresql-9.4-1203-jdbc4.jar):

    sqoop import --connect jdbc:postgresql://192.168.2.26:5432/postgres --table testtom --username postgres --password binvegni  --direct
    

    and adding data to the hadoop platform on base of existing data needs:

    sqoop import --connect jdbc:postgresql://192.168.2.26:5432/postgres --table testtom --username postgres --password binvegni  --incremental append --check-column nummer
    
  • Avro – getting it work

    When you read about Hadoop, you come across AVRO. This is a mechanism to exchange data via streams and it is named after the famous British aircraft industry that amongst many other types, delivered the Lancaster that helped to liberate Europe. AVRO can be implemented in many languages, amongst them PHP. Before continuing let us run a programme with AVRO included.
    PHP can be run as a webpage. One could also run it from the command line, but running as a webpage is probably the easiest way around. One need to install PHP but this is abundantly described. I installed PHP as an executable that can be run from CGI with IIS. It can be verified that PHP runs smoothly is one is able to run a so-called phpinfo() command. Examples can be be found on the internet.This phpinfo() is often used as a “HelloWorld” application. It is easy to program and it allows the user to verify that PHP is working.
    One continues by installing AVRO which is a set of PHP programmes that can be installed in the web root directory.
    Other things must be changed as well before using PHP. One must include a DLL that must also be mentioned in the php.ini file. Somewhere in the PHP.ini, one must include a line like extension=php_gmp.dll to have it being used by PHP.
    As one need to write a file, the user priviliges need to be set accordingly.Untitled
    I think, one might give it a go. Try to run this page . If one sees something like

     from file: array ( 'member_id' => 1392, 'member_name' => 'Jose', ) array ( 'member_id' => 1642, 'member_name' => 'Maria', ) from binary string: array ( 'member_id' => 1392, 'member_name' => 'Jose', ) array ( 'member_id' => 1642, 'member_name' => 'Maria', )

    , one is on the right track.
    What does this programme do? First, it creates an avro file. This is a binary file that contains the structure and the data. This file looks like:

    In a subsequent step, the file is then written to screen. This example shows that avro files are a nice alternative to ordinary textfiles as the files contain the definition of the attributes.

  • Map and reduce – what happens?

    In Big Data, the concept of mapping and reducing plays a huge role. The idea is that a a massive dataset is split over several servers. On each server, a part of the data is investigated. This part is called a mapper. In a subsequent part, these parts are merged into an outcome. This latter part is called the reduce part. The communication between these two parts go along key-value pairs.
    In a well-known example (MaxTemperature), this mechanism is demonstrated in a Java programme. This programme consists of 3 classes: a supervisory programme, that is shown below.

    // cc MaxTemperature Application to find the maximum temperature in the weather dataset
    // vv MaxTemperature
    import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.io.IntWritable;
    import org.apache.hadoop.io.Text;
    import org.apache.hadoop.mapreduce.Job;
    import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
    import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
    public class MaxTemperature {
    public static void main(String[] args) throws Exception {
    if (args.length != 2) {
    System.out.println("invoer is " + args[0]);
    System.out.println("uitvoer is " + args[1]);
    System.err.println("Usage: MaxTemperature [input path] [output path]");
    System.exit(-1);
    }
    @SuppressWarnings("deprecation")
    Job job = new Job();
    job.setJarByClass(MaxTemperature.class);
    job.setJobName("Max temperature");
    FileInputFormat.addInputPath(job, new Path(args[0]));
    System.out.println("invoer is " + args[0]);
    FileOutputFormat.setOutputPath(job, new Path(args[1]));
    System.out.println("uitvoer is " + args[1]);
    job.setMapperClass(MaxTemperatureMapper.class);
    job.setReducerClass(MaxTemperatureReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
    }
    // ^^ MaxTemperature
    
    

    This programme calls two other classes. The call is done via job.setMapperClass, which is coded below:

    // cc MaxTemperatureMapper Mapper for maximum temperature example
    // vv MaxTemperatureMapper
    import java.io.IOException;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.util.Date;
    import org.apache.hadoop.io.IntWritable;
    import org.apache.hadoop.io.LongWritable;
    import org.apache.hadoop.io.Text;
    import org.apache.hadoop.mapreduce.Mapper;
    public class MaxTemperatureMapper
    extends Mapper {
    private static final int MISSING = 9999;
    @Override
    public void map(LongWritable key, Text value, Context context)
    throws IOException, InterruptedException {
    String line = value.toString();
    String year = line.substring(15, 19);
    File file = new File("/home/hduser/example-mapper.txt");
    if (!file.exists()) {
    	file.createNewFile();
    };
    FileWriter fw = new FileWriter(file.getAbsoluteFile(),true);
    BufferedWriter output = new BufferedWriter(fw);
    Date date = new Date();
    int airTemperature;
    if (line.charAt(87) == '+') { // parseInt doesn't like leading plus signs
    airTemperature = Integer.parseInt(line.substring(88, 92));
    } else {
    airTemperature = Integer.parseInt(line.substring(87, 92));
    }
    output.append("mappert is jaar " + date.toString() +">"+ year + " temp  " + airTemperature + "\n");
    output.close();
    String quality = line.substring(92, 93);
    if (airTemperature != MISSING && quality.matches("[01459]")) {
    context.write(new Text(year), new IntWritable(airTemperature));
    }
    }
    }
    // ^^ MaxTemperatureMapper
    

    In this class, the input is read as a key value pair. On its turn the output is written as a new key value pair. This key value pair consists of a year and a temperature measurement. To know exactly what values are communicated, the key-value pairs are written to a file. The file (“/home/hduser/example-mapper.txt”) contains these lines:

    mappert is jaar Mon Jun 15 05:58:29 PDT 2015>1975 temp  12341
    mappert is jaar Mon Jun 15 05:58:29 PDT 2015>1975 temp  12342
    mappert is jaar Mon Jun 15 05:58:29 PDT 2015>1975 temp  12343
    mappert is jaar Mon Jun 15 05:58:29 PDT 2015>1975 temp  12345
    

    The value pairs that are communicated are 1975 – 12341, 1975 12342 etc, . The resulting key value pair are processed in the subsequent reducer part that has this code:

    
    // cc MaxTemperatureReducer Reducer for maximum temperature example
    // vv MaxTemperatureReducer
    import java.io.IOException;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import org.apache.hadoop.io.IntWritable;
    import org.apache.hadoop.io.Text;
    import org.apache.hadoop.mapreduce.Reducer;
    public class MaxTemperatureReducer
    extends Reducer {
    @Override
    public void reduce(Text key, Iterable values,
    Context context)
    throws IOException, InterruptedException {
    int maxValue = Integer.MIN_VALUE;
    File file = new File("/home/hduser/example-reducer.txt");
    BufferedWriter output = new BufferedWriter(new FileWriter(file));
    for (IntWritable value : values) {
    int waarde = value.get();
    maxValue = Math.max(maxValue, waarde);
    output.write("mappert is gelezen waarde " + waarde + " max  " + maxValue + "\n");
    }
    context.write(key, new IntWritable(maxValue));
    output.close();
    };
    
    }
    // ^^ MaxTemperatureReducer
    

    Also, in this part a file is written that contains the values as they are processed. The values are 12345, 12343 etc

    mappert is gelezen waarde 12345 max  12345
    mappert is gelezen waarde 12343 max  12345
    mappert is gelezen waarde 12342 max  12345
    mappert is gelezen waarde 12341 max  12345
    

    From these values the maximum is calculated.
    The final result(key and maximum) can finally be read in the hdfs file with:
    /usr/local/hadoop/bin/hadoop dfs -cat /user/output51/part-r-00000. This shows: 1975 12345, which is the final outcome of this exercise.

  • Use Case

    A Use Case is something that can be written after a context diagramme is written. A context diagramme provides an overview of the whole system with its interfaces to the outside world. The use cases are written on base of each of the individual interactions between the system an one of its external systems.

    As an example, one may take the interaction between the system and the reporting environment for which an interface exists. Such interaction is developed into a use case. A use case is either a diagramme or a written overview how the interaction works.
    The use case has next elements:

    • It has a title that summarises the purpose of the use case.
    • It indicates the main actor that is connected to the interface.
    • It has a story that contains a set of testable statements on how the interaction works. Such a story always starts with the begin condition (what needs to be ready in order to allow the interaction to start), one or several steps and finally an end condition that shows how the system looks after the interaction.

    The main story is a main success story – sometimes called the sunny day story. It assumes that the interactions reaches its goal. One may also feel the need to describe a situation where the action is cancelled. Such an additional situation may be described in a so-called extension.

    Let me try to provide an example.

    • Title: provide data for reporting purposes.
    • Main actor: Reporting System.
    • Story, begin condition. The data must be loaded in the data warehouse.
    • Story: step1: Collect data in data warehouse.
    • Story: step2: System sends data to Reporting Environment.
    • Story: step3: Reporting System stores the data in its own environment.
    • Story, end condition. Reporting System contains the data for reporting environment.

     

    The most important limitation of the use case is that the use case does not yet contain a product description. It is focussed on understanding the user interpretation of the interaction between the future system and its external environment.
    The product description is a next step. The product can be developped once the use cases are known and understood. In that case, the optimal solution can be given that provides an answer to the demands that are raised from the use cases.