Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup actions #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ private <T, U> Dataset compileSql(SqlStream<T, U> op) {
// forced encoding change
Dataset<Tuple2<Long, T>> dataset = compile(op.stream).map((MapFunction<Tuple2<Long, T>, Tuple2<Long, T>>) v1 -> v1,
Encoders.tuple(Encoders.LONG(), Utils.encodeBean(op.stream.getClazz())));
dataset.printSchema();
dataset.show();
if (!StringUtils.isBlank(debugDir)) {
if (DEBUG) {
dataset.printSchema();
dataset.show();
dataset.coalesce(1).write().format("json").save(debugDir + "/sql-input-" + UUID.randomUUID().toString());
}

Expand Down Expand Up @@ -215,9 +215,11 @@ private <T, U> Dataset compileSql(SqlStream<T, U> op) {
Column[] cc = new Column[cols.size()];
cc = cols.toArray(cc);
Dataset<Row> fatDs = fatResult.withColumn("_tempDataStruct", struct(cc));
fatResult.show();
fatResult.printSchema();

if (DEBUG) {
fatResult.show();
fatResult.printSchema();
}

// drop previously added columns
for (Field prevField : fields) {
Expand Down Expand Up @@ -339,8 +341,10 @@ private <K, T, U, W extends Window> Dataset compileWindowedViaSQL(WindowedStream
sparkSession.udf().register("riskyAgg", udaf(agg, Utils.encodeBean(inClz)));
String tempTableName = "windowedTempTable";
rowDs.createOrReplaceTempView(tempTableName);
rowDs.show();
rowDs.printSchema();
if (DEBUG){
rowDs.show();
rowDs.printSchema();
}
String query = "select ts, key, riskyAgg(" + valueExpr + ") over (PARTITION BY key ORDER BY ts RANGE BETWEEN " + size + " PRECEDING AND CURRENT ROW) as agg_result from " + tempTableName;
Dataset<Row> sqlResult = sparkSession.sql(query);
Dataset<Tuple3<Long, K, U>> typedDs = sqlResult.as(Encoders.tuple(Encoders.LONG(), Utils.encodeBean(op.keyClass()), Utils.encodeBean(op.uc)));
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=com.airwallex.airskiff
name=core
version=2.0.52
version=2.0.53
org.gradle.daemon=true
org.gradle.parallel=true
file.encoding=utf-8
Expand Down