.forTable(schema) .using(insertStatement) .withPartitioner(ConfigHelper.getOutputPartitioner(conf))
private void prepareWriter() throws IOException { if (writer == null) { writer = CQLSSTableWriter.builder() .forTable(schema) .using(insertStatement) .withPartitioner(ConfigHelper.getOutputPartitioner(conf)) .inDirectory(outputDir) .withBufferSizeInMB(Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64"))) .withPartitioner(partitioner) .build(); } if (loader == null) { ExternalClient externalClient = new ExternalClient(conf); externalClient.setTableMetadata(CFMetaData.compile(schema, keyspace)); loader = new SSTableLoader(outputDir, externalClient, new NullOutputHandler()) { @Override public void onSuccess(StreamState finalState) { if (deleteSrc) FileUtils.deleteRecursive(outputDir); } }; } }
private void prepareWriter() throws IOException { if (writer == null) { writer = CQLSSTableWriter.builder() .forTable(schema) .using(insertStatement) .withPartitioner(ConfigHelper.getOutputPartitioner(conf)) .inDirectory(outputDir) .withBufferSizeInMB(Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64"))) .withPartitioner(partitioner) .build(); } if (loader == null) { ExternalClient externalClient = new ExternalClient(conf); externalClient.setTableMetadata(CFMetaData.compile(schema, keyspace)); loader = new SSTableLoader(outputDir, externalClient, new NullOutputHandler()) { @Override public void onSuccess(StreamState finalState) { if (deleteSrc) FileUtils.deleteRecursive(outputDir); } }; } }
private void prepareWriter() throws IOException { if (writer == null) { writer = CQLSSTableWriter.builder() .forTable(schema) .using(insertStatement) .withPartitioner(ConfigHelper.getOutputPartitioner(conf)) .inDirectory(outputDir) .withBufferSizeInMB(Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64"))) .withPartitioner(partitioner) .build(); } if (loader == null) { ExternalClient externalClient = new ExternalClient(conf); externalClient.setTableMetadata(CFMetaData.compile(schema, keyspace)); loader = new SSTableLoader(outputDir, externalClient, new NullOutputHandler()) { @Override public void onSuccess(StreamState finalState) { if (deleteSrc) FileUtils.deleteRecursive(outputDir); } }; } }
private CQLSSTableWriter createWriter() { String schema = "CREATE TABLE " + keyspace + ".data ( " + "tenant_id text, " + "type tinyint, " + "metric text, " + "dpart bigint, " + "time timeuuid, " + "data_retention int static, " + "n_value double, " + "availability blob, " + "l_value bigint, " + // Commenting out the aggregates column because there appears to be a bug in the C* // code that breaks CQLSSTableWriter when the schema includes a collection. Fortunately, // we are not using the column so it can safely be ignored. // "aggregates set<frozen <aggregate_data>>, " + "PRIMARY KEY ((tenant_id, type, metric, dpart), time) " + ") WITH CLUSTERING ORDER BY (time DESC)"; String insertGauge = "INSERT INTO " + keyspace + ".data (tenant_id, type, metric, dpart, time, n_value) " + "VALUES (?, ?, ?, ?, ?, ?)"; return CQLSSTableWriter.builder() .inDirectory(dataDir) .forTable(schema) .using(insertGauge) .withBufferSizeInMB(bufferSize) .build(); }