Skip to content

Commit

Permalink
TimeSeriesRDDBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: yl790 <[email protected]>
  • Loading branch information
yitao-li committed Jun 16, 2020
1 parent 07c2695 commit ac7c648
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/scala/com/twosigma/flint/annotation/SparklyrApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twosigma.flint.annotation;

/**
* API for sparklyr.flint
*/
public @interface SparklyrApi {
String message() default "";

String until() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twosigma.flint.timeseries

import java.util.concurrent.TimeUnit

import com.twosigma.flint.annotation.SparklyrApi
import org.apache.spark.rdd.RDD
import org.apache.spark.sql._
import org.apache.spark.sql.types._

@SparklyrApi
class TimeSeriesRDDBuilder(
isSorted: Boolean,
timeUnit: TimeUnit,
timeColumn: String
) {
def fromRDD(
rdd: RDD[Row],
schema: StructType
): TimeSeriesRDD = {
TimeSeriesRDD.fromRDD(rdd, schema)(isSorted, timeUnit, timeColumn)
}

def fromDF(
dataFrame: DataFrame
): TimeSeriesRDD = {
TimeSeriesRDD.fromDF(dataFrame)(isSorted, timeUnit, timeColumn)
}
}

0 comments on commit ac7c648

Please sign in to comment.