/** * Creates a new instance while assigning all variables. * * @param tableName The name of the current table. * @param scan The scan associated with this split. * @param startRow The start row of the split. * @param endRow The end row of the split. * @param encodedRegionName The region ID. * @param location The location of the region. */ public TableSplit(TableName tableName, Scan scan, byte [] startRow, byte [] endRow, final String location, final String encodedRegionName, long length) { this.tableName = tableName; try { this.scan = (null == scan) ? "" : TableMapReduceUtil.convertScanToString(scan); } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.startRow = startRow; this.endRow = endRow; this.regionLocation = location; this.encodedRegionName = encodedRegionName; this.length = length; }
public InputSplit(TableDescriptor htd, HRegionInfo regionInfo, List<String> locations, Scan scan, Path restoreDir) { this.htd = htd; this.regionInfo = regionInfo; if (locations == null || locations.isEmpty()) { this.locations = new String[0]; } else { this.locations = locations.toArray(new String[locations.size()]); } try { this.scan = scan != null ? TableMapReduceUtil.convertScanToString(scan) : ""; } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.restoreDir = restoreDir.toString(); }
/** * Job configuration. */ public static Job configureJob(Configuration conf, String [] args) throws IOException { String tableName = args[0]; String columnFamily = args[1]; System.out.println("****" + tableName); conf.set(TableInputFormat.SCAN, TableMapReduceUtil.convertScanToString(new Scan())); conf.set(TableInputFormat.INPUT_TABLE, tableName); conf.set("index.tablename", tableName); conf.set("index.familyname", columnFamily); String[] fields = new String[args.length - 2]; System.arraycopy(args, 2, fields, 0, fields.length); conf.setStrings("index.fields", fields); Job job = new Job(conf, tableName); job.setJarByClass(IndexBuilder.class); job.setMapperClass(Map.class); job.setNumReduceTasks(0); job.setInputFormatClass(TableInputFormat.class); job.setOutputFormatClass(MultiTableOutputFormat.class); return job; }
/** * Push snapshotScans to conf (under the key {@link #SNAPSHOT_TO_SCANS_KEY}) * * @param conf * @param snapshotScans * @throws IOException */ public void setSnapshotToScans(Configuration conf, Map<String, Collection<Scan>> snapshotScans) throws IOException { // flatten out snapshotScans for serialization to the job conf List<Map.Entry<String, String>> snapshotToSerializedScans = Lists.newArrayList(); for (Map.Entry<String, Collection<Scan>> entry : snapshotScans.entrySet()) { String snapshotName = entry.getKey(); Collection<Scan> scans = entry.getValue(); // serialize all scans and map them to the appropriate snapshot for (Scan scan : scans) { snapshotToSerializedScans.add(new AbstractMap.SimpleImmutableEntry<>(snapshotName, TableMapReduceUtil.convertScanToString(scan))); } } ConfigurationUtil.setKeyValues(conf, SNAPSHOT_TO_SCANS_KEY, snapshotToSerializedScans); }
scanStrings.add(convertScanToString(scan));
HBaseConfiguration.merge(conf, HBaseConfiguration.create(conf)); conf.set(TableInputFormat.INPUT_TABLE, table); conf.set(TableInputFormat.SCAN, convertScanToString(scan)); conf.setStrings("io.serializations", conf.get("io.serializations"), MutationSerialization.class.getName(), ResultSerialization.class.getName(),
public static String convertScanToString(Scan scan) throws IOException { String scanString = TableMapReduceUtil.convertScanToString(scan); return scanString; }
/** * Creates a new instance while assigning all variables. * * @param tableName The name of the current table. * @param scan The scan associated with this split. * @param startRow The start row of the split. * @param endRow The end row of the split. * @param location The location of the region. */ public TableSplit(byte [] tableName, Scan scan, byte [] startRow, byte [] endRow, final String location) { this.tableName = tableName; try { this.scan = (null == scan) ? "" : TableMapReduceUtil.convertScanToString(scan); } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.startRow = startRow; this.endRow = endRow; this.regionLocation = location; }
/** * Creates a new instance while assigning all variables. * * @param tableName The name of the current table. * @param scan The scan associated with this split. * @param startRow The start row of the split. * @param endRow The end row of the split. * @param encodedRegionName The region ID. * @param location The location of the region. */ public TableSplit(TableName tableName, Scan scan, byte [] startRow, byte [] endRow, final String location, final String encodedRegionName, long length) { this.tableName = tableName; try { this.scan = (null == scan) ? "" : TableMapReduceUtil.convertScanToString(scan); } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.startRow = startRow; this.endRow = endRow; this.regionLocation = location; this.encodedRegionName = encodedRegionName; this.length = length; }
/** * Creates a new instance while assigning all variables. * * @param tableName The name of the current table. * @param scan The scan associated with this split. * @param startRow The start row of the split. * @param endRow The end row of the split. * @param encodedRegionName The region ID. * @param location The location of the region. */ public TableSplit(TableName tableName, Scan scan, byte [] startRow, byte [] endRow, final String location, final String encodedRegionName, long length) { this.tableName = tableName; try { this.scan = (null == scan) ? "" : TableMapReduceUtil.convertScanToString(scan); } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.startRow = startRow; this.endRow = endRow; this.regionLocation = location; this.encodedRegionName = encodedRegionName; this.length = length; }
public InputSplit(TableDescriptor htd, HRegionInfo regionInfo, List<String> locations, Scan scan, Path restoreDir) { this.htd = htd; this.regionInfo = regionInfo; if (locations == null || locations.isEmpty()) { this.locations = new String[0]; } else { this.locations = locations.toArray(new String[locations.size()]); } try { this.scan = scan != null ? TableMapReduceUtil.convertScanToString(scan) : ""; } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.restoreDir = restoreDir.toString(); }
public InputSplit(TableDescriptor htd, HRegionInfo regionInfo, List<String> locations, Scan scan, Path restoreDir) { this.htd = htd; this.regionInfo = regionInfo; if (locations == null || locations.isEmpty()) { this.locations = new String[0]; } else { this.locations = locations.toArray(new String[locations.size()]); } try { this.scan = scan != null ? TableMapReduceUtil.convertScanToString(scan) : ""; } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.restoreDir = restoreDir.toString(); }
public InputSplit(HTableDescriptor htd, HRegionInfo regionInfo, List<String> locations, Scan scan, Path restoreDir) { this.htd = htd; this.regionInfo = regionInfo; if (locations == null || locations.isEmpty()) { this.locations = new String[0]; } else { this.locations = locations.toArray(new String[locations.size()]); } try { this.scan = scan != null ? TableMapReduceUtil.convertScanToString(scan) : ""; } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.restoreDir = restoreDir.toString(); }
/** * Job configuration. */ public static Job configureJob(Configuration conf, String [] args) throws IOException { String tableName = args[0]; String columnFamily = args[1]; System.out.println("****" + tableName); conf.set(TableInputFormat.SCAN, TableMapReduceUtil.convertScanToString(new Scan())); conf.set(TableInputFormat.INPUT_TABLE, tableName); conf.set("index.tablename", tableName); conf.set("index.familyname", columnFamily); String[] fields = new String[args.length - 2]; System.arraycopy(args, 2, fields, 0, fields.length); conf.setStrings("index.fields", fields); Job job = new Job(conf, tableName); job.setJarByClass(IndexBuilder.class); job.setMapperClass(Map.class); job.setNumReduceTasks(0); job.setInputFormatClass(TableInputFormat.class); job.setOutputFormatClass(MultiTableOutputFormat.class); return job; }
/** * Creates a new instance while assigning all variables. * * @param tableName The name of the current table. * @param scan The scan associated with this split. * @param startRow The start row of the split. * @param endRow The end row of the split. * @param location The location of the region. */ public TableSplit(TableName tableName, Scan scan, byte [] startRow, byte [] endRow, final String location, long length) { this.tableName = tableName; try { this.scan = (null == scan) ? "" : TableMapReduceUtil.convertScanToString(scan); } catch (IOException e) { LOG.warn("Failed to convert Scan to String", e); } this.startRow = startRow; this.endRow = endRow; this.regionLocation = location; this.length = length; }
/** * Push snapshotScans to conf (under the key {@link #SNAPSHOT_TO_SCANS_KEY}) * * @param conf * @param snapshotScans * @throws IOException */ public void setSnapshotToScans(Configuration conf, Map<String, Collection<Scan>> snapshotScans) throws IOException { // flatten out snapshotScans for serialization to the job conf List<Map.Entry<String, String>> snapshotToSerializedScans = Lists.newArrayList(); for (Map.Entry<String, Collection<Scan>> entry : snapshotScans.entrySet()) { String snapshotName = entry.getKey(); Collection<Scan> scans = entry.getValue(); // serialize all scans and map them to the appropriate snapshot for (Scan scan : scans) { snapshotToSerializedScans.add(new AbstractMap.SimpleImmutableEntry<>(snapshotName, TableMapReduceUtil.convertScanToString(scan))); } } ConfigurationUtil.setKeyValues(conf, SNAPSHOT_TO_SCANS_KEY, snapshotToSerializedScans); }
/** * Push snapshotScans to conf (under the key {@link #SNAPSHOT_TO_SCANS_KEY}) * * @param conf * @param snapshotScans * @throws IOException */ public void setSnapshotToScans(Configuration conf, Map<String, Collection<Scan>> snapshotScans) throws IOException { // flatten out snapshotScans for serialization to the job conf List<Map.Entry<String, String>> snapshotToSerializedScans = Lists.newArrayList(); for (Map.Entry<String, Collection<Scan>> entry : snapshotScans.entrySet()) { String snapshotName = entry.getKey(); Collection<Scan> scans = entry.getValue(); // serialize all scans and map them to the appropriate snapshot for (Scan scan : scans) { snapshotToSerializedScans.add(new AbstractMap.SimpleImmutableEntry<>(snapshotName, TableMapReduceUtil.convertScanToString(scan))); } } ConfigurationUtil.setKeyValues(conf, SNAPSHOT_TO_SCANS_KEY, snapshotToSerializedScans); }
/** * Push snapshotScans to conf (under the key {@link #SNAPSHOT_TO_SCANS_KEY}) * * @param conf * @param snapshotScans * @throws IOException */ public void setSnapshotToScans(Configuration conf, Map<String, Collection<Scan>> snapshotScans) throws IOException { // flatten out snapshotScans for serialization to the job conf List<Map.Entry<String, String>> snapshotToSerializedScans = Lists.newArrayList(); for (Map.Entry<String, Collection<Scan>> entry : snapshotScans.entrySet()) { String snapshotName = entry.getKey(); Collection<Scan> scans = entry.getValue(); // serialize all scans and map them to the appropriate snapshot for (Scan scan : scans) { snapshotToSerializedScans.add(new AbstractMap.SimpleImmutableEntry<String, String>(snapshotName, TableMapReduceUtil.convertScanToString(scan))); } } ConfigurationUtil.setKeyValues(conf, SNAPSHOT_TO_SCANS_KEY, snapshotToSerializedScans); }
scanStrings.add(convertScanToString(scan));
HBaseConfiguration.merge(conf, HBaseConfiguration.create(conf)); conf.set(TableInputFormat.INPUT_TABLE, table); conf.set(TableInputFormat.SCAN, convertScanToString(scan)); if (addDependencyJars) { addDependencyJars(job);