ActiveViam では、Apache Spark でインタラクティブな OLAP クエリを実行する必要もありました。そこで、データを移動せずに、Spark データセットを多次元キューブとして公開するSparkubeという拡張機能を作成しました。
データセットがこのように公開されると、 DRILLDOWN、DRILLUPなど、Spark 上にあるすべての OLAP MDX 関数に直接アクセスできます。
たとえば、CSV ファイルのコンテンツをメモリにマウントし、それを多次元キューブとして公開する方法を次に示します。
// Load a file into a Spark dataset.
// Here we load a CSV file, get the column names from
// the CSV headers, and use Spark automatic type inference.
var ds = spark.read
.format("csv")
.option("header","true")
.option("inferSchema","true")
.load("path/to/file.csv")
// Import the sparkube library (the sparkube jar must be in the classpath)
import com.activeviam.sparkube._
// Expose the dataset as a multidimensional cube.
// You can start visualizing the cube right away at http://localhost:9090/ui
// or connect from Excel with the XMLA protocol at http://localhost:9090/xmla
new Sparkube().fromDataset(ds)
.withName("My first cube")
.expose()