Package co.nubetech.hiho.mapreduce.lib.db

Examples of co.nubetech.hiho.mapreduce.lib.db.GenericDBWritable


    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));
    values.add(new Float(1.0f));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
View Full Code Here


    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));
    values.add(new Float(1.0f));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
View Full Code Here

    when(context.getConfiguration()).thenReturn(conf);

    DBInputDelimMapper mapper = new DBInputDelimMapper();
    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    ArrayList values = new ArrayList();
    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
View Full Code Here

        "stringColumn");
    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    columns.add(intColumn);
    columns.add(stringColumn);
    // HiveUtility.tableName = "employee";
    GenericDBWritable writable = new GenericDBWritable(columns, null);
    Configuration conf = new Configuration();
    conf.set(HIHOConf.HIVE_PARTITION_BY, "country:string:us,name:string");
    conf.set(DBConfiguration.INPUT_TABLE_NAME_PROPERTY, "employee");
    assertEquals(
        "FROM `employeetmp` tmp INSERT OVERWRITE TABLE `employee` PARTITION ( country='us',name) SELECT `tmp`.`intColumn`,`tmp`.`stringColumn`",
View Full Code Here

    ColumnInfo stringColumn = new ColumnInfo(1, Types.VARCHAR,
        "stringColumn");
    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    columns.add(intColumn);
    columns.add(stringColumn);
    GenericDBWritable writable = new GenericDBWritable(columns, null);
    assertEquals("`tmp`.`intColumn`,`tmp`.`stringColumn`",
        HiveUtility.getTmpTableColumns(writable));
  }
View Full Code Here

    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    columns.add(intColumn);
    columns.add(stringColumn);
    Configuration conf = new Configuration();
    conf.set(DBConfiguration.INPUT_TABLE_NAME_PROPERTY, "employee");
    GenericDBWritable writable = new GenericDBWritable(columns, null);

    conf.set(HIHOConf.INPUT_OUTPUT_STRATEGY, "DELIMITED");
    conf.set(HIHOConf.INPUT_OUTPUT_DELIMITER, ",");
    assertEquals(
        "CREATE TABLE `employeetmp` ( `intColumn` int,`stringColumn` string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE",
View Full Code Here

    ColumnInfo intColumn = new ColumnInfo(0, Types.INTEGER, "id");
    ColumnInfo stringColumn = new ColumnInfo(1, Types.VARCHAR, "country");
    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    columns.add(intColumn);
    columns.add(stringColumn); // HiveUtility.// = "employee";
    GenericDBWritable writable = new GenericDBWritable(columns, null);

    // This is normal case to generate basic create query
    Configuration conf = new Configuration();
    conf.set(HIHOConf.HIVE_TABLE_NAME, "employee");
    conf.set(HIHOConf.INPUT_OUTPUT_STRATEGY, "DELIMITED");
View Full Code Here

    ColumnInfo intColumn = new ColumnInfo(0, Types.INTEGER, "id");
    ColumnInfo stringColumn = new ColumnInfo(1, Types.VARCHAR, "country");
    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    columns.add(intColumn);
    columns.add(stringColumn); // HiveUtility.// = "employee";
    GenericDBWritable writable = new GenericDBWritable(columns, null);
    assertEquals("`id` int,`country` string",
        HiveUtility.getColumns(writable));
  }
View Full Code Here

        "stringColumn");
    ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
    columns.add(intColumn);
    columns.add(stringColumn);
    // HiveUtility.tableName = "employee";
    GenericDBWritable writable = new GenericDBWritable(columns, null);
    Configuration config = new Configuration();
    // String partitionBy = "country:string";
    String partitionBy1 = "country:string:us";
    config.set(HIHOConf.INPUT_OUTPUT_PATH, "/user/nube/tableForHiho");
    config.set(HIHOConf.HIVE_TABLE_NAME, "employee");
View Full Code Here

      String dbProductName = dbMeta.getDatabaseProductName()
          .toUpperCase();
      String query = getSelectQuery(conf, dbProductName);
      PreparedStatement st = conn.prepareStatement(query);
      logger.warn("\n Query for GenericDBWritable is " + query);
      GenericDBWritable writable = new GenericDBWritable(
          GenericDBWritable.populateColumnInfo(st.getMetaData()),
          null);
      return writable;

    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of co.nubetech.hiho.mapreduce.lib.db.GenericDBWritable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.