runsequence是下面的代码是不是很有效?
var gulp = require('gulp');
var del = require('del');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var runSequence = require('run-sequence');
var nodemon = require('gulp-nodemon');
gulp.task('clean', function(cb) {
console.log('YOLO1');
del(['build/*'], cb);
});
gulp.task('copy', function() {
console.log('YOLO2')
return gulp.src('client/www/index.html')
.pipe(gulp.dest('build'));
});
gulp.task('browserify', function() {
console.log('YOLO3')
return gulp.src('client/index.js')
.pipe(browserify({transform: 'reactify'}))
.pipe(concat('app.js'))
.pipe(gulp.dest('build'));
});
gulp.task('build', function(cb) {
console.log('YOLO4')
runSequence('clean', 'browserify', 'copy', cb);
});
gulp.task('default', ['build'], function() {
gulp.watch('client/*/*', ['build']);
nodemon({ script: './bin/www', ignore: ['gulpfile.js', 'build', 'client', 'dist'] });
});
Run Code Online (Sandbox Code Playgroud)
电流输出:
YOLO4,
YOLO1
Run Code Online (Sandbox Code Playgroud)
期望的输出: …
我试图捕获特定的运行时异常(因此不可抛出)并记录它(log.error 具有 void 返回类型)。在 vavr 中执行此操作的最简单方法是什么?
try {
sayHello();
} catch (MyAppRuntimeException ex) {
log.error("Error occured") // log.error returns void not Void so I couldn't find a suitable method in Vavr library
}
Run Code Online (Sandbox Code Playgroud)
我努力了
Try.run(() -> sayHello())
.recover(MyAppRuntimeException.class, ex->log.error("Error occured: {}", ex.getMessage()))
Run Code Online (Sandbox Code Playgroud)
我得到:
错误的返回类型 void 无法转换为 Void
如果 .recover 不是正确的方法,请建议我可以捕获一个特定异常但不能捕获 Throwable 的替代方法,因为它捕获所有异常和错误。
我使用thrift并在构建目录(build/generated-sources/thrift/<package name>/<class>)下生成一些源java文件(接口)但在我的下面src/main/java 我的类具有与生成的java文件相同的包定义,我的类也实现了thrift生成的接口所以我怎么能在我的build.gradle中配置它,所以它适用于i ntelliJ以及构建
plugins {
id "org.jruyi.thrift" version "0.3.1"
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "org.jruyi.thrift"
group 'com.hello'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.5
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.thrift', name: 'libthrift', version:'0.9.3'
compile 'com.datastax.cassandra:cassandra-driver-core:3.0.0'
compile 'com.datastax.cassandra:cassandra-driver-mapping:3.0.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
compileThrift {
thriftExecutable "/usr/local/hello/bin/thrift"
sourceDir "src/main/thrift"
createGenFolder false
}
task thrift(type: Exec) {
commandLine '/usr/local/hello/bin/thrift'
}
compileJava {
dependsOn 'compileThrift'
Run Code Online (Sandbox Code Playgroud) 我试图找出如何在where子句下设置blob列.任何的想法?
例如,如果我在cqlsh中放入以下查询,它就可以工作
select * from hello where id=0xc1c1795a0b;
Run Code Online (Sandbox Code Playgroud)
// id是cassandra中的blob列
我尝试了以下内容
JavaRDD<CassandraRow> cassandraRowsRDD = javaFunctions(sc).cassandraTable("test", "hello")
.select("range" )
.where("id=?", "0xc1c1795a0b");
Run Code Online (Sandbox Code Playgroud)
这给了我一个类型转换器例外
我试过这个
JavaRDD<CassandraRow> cassandraRowsRDD = javaFunctions(sc).cassandraTable("test", "hello")
.select("range" )
.where("id=?", "0xc1c1795a0b".getBytes());
Run Code Online (Sandbox Code Playgroud)
这没有给我任何错误,但它没有返回任何结果.我的cqlsh中的查询确实返回了一堆结果.所以我不确定在where子句中设置一个blob.我正在使用Java.有任何想法吗?
如何使用Java 8和Open-JDK设置自定义DNS服务器来解析主机名?我在其他stackoverflow帖子中尝试了以下内容,但似乎不适用于open-jdk-8。有任何想法吗?
System.setProperty("sun.net.spi.nameservice.nameservers", "100.68.0.50");
System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun");
Run Code Online (Sandbox Code Playgroud)
100.68.0.50 是我的DNS服务器
有没有一种方法可以验证原始Spark SQL查询的语法?
例如,我想知道isValidspark是否提供任何API调用?
val query = "select * from table"
if(isValid(query)) {
sparkSession.sql(query)
} else {
log.error("Invalid Syntax")
}
Run Code Online (Sandbox Code Playgroud)
我尝试了以下
val query = "select * morf table" // Invalid query
val parser = spark.sessionState.sqlParser
try{
parser.parseExpression(query)
} catch (ParseException ex) {
throw new Exception(ex); //Exception not getting thrown
}
Dataset<>Row df = sparkSession.sql(query) // Exception gets thrown here
df.writeStream.format("console").start()
Run Code Online (Sandbox Code Playgroud)
问题:parser.parseExpression在我点击之前没有捕获到无效的语法sparkSession.sql。换句话说,它在上面的代码中没有帮助。任何原因?我的整个目标是在将语法错误传递给之前,先捕获语法错误sparkSession.sql
Spark Streaming 中 Append 模式和 Update 模式的真正区别是什么?
根据文档:
追加模式(默认) - 这是默认模式,只有自上次触发后添加到结果表中的新行才会输出到接收器。这仅支持添加到结果表中的行永远不会改变的那些查询。因此,这种模式保证每一行只输出一次(假设容错接收器)。例如,只有 select、where、map、flatMap、filter、join 等的查询将支持 Append 模式。
和
更新模式 -(自 Spark 2.1.1 起可用)只有自上次触发后更新的结果表中的行才会输出到接收器。更多信息将在未来版本中添加。
我对追加模式的困惑:它表示自上次触发器以来“仅”添加到结果表中的新行将被输出到接收器。所以,例如,假设我们有三行
r1, r2, r3到了t1, t2, t3哪里t1<t2<t3
现在说在 t4 行 r2 被覆盖了,如果是这样,当我们在追加模式下操作时,我们将永远不会在接收器中看到它?这不是像丢失一个写吗?
我对更新模式的困惑:它说“仅”自上次触发器以来更新的结果表中的行将输出到接收器。这是否意味着行应该已经存在,并且只有在更新现有行时才会输出到下沉?如果在此更新模式下没有现有行并且有新行进来会发生什么?
如何读取cassandra nodetool直方图百分位数和其他coulmns?
Percentile SSTables Write Latency Read Latency Partition Size Cell Count
(micros) (micros) (bytes)
50% 1.00 14.24 4055.27 149 2
75% 35.00 17.08 17436.92 149 2
95% 35.00 24.60 74975.55 642 2
98% 86.00 35.43 129557.75 770 2
99% 103.00 51.01 186563.16 770 2
Min 0.00 2.76 51.01 104 2
Max 124.00 36904729.27 12359319.16 924 2
Run Code Online (Sandbox Code Playgroud) 我可以为每个字段存储一些业务元数据吗?换句话说,我有一些业务元数据想要指定每个字段,这在 Avro 中可能吗?