├── .gitignore ├── LICENSE ├── README.md ├── bin ├── eclairjs-bluemix-spark-submit.sh └── eclairjs.sh ├── docs └── jsdoc │ ├── Accumulable.html │ ├── AccumulableParam.html │ ├── Accumulator.html │ ├── Accumulators.js.html │ ├── DStream.html │ ├── DebugUtils.js.html │ ├── Duration.html │ ├── FloatAccumulatorParam.html │ ├── FloatRDD.html │ ├── FloatRDD.js.html │ ├── FutureAction.html │ ├── FutureAction.js.html │ ├── HashPartitioner.html │ ├── IntAccumulatorParam.html │ ├── Logger.html │ ├── Logger.js.html │ ├── ModuleUtils.js.html │ ├── PairDStream.html │ ├── PairRDD.html │ ├── PairRDD.js.html │ ├── PartialResult.html │ ├── Partitioner.html │ ├── Partitioner.js.html │ ├── RDD.js.html │ ├── RangePartitioner.html │ ├── SparkConf.html │ ├── SparkConf.js.html │ ├── SparkContext.js.html │ ├── SparkFiles.html │ ├── SparkFiles.js.html │ ├── SparkStatusTracker.html │ ├── SparkStatusTracker.js.html │ ├── StreamingContext.html │ ├── Time.html │ ├── Tuple.html │ ├── TwitterAuthorization.html │ ├── Utils.js.html │ ├── eclair.js.html │ ├── eclairjs_Accumulable.js.html │ ├── eclairjs_AccumulableParam.js.html │ ├── eclairjs_Accumulator.js.html │ ├── eclairjs_AccumulatorParam.js.html │ ├── eclairjs_DebugUtils.js.html │ ├── eclairjs_FloatAccumulatorParam.js.html │ ├── eclairjs_FloatRDD.js.html │ ├── eclairjs_FutureAction.js.html │ ├── eclairjs_HashPartitioner.js.html │ ├── eclairjs_IntAccumulatorParam.js.html │ ├── eclairjs_List.js.html │ ├── eclairjs_Logger.js.html │ ├── eclairjs_ModuleUtils.js.html │ ├── eclairjs_PairRDD.js.html │ ├── eclairjs_Partitioner.js.html │ ├── eclairjs_RDD.js.html │ ├── eclairjs_RangePartitioner.js.html │ ├── eclairjs_Serializable.js.html │ ├── eclairjs_SparkConf.js.html │ ├── eclairjs_SparkContext.js.html │ ├── eclairjs_SparkFiles.js.html │ ├── eclairjs_SparkJobInfo.js.html │ ├── eclairjs_SparkStageInfo.js.html │ ├── eclairjs_SparkStatusTracker.js.html │ ├── eclairjs_Tuple.js.html │ ├── eclairjs_Tuple2.js.html │ ├── eclairjs_Tuple3.js.html │ ├── eclairjs_Tuple4.js.html │ ├── eclairjs_Tuple5.js.html │ ├── eclairjs_Utils.js.html │ ├── eclairjs_broadcast.js.html │ ├── eclairjs_broadcast_Broadcast.js.html │ ├── eclairjs_broadcast_TorrentBroadcast.js.html │ ├── eclairjs_jvm-npm_jvm-npm.js.html │ ├── eclairjs_ml.js.html │ ├── eclairjs_ml_Estimator.js.html │ ├── eclairjs_ml_Model.js.html │ ├── eclairjs_ml_Pipeline.js.html │ ├── eclairjs_ml_PipelineModel.js.html │ ├── eclairjs_ml_PipelineStage.js.html │ ├── eclairjs_ml_PredictionModel.js.html │ ├── eclairjs_ml_Predictor.js.html │ ├── eclairjs_ml_Transformer.js.html │ ├── eclairjs_ml_UnaryTransformer.js.html │ ├── eclairjs_ml_attribute.js.html │ ├── eclairjs_ml_attribute_AttributeGroup.js.html │ ├── eclairjs_ml_attribute_NumericAttribute.js.html │ ├── eclairjs_ml_classification.js.html │ ├── eclairjs_ml_classification_BinaryLogisticRegressionSummary.js.html │ ├── eclairjs_ml_classification_BinaryLogisticRegressionTrainingSummary.js.html │ ├── eclairjs_ml_classification_ClassificationModel.js.html │ ├── eclairjs_ml_classification_Classifier.js.html │ ├── eclairjs_ml_classification_DecisionTreeClassificationModel.js.html │ ├── eclairjs_ml_classification_DecisionTreeClassifier.js.html │ ├── eclairjs_ml_classification_GBTClassificationModel.js.html │ ├── eclairjs_ml_classification_GBTClassifier.js.html │ ├── eclairjs_ml_classification_LogisticRegression.js.html │ ├── eclairjs_ml_classification_LogisticRegressionModel.js.html │ ├── eclairjs_ml_classification_LogisticRegressionSummary.js.html │ ├── eclairjs_ml_classification_LogisticRegressionTrainingSummary.js.html │ ├── eclairjs_ml_classification_MultilayerPerceptronClassificationModel.js.html │ ├── eclairjs_ml_classification_MultilayerPerceptronClassifier.js.html │ ├── eclairjs_ml_classification_NaiveBayes.js.html │ ├── eclairjs_ml_classification_NaiveBayesModel.js.html │ ├── eclairjs_ml_classification_OneVsRest.js.html │ ├── eclairjs_ml_classification_OneVsRestModel.js.html │ ├── eclairjs_ml_classification_ProbabilisticClassificationModel.js.html │ ├── eclairjs_ml_classification_ProbabilisticClassifier.js.html │ ├── eclairjs_ml_classification_RandomForestClassificationModel.js.html │ ├── eclairjs_ml_classification_RandomForestClassifier.js.html │ ├── eclairjs_ml_clustering.js.html │ ├── eclairjs_ml_clustering_BisectingKMeans.js.html │ ├── eclairjs_ml_clustering_BisectingKMeansModel.js.html │ ├── eclairjs_ml_clustering_DistributedLDAModel.js.html │ ├── eclairjs_ml_clustering_GaussianMixture.js.html │ ├── eclairjs_ml_clustering_GaussianMixtureModel.js.html │ ├── eclairjs_ml_clustering_GaussianMixtureSummary.js.html │ ├── eclairjs_ml_clustering_KMeans.js.html │ ├── eclairjs_ml_clustering_KMeansModel.js.html │ ├── eclairjs_ml_clustering_LDA.js.html │ ├── eclairjs_ml_clustering_LDAModel.js.html │ ├── eclairjs_ml_clustering_LocalLDAModel.js.html │ ├── eclairjs_ml_evaluation.js.html │ ├── eclairjs_ml_evaluation_Evaluator.js.html │ ├── eclairjs_ml_evaluation_MulticlassClassificationEvaluator.js.html │ ├── eclairjs_ml_evaluation_RegressionEvaluator.js.html │ ├── eclairjs_ml_feature.js.html │ ├── eclairjs_ml_feature_Binarizer.js.html │ ├── eclairjs_ml_feature_Bucketizer.js.html │ ├── eclairjs_ml_feature_ChiSqSelector.js.html │ ├── eclairjs_ml_feature_ChiSqSelectorModel.js.html │ ├── eclairjs_ml_feature_CountVectorizer.js.html │ ├── eclairjs_ml_feature_CountVectorizerModel.js.html │ ├── eclairjs_ml_feature_DCT.js.html │ ├── eclairjs_ml_feature_ElementwiseProduct.js.html │ ├── eclairjs_ml_feature_HashingTF.js.html │ ├── eclairjs_ml_feature_IDF.js.html │ ├── eclairjs_ml_feature_IDFModel.js.html │ ├── eclairjs_ml_feature_IndexToString.js.html │ ├── eclairjs_ml_feature_MaxAbsScaler.js.html │ ├── eclairjs_ml_feature_MaxAbsScalerModel.js.html │ ├── eclairjs_ml_feature_MinMaxScaler.js.html │ ├── eclairjs_ml_feature_MinMaxScalerModel.js.html │ ├── eclairjs_ml_feature_NGram.js.html │ ├── eclairjs_ml_feature_Normalizer.js.html │ ├── eclairjs_ml_feature_OneHotEncoder.js.html │ ├── eclairjs_ml_feature_PCA.js.html │ ├── eclairjs_ml_feature_PCAModel.js.html │ ├── eclairjs_ml_feature_PolynomialExpansion.js.html │ ├── eclairjs_ml_feature_QuantileDiscretizer.js.html │ ├── eclairjs_ml_feature_RFormula.js.html │ ├── eclairjs_ml_feature_RFormulaModel.js.html │ ├── eclairjs_ml_feature_RegexTokenizer.js.html │ ├── eclairjs_ml_feature_SQLTransformer.js.html │ ├── eclairjs_ml_feature_StandardScaler.js.html │ ├── eclairjs_ml_feature_StandardScalerModel.js.html │ ├── eclairjs_ml_feature_StopWordsRemover.js.html │ ├── eclairjs_ml_feature_StringIndexer.js.html │ ├── eclairjs_ml_feature_StringIndexerModel.js.html │ ├── eclairjs_ml_feature_Tokenizer.js.html │ ├── eclairjs_ml_feature_VectorAssembler.js.html │ ├── eclairjs_ml_feature_VectorIndexer.js.html │ ├── eclairjs_ml_feature_VectorIndexerModel.js.html │ ├── eclairjs_ml_feature_VectorSlicer.js.html │ ├── eclairjs_ml_feature_Word2Vec.js.html │ ├── eclairjs_ml_feature_Word2VecModel.js.html │ ├── eclairjs_ml_linalg.js.html │ ├── eclairjs_ml_linalg_DenseVector.js.html │ ├── eclairjs_ml_linalg_SparseVector.js.html │ ├── eclairjs_ml_linalg_Vector.js.html │ ├── eclairjs_ml_linalg_VectorUDT.js.html │ ├── eclairjs_ml_linalg_Vectors.js.html │ ├── eclairjs_ml_param.js.html │ ├── eclairjs_ml_param_BooleanParam.js.html │ ├── eclairjs_ml_param_DoubleParam.js.html │ ├── eclairjs_ml_param_IntArrayParam.js.html │ ├── eclairjs_ml_param_IntParam.js.html │ ├── eclairjs_ml_param_Param.js.html │ ├── eclairjs_ml_param_ParamMap.js.html │ ├── eclairjs_ml_param_ParamPair.js.html │ ├── eclairjs_ml_param_StringArrayParam.js.html │ ├── eclairjs_ml_recommendation.js.html │ ├── eclairjs_ml_recommendation_ALS.js.html │ ├── eclairjs_ml_recommendation_ALSModel.js.html │ ├── eclairjs_ml_regression.js.html │ ├── eclairjs_ml_regression_AFTSurvivalRegression.js.html │ ├── eclairjs_ml_regression_AFTSurvivalRegressionModel.js.html │ ├── eclairjs_ml_regression_DecisionTreeRegressionModel.js.html │ ├── eclairjs_ml_regression_DecisionTreeRegressor.js.html │ ├── eclairjs_ml_regression_GBTRegressionModel.js.html │ ├── eclairjs_ml_regression_GBTRegressor.js.html │ ├── eclairjs_ml_regression_GeneralizedLinearRegression.js.html │ ├── eclairjs_ml_regression_GeneralizedLinearRegressionModel.js.html │ ├── eclairjs_ml_regression_GeneralizedLinearRegressionSummary.js.html │ ├── eclairjs_ml_regression_GeneralizedLinearRegressionTrainingSummary.js.html │ ├── eclairjs_ml_regression_LinearRegression.js.html │ ├── eclairjs_ml_regression_LinearRegressionModel.js.html │ ├── eclairjs_ml_regression_LinearRegressionSummary.js.html │ ├── eclairjs_ml_regression_LinearRegressionTrainingSummary.js.html │ ├── eclairjs_ml_regression_RandomForestRegressionModel.js.html │ ├── eclairjs_ml_regression_RandomForestRegressor.js.html │ ├── eclairjs_ml_regression_RegressionModel.js.html │ ├── eclairjs_ml_tuning.js.html │ ├── eclairjs_ml_tuning_ParamGridBuilder.js.html │ ├── eclairjs_ml_tuning_TrainValidationSplit.js.html │ ├── eclairjs_ml_tuning_TrainValidationSplitModel.js.html │ ├── eclairjs_ml_util.js.html │ ├── eclairjs_ml_util_DefaultParamsWritable.js.html │ ├── eclairjs_ml_util_MLReader.js.html │ ├── eclairjs_ml_util_MLWritable.js.html │ ├── eclairjs_ml_util_MLWriter.js.html │ ├── eclairjs_mllib.js.html │ ├── eclairjs_mllib_MLUtils.js.html │ ├── eclairjs_mllib_classification.js.html │ ├── eclairjs_mllib_classification_ClassificationModel.js.html │ ├── eclairjs_mllib_classification_LogisticRegressionModel.js.html │ ├── eclairjs_mllib_classification_LogisticRegressionWithLBFGS.js.html │ ├── eclairjs_mllib_classification_LogisticRegressionWithSGD.js.html │ ├── eclairjs_mllib_classification_NaiveBayes.js.html │ ├── eclairjs_mllib_classification_NaiveBayesModel.js.html │ ├── eclairjs_mllib_classification_SVMModel.js.html │ ├── eclairjs_mllib_classification_SVMWithSGD.js.html │ ├── eclairjs_mllib_clustering.js.html │ ├── eclairjs_mllib_clustering_BisectingKMeans.js.html │ ├── eclairjs_mllib_clustering_BisectingKMeansModel.js.html │ ├── eclairjs_mllib_clustering_DistributedLDAModel.js.html │ ├── eclairjs_mllib_clustering_KMeans.js.html │ ├── eclairjs_mllib_clustering_KMeansModel.js.html │ ├── eclairjs_mllib_clustering_LDA.js.html │ ├── eclairjs_mllib_clustering_LDAModel.js.html │ ├── eclairjs_mllib_clustering_LocalLDAModel.js.html │ ├── eclairjs_mllib_clustering_PowerIterationClustering.js.html │ ├── eclairjs_mllib_clustering_PowerIterationClusteringAssignment.js.html │ ├── eclairjs_mllib_clustering_PowerIterationClusteringModel.js.html │ ├── eclairjs_mllib_evaluation.js.html │ ├── eclairjs_mllib_evaluation_BinaryClassificationMetrics.js.html │ ├── eclairjs_mllib_evaluation_MulticlassMetrics.js.html │ ├── eclairjs_mllib_evaluation_MultilabelMetrics.js.html │ ├── eclairjs_mllib_evaluation_RankingMetrics.js.html │ ├── eclairjs_mllib_evaluation_RegressionMetrics.js.html │ ├── eclairjs_mllib_feature.js.html │ ├── eclairjs_mllib_feature_Word2Vec.js.html │ ├── eclairjs_mllib_feature_Word2VecModel.js.html │ ├── eclairjs_mllib_fpm.js.html │ ├── eclairjs_mllib_fpm_AssociationRules.js.html │ ├── eclairjs_mllib_fpm_FPGrowth.js.html │ ├── eclairjs_mllib_fpm_FPGrowthModel.js.html │ ├── eclairjs_mllib_fpm_FreqItemset.js.html │ ├── eclairjs_mllib_fpm_PrefixSpan.js.html │ ├── eclairjs_mllib_fpm_PrefixSpanFreqSequence.js.html │ ├── eclairjs_mllib_fpm_PrefixSpanModel.js.html │ ├── eclairjs_mllib_fpm_Rule.js.html │ ├── eclairjs_mllib_linalg.js.html │ ├── eclairjs_mllib_linalg_DenseMatrix.js.html │ ├── eclairjs_mllib_linalg_DenseVector.js.html │ ├── eclairjs_mllib_linalg_Matrices.js.html │ ├── eclairjs_mllib_linalg_Matrix.js.html │ ├── eclairjs_mllib_linalg_QRDecomposition.js.html │ ├── eclairjs_mllib_linalg_SingularValueDecomposition.js.html │ ├── eclairjs_mllib_linalg_SparseMatrix.js.html │ ├── eclairjs_mllib_linalg_SparseVector.js.html │ ├── eclairjs_mllib_linalg_Vector.js.html │ ├── eclairjs_mllib_linalg_VectorUDT.js.html │ ├── eclairjs_mllib_linalg_Vectors.js.html │ ├── eclairjs_mllib_linalg_distributed.js.html │ ├── eclairjs_mllib_linalg_distributed_DistributedMatrix.js.html │ ├── eclairjs_mllib_linalg_distributed_RowMatrix.js.html │ ├── eclairjs_mllib_optimization.js.html │ ├── eclairjs_mllib_optimization_Gradient.js.html │ ├── eclairjs_mllib_optimization_LBFGS.js.html │ ├── eclairjs_mllib_optimization_LogisticGradient.js.html │ ├── eclairjs_mllib_optimization_SquaredL2Updater.js.html │ ├── eclairjs_mllib_optimization_Updater.js.html │ ├── eclairjs_mllib_random.js.html │ ├── eclairjs_mllib_random_RandomRDDs.js.html │ ├── eclairjs_mllib_recommendation.js.html │ ├── eclairjs_mllib_recommendation_ALS.js.html │ ├── eclairjs_mllib_recommendation_MatrixFactorizationModel.js.html │ ├── eclairjs_mllib_recommendation_Rating.js.html │ ├── eclairjs_mllib_regression.js.html │ ├── eclairjs_mllib_regression_GeneralizedLinearModel.js.html │ ├── eclairjs_mllib_regression_IsotonicRegression.js.html │ ├── eclairjs_mllib_regression_IsotonicRegressionModel.js.html │ ├── eclairjs_mllib_regression_LabeledPoint.js.html │ ├── eclairjs_mllib_regression_LinearRegressionModel.js.html │ ├── eclairjs_mllib_regression_LinearRegressionWithSGD.js.html │ ├── eclairjs_mllib_tree.js.html │ ├── eclairjs_mllib_tree_DecisionTree.js.html │ ├── eclairjs_mllib_tree_GradientBoostedTrees.js.html │ ├── eclairjs_mllib_tree_RandomForest.js.html │ ├── eclairjs_mllib_tree_configuration.js.html │ ├── eclairjs_mllib_tree_configuration_BoostingStrategy.js.html │ ├── eclairjs_mllib_tree_configuration_Strategy.js.html │ ├── eclairjs_mllib_tree_loss.js.html │ ├── eclairjs_mllib_tree_loss_Loss.js.html │ ├── eclairjs_mllib_tree_model.js.html │ ├── eclairjs_mllib_tree_model_DecisionTreeModel.js.html │ ├── eclairjs_mllib_tree_model_GradientBoostedTreesModel.js.html │ ├── eclairjs_mllib_tree_model_RandomForestModel.js.html │ ├── eclairjs_partial.js.html │ ├── eclairjs_partial_PartialResult.js.html │ ├── eclairjs_sql.js.html │ ├── eclairjs_sql_Column.js.html │ ├── eclairjs_sql_DataFrame.js.html │ ├── eclairjs_sql_DataFrameHolder.js.html │ ├── eclairjs_sql_DataFrameNaFunctions.js.html │ ├── eclairjs_sql_DataFrameReader.js.html │ ├── eclairjs_sql_DataFrameStatFunctions.js.html │ ├── eclairjs_sql_DataFrameWriter.js.html │ ├── eclairjs_sql_Dataset.js.html │ ├── eclairjs_sql_Encoder.js.html │ ├── eclairjs_sql_Encoders.js.html │ ├── eclairjs_sql_GroupedData.js.html │ ├── eclairjs_sql_RelationalGroupedDataset.js.html │ ├── eclairjs_sql_Row.js.html │ ├── eclairjs_sql_RowFactory.js.html │ ├── eclairjs_sql_SQLContext.js.html │ ├── eclairjs_sql_SparkSession.js.html │ ├── eclairjs_sql_SparkSessionBuilder.js.html │ ├── eclairjs_sql_SqlDate.js.html │ ├── eclairjs_sql_SqlTimestamp.js.html │ ├── eclairjs_sql_UDFRegistration.js.html │ ├── eclairjs_sql_UserDefinedFunction.js.html │ ├── eclairjs_sql_execution.js.html │ ├── eclairjs_sql_execution_QueryExecution.js.html │ ├── eclairjs_sql_functions.js.html │ ├── eclairjs_sql_streaming.js.html │ ├── eclairjs_sql_streaming_DataStreamReader.js.html │ ├── eclairjs_sql_streaming_DataStreamWriter.js.html │ ├── eclairjs_sql_streaming_ProcessingTime.js.html │ ├── eclairjs_sql_streaming_SinkStatus.js.html │ ├── eclairjs_sql_streaming_SourceStatus.js.html │ ├── eclairjs_sql_streaming_StreamingQuery.js.html │ ├── eclairjs_sql_streaming_StreamingQueryInfo.js.html │ ├── eclairjs_sql_streaming_StreamingQueryListener.js.html │ ├── eclairjs_sql_streaming_StreamingQueryManager.js.html │ ├── eclairjs_sql_types.js.html │ ├── eclairjs_sql_types_ArrayType.js.html │ ├── eclairjs_sql_types_BinaryType.js.html │ ├── eclairjs_sql_types_BooleanType.js.html │ ├── eclairjs_sql_types_CalendarIntervalType.js.html │ ├── eclairjs_sql_types_DataType.js.html │ ├── eclairjs_sql_types_DataTypes.js.html │ ├── eclairjs_sql_types_DateType.js.html │ ├── eclairjs_sql_types_DoubleType.js.html │ ├── eclairjs_sql_types_FloatType.js.html │ ├── eclairjs_sql_types_IntegerType.js.html │ ├── eclairjs_sql_types_MapType.js.html │ ├── eclairjs_sql_types_Metadata.js.html │ ├── eclairjs_sql_types_NullType.js.html │ ├── eclairjs_sql_types_NumericType.js.html │ ├── eclairjs_sql_types_StringType.js.html │ ├── eclairjs_sql_types_StructField.js.html │ ├── eclairjs_sql_types_StructType.js.html │ ├── eclairjs_sql_types_TimestampType.js.html │ ├── eclairjs_storage.js.html │ ├── eclairjs_storage_StorageLevel.js.html │ ├── eclairjs_streaming.js.html │ ├── eclairjs_streaming_Duration.js.html │ ├── eclairjs_streaming_StreamingContext.js.html │ ├── eclairjs_streaming_Time.js.html │ ├── eclairjs_streaming_dstream.js.html │ ├── eclairjs_streaming_dstream_DStream.js.html │ ├── eclairjs_streaming_dstream_PairDStream.js.html │ ├── eclairjs_streaming_kafka.js.html │ ├── eclairjs_streaming_kafka_KafkaUtils.js.html │ ├── eclairjs_streaming_twitter.js.html │ ├── eclairjs_streaming_twitter_TwitterAuthorization.js.html │ ├── eclairjs_streaming_twitter_TwitterUtils.js.html │ ├── eclairjs_util.js.html │ ├── eclairjs_util_StatCounter.js.html │ ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.svg │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.svg │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Italic-webfont.svg │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.svg │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ ├── OpenSans-LightItalic-webfont.svg │ ├── OpenSans-LightItalic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.svg │ └── OpenSans-Regular-webfont.woff │ ├── global.html │ ├── index.html │ ├── jvm-npm_jvm-npm.js.html │ ├── ml_feature.js.html │ ├── ml_feature_Word2Vec.js.html │ ├── ml_feature_Word2VecModel.js.html │ ├── mllib.js.html │ ├── mllib_MLUtils.js.html │ ├── mllib_classification.js.html │ ├── mllib_classification_ClassificationModel.js.html │ ├── mllib_classification_LogisticRegressionModel.js.html │ ├── mllib_classification_LogisticRegressionWithLBFGS.js.html │ ├── mllib_classification_LogisticRegressionWithSGD.js.html │ ├── mllib_classification_NaiveBayes.js.html │ ├── mllib_classification_NaiveBayesModel.js.html │ ├── mllib_classification_SVMModel.js.html │ ├── mllib_classification_SVMWithSGD.js.html │ ├── mllib_clustering.js.html │ ├── mllib_clustering_BisectingKMeans.js.html │ ├── mllib_clustering_BisectingKMeansModel.js.html │ ├── mllib_clustering_DistributedLDAModel.js.html │ ├── mllib_clustering_KMeans.js.html │ ├── mllib_clustering_KMeansModel.js.html │ ├── mllib_clustering_LDAModel.js.html │ ├── mllib_clustering_LocalLDAModel.js.html │ ├── mllib_clustering_PowerIterationClustering.js.html │ ├── mllib_clustering_PowerIterationClusteringAssignment.js.html │ ├── mllib_clustering_PowerIterationClusteringModel.js.html │ ├── mllib_evaluation.js.html │ ├── mllib_evaluation_BinaryClassificationMetrics.js.html │ ├── mllib_evaluation_MulticlassMetrics.js.html │ ├── mllib_evaluation_MultilabelMetrics.js.html │ ├── mllib_evaluation_RankingMetrics.js.html │ ├── mllib_evaluation_RegressionMetrics.js.html │ ├── mllib_feature.js.html │ ├── mllib_feature_Word2Vec.js.html │ ├── mllib_feature_Word2VecModel.js.html │ ├── mllib_fpm.js.html │ ├── mllib_fpm_AssociationRules.js.html │ ├── mllib_fpm_FPGrowth.js.html │ ├── mllib_fpm_FPGrowthModel.js.html │ ├── mllib_fpm_FreqItemset.js.html │ ├── mllib_fpm_PrefixSpan.js.html │ ├── mllib_fpm_PrefixSpanFreqSequence.js.html │ ├── mllib_fpm_PrefixSpanModel.js.html │ ├── mllib_fpm_Rule.js.html │ ├── mllib_linalg.js.html │ ├── mllib_linalg_DenseMatrix.js.html │ ├── mllib_linalg_DenseVector.js.html │ ├── mllib_linalg_Matrices.js.html │ ├── mllib_linalg_Matrix.js.html │ ├── mllib_linalg_QRDecomposition.js.html │ ├── mllib_linalg_SingularValueDecomposition.js.html │ ├── mllib_linalg_SparseMatrix.js.html │ ├── mllib_linalg_SparseVector.js.html │ ├── mllib_linalg_Vector.js.html │ ├── mllib_linalg_VectorUDT.js.html │ ├── mllib_linalg_Vectors.js.html │ ├── mllib_linalg_distributed.js.html │ ├── mllib_linalg_distributed_DistributedMatrix.js.html │ ├── mllib_linalg_distributed_RowMatrix.js.html │ ├── mllib_optimization.js.html │ ├── mllib_optimization_Gradient.js.html │ ├── mllib_optimization_LBFGS.js.html │ ├── mllib_optimization_LogisticGradient.js.html │ ├── mllib_optimization_SquaredL2Updater.js.html │ ├── mllib_optimization_Updater.js.html │ ├── mllib_random.js.html │ ├── mllib_recommendation.js.html │ ├── mllib_recommendation_MatrixFactorizationModel.js.html │ ├── mllib_recommendation_Rating.js.html │ ├── mllib_regression.js.html │ ├── mllib_regression_GeneralizedLinearModel.js.html │ ├── mllib_regression_IsotonicRegression.js.html │ ├── mllib_regression_IsotonicRegressionModel.js.html │ ├── mllib_regression_LabeledPoint.js.html │ ├── mllib_regression_LinearRegressionModel.js.html │ ├── mllib_regression_LinearRegressionWithSGD.js.html │ ├── mllib_tree.js.html │ ├── mllib_tree_DecisionTree.js.html │ ├── mllib_tree_GradientBoostedTrees.js.html │ ├── mllib_tree_RandomForest.js.html │ ├── mllib_tree_configuration.js.html │ ├── mllib_tree_configuration_BoostingStrategy.js.html │ ├── mllib_tree_configuration_Strategy.js.html │ ├── mllib_tree_loss.js.html │ ├── mllib_tree_loss_Loss.js.html │ ├── mllib_tree_model.js.html │ ├── mllib_tree_model_DecisionTreeModel.js.html │ ├── mllib_tree_model_GradientBoostedTreesModel.js.html │ ├── mllib_tree_model_RandomForestModel.js.html │ ├── module-eclairjs.Accumulable.html │ ├── module-eclairjs.AccumulableParam.html │ ├── module-eclairjs.Accumulator.html │ ├── module-eclairjs.FloatAccumulatorParam.html │ ├── module-eclairjs.FloatRDD.html │ ├── module-eclairjs.FutureAction.html │ ├── module-eclairjs.HashPartitioner.html │ ├── module-eclairjs.IntAccumulatorParam.html │ ├── module-eclairjs.List.html │ ├── module-eclairjs.Logger.html │ ├── module-eclairjs.PairRDD.html │ ├── module-eclairjs.Partitioner.html │ ├── module-eclairjs.RDD.html │ ├── module-eclairjs.RangePartitioner.html │ ├── module-eclairjs.Serializable.html │ ├── module-eclairjs.SparkConf.html │ ├── module-eclairjs.SparkContext.html │ ├── module-eclairjs.SparkFiles.html │ ├── module-eclairjs.SparkJobInfo.html │ ├── module-eclairjs.SparkStageInfo.html │ ├── module-eclairjs.SparkStatusTracker.html │ ├── module-eclairjs.Tuple.html │ ├── module-eclairjs.Tuple2.html │ ├── module-eclairjs.Tuple3.html │ ├── module-eclairjs.Tuple4.html │ ├── module-eclairjs.Tuple5.html │ ├── module-eclairjs.html │ ├── module-eclairjs_broadcast%0Aextends%20module_eclairjs_broadcast.Broadcast.TorrentBroadcast.html │ ├── module-eclairjs_broadcast.Broadcast.html │ ├── module-eclairjs_broadcast.TorrentBroadcast.html │ ├── module-eclairjs_broadcast.html │ ├── module-eclairjs_ml.Estimator.html │ ├── module-eclairjs_ml.Model.html │ ├── module-eclairjs_ml.Pipeline.html │ ├── module-eclairjs_ml.PipelineModel.html │ ├── module-eclairjs_ml.PipelineStage.html │ ├── module-eclairjs_ml.PredictionModel.html │ ├── module-eclairjs_ml.Predictor.html │ ├── module-eclairjs_ml.Transformer.html │ ├── module-eclairjs_ml.UnaryTransformer.html │ ├── module-eclairjs_ml.html │ ├── module-eclairjs_ml_attribute.AttributeGroup.html │ ├── module-eclairjs_ml_attribute.NumericAttribute.html │ ├── module-eclairjs_ml_attribute.html │ ├── module-eclairjs_ml_classification.BinaryLogisticRegressionSummary.html │ ├── module-eclairjs_ml_classification.BinaryLogisticRegressionTrainingSummary.html │ ├── module-eclairjs_ml_classification.ClassificationModel.html │ ├── module-eclairjs_ml_classification.Classifier.html │ ├── module-eclairjs_ml_classification.DecisionTreeClassificationModel.html │ ├── module-eclairjs_ml_classification.DecisionTreeClassifier.html │ ├── module-eclairjs_ml_classification.GBTClassificationModel.html │ ├── module-eclairjs_ml_classification.GBTClassifier.html │ ├── module-eclairjs_ml_classification.LogisticRegression.html │ ├── module-eclairjs_ml_classification.LogisticRegressionModel.html │ ├── module-eclairjs_ml_classification.LogisticRegressionSummary.html │ ├── module-eclairjs_ml_classification.LogisticRegressionTrainingSummary.html │ ├── module-eclairjs_ml_classification.MultilayerPerceptronClassificationModel.html │ ├── module-eclairjs_ml_classification.MultilayerPerceptronClassifier.html │ ├── module-eclairjs_ml_classification.NaiveBayes.html │ ├── module-eclairjs_ml_classification.NaiveBayesModel.html │ ├── module-eclairjs_ml_classification.OneVsRestModel.html │ ├── module-eclairjs_ml_classification.ProbabilisticClassificationModel.html │ ├── module-eclairjs_ml_classification.ProbabilisticClassifier.html │ ├── module-eclairjs_ml_classification.RandomForestClassificationModel.html │ ├── module-eclairjs_ml_classification.RandomForestClassifier.html │ ├── module-eclairjs_ml_classification.html │ ├── module-eclairjs_ml_clustering.BisectingKMeansModel.html │ ├── module-eclairjs_ml_clustering.DistributedLDAModel.html │ ├── module-eclairjs_ml_clustering.GaussianMixtureModel.html │ ├── module-eclairjs_ml_clustering.GaussianMixtureSummary.html │ ├── module-eclairjs_ml_clustering.KMeans.html │ ├── module-eclairjs_ml_clustering.KMeansModel.html │ ├── module-eclairjs_ml_clustering.LDA.html │ ├── module-eclairjs_ml_clustering.LDAModel.html │ ├── module-eclairjs_ml_clustering.LocalLDAModel.html │ ├── module-eclairjs_ml_clustering.html │ ├── module-eclairjs_ml_evaluation.Evaluator.html │ ├── module-eclairjs_ml_evaluation.MulticlassClassificationEvaluator.html │ ├── module-eclairjs_ml_evaluation.RegressionEvaluator.html │ ├── module-eclairjs_ml_evaluation.html │ ├── module-eclairjs_ml_feature.Binarizer.html │ ├── module-eclairjs_ml_feature.Bucketizer.html │ ├── module-eclairjs_ml_feature.ChiSqSelector.html │ ├── module-eclairjs_ml_feature.ChiSqSelectorModel.html │ ├── module-eclairjs_ml_feature.CountVectorizer.html │ ├── module-eclairjs_ml_feature.CountVectorizerModel.html │ ├── module-eclairjs_ml_feature.DCT.html │ ├── module-eclairjs_ml_feature.ElementwiseProduct.html │ ├── module-eclairjs_ml_feature.HashingTF.html │ ├── module-eclairjs_ml_feature.IDFModel.html │ ├── module-eclairjs_ml_feature.IndexToString.html │ ├── module-eclairjs_ml_feature.MaxAbsScalerModel.html │ ├── module-eclairjs_ml_feature.MinMaxScaler.html │ ├── module-eclairjs_ml_feature.MinMaxScalerModel.html │ ├── module-eclairjs_ml_feature.NGram.html │ ├── module-eclairjs_ml_feature.Normalizer.html │ ├── module-eclairjs_ml_feature.OneHotEncoder.html │ ├── module-eclairjs_ml_feature.PCA.html │ ├── module-eclairjs_ml_feature.PCAModel.html │ ├── module-eclairjs_ml_feature.PolynomialExpansion.html │ ├── module-eclairjs_ml_feature.QuantileDiscretizer.html │ ├── module-eclairjs_ml_feature.RFormula.html │ ├── module-eclairjs_ml_feature.RFormulaModel.html │ ├── module-eclairjs_ml_feature.StandardScalerModel.html │ ├── module-eclairjs_ml_feature.StringIndexer.html │ ├── module-eclairjs_ml_feature.StringIndexerModel.html │ ├── module-eclairjs_ml_feature.VectorIndexer.html │ ├── module-eclairjs_ml_feature.VectorIndexerModel.html │ ├── module-eclairjs_ml_feature.VectorSlicer.html │ ├── module-eclairjs_ml_feature.Word2Vec.html │ ├── module-eclairjs_ml_feature.Word2VecModel.html │ ├── module-eclairjs_ml_feature.html │ ├── module-eclairjs_ml_linalg.DenseVector.html │ ├── module-eclairjs_ml_linalg.SparseVector.html │ ├── module-eclairjs_ml_linalg.Vector.html │ ├── module-eclairjs_ml_linalg.VectorUDT.html │ ├── module-eclairjs_ml_linalg.Vectors.html │ ├── module-eclairjs_ml_linalg.html │ ├── module-eclairjs_ml_param.BooleanParam.html │ ├── module-eclairjs_ml_param.DoubleParam.html │ ├── module-eclairjs_ml_param.IntArrayParam.html │ ├── module-eclairjs_ml_param.IntParam.html │ ├── module-eclairjs_ml_param.Param.html │ ├── module-eclairjs_ml_param.ParamMap.html │ ├── module-eclairjs_ml_param.ParamPair.html │ ├── module-eclairjs_ml_param.StringArrayParam.html │ ├── module-eclairjs_ml_param.html │ ├── module-eclairjs_ml_recommendation.ALS.html │ ├── module-eclairjs_ml_recommendation.ALSModel.html │ ├── module-eclairjs_ml_recommendation.html │ ├── module-eclairjs_ml_regression.AFTSurvivalRegression.html │ ├── module-eclairjs_ml_regression.AFTSurvivalRegressionModel.html │ ├── module-eclairjs_ml_regression.DecisionTreeRegressionModel.html │ ├── module-eclairjs_ml_regression.DecisionTreeRegressor.html │ ├── module-eclairjs_ml_regression.GBTRegressionModel.html │ ├── module-eclairjs_ml_regression.GBTRegressor.html │ ├── module-eclairjs_ml_regression.GeneralizedLinearRegressionModel.html │ ├── module-eclairjs_ml_regression.GeneralizedLinearRegressionSummary.html │ ├── module-eclairjs_ml_regression.GeneralizedLinearRegressionTrainingSummary.html │ ├── module-eclairjs_ml_regression.LinearRegression.html │ ├── module-eclairjs_ml_regression.LinearRegressionModel.html │ ├── module-eclairjs_ml_regression.LinearRegressionSummary.html │ ├── module-eclairjs_ml_regression.LinearRegressionTrainingSummary.html │ ├── module-eclairjs_ml_regression.RandomForestRegressionModel.html │ ├── module-eclairjs_ml_regression.RandomForestRegressor.html │ ├── module-eclairjs_ml_regression.RegressionModel.html │ ├── module-eclairjs_ml_regression.html │ ├── module-eclairjs_ml_tuning.ParamGridBuilder.html │ ├── module-eclairjs_ml_tuning.TrainValidationSplit.html │ ├── module-eclairjs_ml_tuning.TrainValidationSplitModel.html │ ├── module-eclairjs_ml_tuning.html │ ├── module-eclairjs_ml_util.DefaultParamsWritable.html │ ├── module-eclairjs_ml_util.MLReader.html │ ├── module-eclairjs_ml_util.MLWritable.html │ ├── module-eclairjs_ml_util.MLWriter.html │ ├── module-eclairjs_ml_util.html │ ├── module-eclairjs_mllib.MLUtils.html │ ├── module-eclairjs_mllib.html │ ├── module-eclairjs_mllib_classification.ClassificationModel.html │ ├── module-eclairjs_mllib_classification.LogisticRegressionModel.html │ ├── module-eclairjs_mllib_classification.LogisticRegressionWithLBFGS.html │ ├── module-eclairjs_mllib_classification.LogisticRegressionWithSGD.html │ ├── module-eclairjs_mllib_classification.NaiveBayes.html │ ├── module-eclairjs_mllib_classification.NaiveBayesModel.html │ ├── module-eclairjs_mllib_classification.SVMModel.html │ ├── module-eclairjs_mllib_classification.SVMWithSGD.html │ ├── module-eclairjs_mllib_classification.html │ ├── module-eclairjs_mllib_clustering.BisectingKMeans.html │ ├── module-eclairjs_mllib_clustering.BisectingKMeansModel.html │ ├── module-eclairjs_mllib_clustering.DistributedLDAModel.html │ ├── module-eclairjs_mllib_clustering.KMeans.html │ ├── module-eclairjs_mllib_clustering.KMeansModel.html │ ├── module-eclairjs_mllib_clustering.LDA.html │ ├── module-eclairjs_mllib_clustering.LDAModel.html │ ├── module-eclairjs_mllib_clustering.LocalLDAModel.html │ ├── module-eclairjs_mllib_clustering.PowerIterationClustering.html │ ├── module-eclairjs_mllib_clustering.PowerIterationClusteringAssignment.html │ ├── module-eclairjs_mllib_clustering.PowerIterationClusteringModel.html │ ├── module-eclairjs_mllib_clustering.html │ ├── module-eclairjs_mllib_evaluation.BinaryClassificationMetrics.html │ ├── module-eclairjs_mllib_evaluation.MulticlassMetrics.html │ ├── module-eclairjs_mllib_evaluation.MultilabelMetrics.html │ ├── module-eclairjs_mllib_evaluation.RankingMetrics.html │ ├── module-eclairjs_mllib_evaluation.RegressionMetrics.html │ ├── module-eclairjs_mllib_evaluation.html │ ├── module-eclairjs_mllib_feature.Word2Vec.html │ ├── module-eclairjs_mllib_feature.Word2VecModel.html │ ├── module-eclairjs_mllib_feature.html │ ├── module-eclairjs_mllib_fpm.AssociationRules.html │ ├── module-eclairjs_mllib_fpm.FPGrowth.html │ ├── module-eclairjs_mllib_fpm.FPGrowthModel.html │ ├── module-eclairjs_mllib_fpm.FreqItemset.html │ ├── module-eclairjs_mllib_fpm.PrefixSpan.html │ ├── module-eclairjs_mllib_fpm.PrefixSpanFreqSequence.html │ ├── module-eclairjs_mllib_fpm.PrefixSpanModel.html │ ├── module-eclairjs_mllib_fpm.Rule.html │ ├── module-eclairjs_mllib_fpm.html │ ├── module-eclairjs_mllib_linalg.DenseMatrix.html │ ├── module-eclairjs_mllib_linalg.DenseVector.html │ ├── module-eclairjs_mllib_linalg.Matrices.html │ ├── module-eclairjs_mllib_linalg.Matrix.html │ ├── module-eclairjs_mllib_linalg.QRDecomposition.html │ ├── module-eclairjs_mllib_linalg.SingularValueDecomposition.html │ ├── module-eclairjs_mllib_linalg.SparseMatrix.html │ ├── module-eclairjs_mllib_linalg.SparseVector.html │ ├── module-eclairjs_mllib_linalg.Vector.html │ ├── module-eclairjs_mllib_linalg.VectorUDT.html │ ├── module-eclairjs_mllib_linalg.Vectors.html │ ├── module-eclairjs_mllib_linalg.html │ ├── module-eclairjs_mllib_linalg_distributed.DistributedMatrix.html │ ├── module-eclairjs_mllib_linalg_distributed.RowMatrix.html │ ├── module-eclairjs_mllib_linalg_distributed.html │ ├── module-eclairjs_mllib_optimization.Gradient.html │ ├── module-eclairjs_mllib_optimization.LBFGS.html │ ├── module-eclairjs_mllib_optimization.LogisticGradient.html │ ├── module-eclairjs_mllib_optimization.SquaredL2Updater.html │ ├── module-eclairjs_mllib_optimization.Updater.html │ ├── module-eclairjs_mllib_optimization.html │ ├── module-eclairjs_mllib_random.RandomRDDs.html │ ├── module-eclairjs_mllib_random.html │ ├── module-eclairjs_mllib_recommendation.ALS.html │ ├── module-eclairjs_mllib_recommendation.MatrixFactorizationModel.html │ ├── module-eclairjs_mllib_recommendation.Rating.html │ ├── module-eclairjs_mllib_recommendation.html │ ├── module-eclairjs_mllib_regression.GeneralizedLinearModel.html │ ├── module-eclairjs_mllib_regression.LabeledPoint.html │ ├── module-eclairjs_mllib_regression.LinearRegressionModel.html │ ├── module-eclairjs_mllib_regression.LinearRegressionWithSGD.html │ ├── module-eclairjs_mllib_regression.html │ ├── module-eclairjs_mllib_tree.DecisionTree.html │ ├── module-eclairjs_mllib_tree.GradientBoostedTrees.html │ ├── module-eclairjs_mllib_tree.RandomForest.html │ ├── module-eclairjs_mllib_tree.html │ ├── module-eclairjs_mllib_tree_configuration.BoostingStrategy.html │ ├── module-eclairjs_mllib_tree_configuration.Strategy.html │ ├── module-eclairjs_mllib_tree_configuration.html │ ├── module-eclairjs_mllib_tree_loss.Loss.html │ ├── module-eclairjs_mllib_tree_loss.html │ ├── module-eclairjs_mllib_tree_model.DecisionTreeModel.html │ ├── module-eclairjs_mllib_tree_model.GradientBoostedTreesModel.html │ ├── module-eclairjs_mllib_tree_model.RandomForestModel.html │ ├── module-eclairjs_mllib_tree_model.html │ ├── module-eclairjs_partial.PartialResult.html │ ├── module-eclairjs_partial.html │ ├── module-eclairjs_sql.Column.html │ ├── module-eclairjs_sql.DataFrame.html │ ├── module-eclairjs_sql.DataFrameHolder.html │ ├── module-eclairjs_sql.DataFrameNaFunctions.html │ ├── module-eclairjs_sql.DataFrameReader.html │ ├── module-eclairjs_sql.DataFrameStatFunctions.html │ ├── module-eclairjs_sql.DataFrameWriter.html │ ├── module-eclairjs_sql.Dataset.html │ ├── module-eclairjs_sql.Encoder.html │ ├── module-eclairjs_sql.GroupedData.html │ ├── module-eclairjs_sql.RelationalGroupedDataset.html │ ├── module-eclairjs_sql.Row.html │ ├── module-eclairjs_sql.RowFactory.html │ ├── module-eclairjs_sql.SQLContext.QueryExecution.html │ ├── module-eclairjs_sql.SQLContext.SQLSession.html │ ├── module-eclairjs_sql.SQLContext.SparkPlanner.html │ ├── module-eclairjs_sql.SQLContext.html │ ├── module-eclairjs_sql.SparkSession.html │ ├── module-eclairjs_sql.SparkSessionBuilder.html │ ├── module-eclairjs_sql.SqlDate.html │ ├── module-eclairjs_sql.SqlTimestamp.html │ ├── module-eclairjs_sql.UDFRegistration.html │ ├── module-eclairjs_sql.UserDefinedFunction.html │ ├── module-eclairjs_sql.functions.html │ ├── module-eclairjs_sql.html │ ├── module-eclairjs_sql_execution.QueryExecution.html │ ├── module-eclairjs_sql_execution.html │ ├── module-eclairjs_sql_streaming.DataStreamReader.html │ ├── module-eclairjs_sql_streaming.DataStreamWriter.html │ ├── module-eclairjs_sql_streaming.ProcessingTime.html │ ├── module-eclairjs_sql_streaming.SinkStatus.html │ ├── module-eclairjs_sql_streaming.SourceStatus.html │ ├── module-eclairjs_sql_streaming.StreamingQuery.html │ ├── module-eclairjs_sql_streaming.StreamingQueryInfo.html │ ├── module-eclairjs_sql_streaming.StreamingQueryListener.html │ ├── module-eclairjs_sql_streaming.StreamingQueryManager.html │ ├── module-eclairjs_sql_streaming.html │ ├── module-eclairjs_sql_types.ArrayType.html │ ├── module-eclairjs_sql_types.BinaryType.html │ ├── module-eclairjs_sql_types.BooleanType.html │ ├── module-eclairjs_sql_types.CalendarIntervalType.html │ ├── module-eclairjs_sql_types.DataType.html │ ├── module-eclairjs_sql_types.DataTypes.html │ ├── module-eclairjs_sql_types.DateType.html │ ├── module-eclairjs_sql_types.DoubleType.html │ ├── module-eclairjs_sql_types.FloatType.html │ ├── module-eclairjs_sql_types.IntegerType.html │ ├── module-eclairjs_sql_types.MapType.html │ ├── module-eclairjs_sql_types.Metadata.html │ ├── module-eclairjs_sql_types.NullType.html │ ├── module-eclairjs_sql_types.NumericType.html │ ├── module-eclairjs_sql_types.StringType.html │ ├── module-eclairjs_sql_types.StructField.html │ ├── module-eclairjs_sql_types.StructType.html │ ├── module-eclairjs_sql_types.TimestampType.html │ ├── module-eclairjs_sql_types.html │ ├── module-eclairjs_storage.StorageLevel.html │ ├── module-eclairjs_storage.html │ ├── module-eclairjs_streaming.Duration.html │ ├── module-eclairjs_streaming.StreamingContext.html │ ├── module-eclairjs_streaming.Time.html │ ├── module-eclairjs_streaming.html │ ├── module-eclairjs_streaming_dstream.DStream.html │ ├── module-eclairjs_streaming_dstream.PairDStream.html │ ├── module-eclairjs_streaming_dstream.html │ ├── module-eclairjs_streaming_kafka.KafkaUtils.html │ ├── module-eclairjs_streaming_kafka.html │ ├── module-eclairjs_streaming_twitter.TwitterAuthorization.html │ ├── module-eclairjs_streaming_twitter.TwitterUtils.html │ ├── module-eclairjs_streaming_twitter.html │ ├── module-eclairjs_util.StatCounter.html │ ├── module-eclairjs_util.html │ ├── partial_PartialResult.js.html │ ├── scripts │ ├── linenumber.js │ └── prettify │ │ ├── Apache-License-2.0.txt │ │ ├── lang-css.js │ │ └── prettify.js │ ├── sql.js.html │ ├── sql_DataFrameHolder.js.html │ ├── sql_DataFrameNaFunctions.js.html │ ├── sql_DataFrameReader.js.html │ ├── sql_DataFrameStatFunctions.js.html │ ├── sql_DataFrameWriter.js.html │ ├── sql_GroupedData.js.html │ ├── sql_RowFactory.js.html │ ├── sql_SqlDate.js.html │ ├── sql_SqlTimestamp.js.html │ ├── sql_types.js.html │ ├── sql_types_ArrayType.js.html │ ├── sql_types_BinaryType.js.html │ ├── sql_types_BooleanType.js.html │ ├── sql_types_CalendarIntervalType.js.html │ ├── sql_types_DataType.js.html │ ├── sql_types_DataTypes.js.html │ ├── sql_types_DateType.js.html │ ├── sql_types_DoubleType.js.html │ ├── sql_types_FloatType.js.html │ ├── sql_types_IntegerType.js.html │ ├── sql_types_MapType.js.html │ ├── sql_types_Metadata.js.html │ ├── sql_types_NullType.js.html │ ├── sql_types_NumericType.js.html │ ├── sql_types_StringType.js.html │ ├── sql_types_StructField.js.html │ ├── sql_types_StructType.js.html │ ├── sql_types_TimestampType.js.html │ ├── storage.js.html │ ├── storage_StorageLevel.js.html │ ├── streaming_Duration.js.html │ ├── streaming_KafkaUtils.js.html │ ├── streaming_StreamingContext.js.html │ ├── streaming_Time.js.html │ ├── streaming_TwitterUtils.js.html │ ├── streaming_dstream_PairDStream.js.html │ ├── styles │ ├── jsdoc-default.css │ ├── prettify-jsdoc.css │ └── prettify-tomorrow.css │ ├── utils_List.js.html │ └── utils_Tuple.js.html ├── eclairjs ├── __init__.py └── jars │ └── __init__.py ├── examples ├── accumulator.js ├── data │ ├── dream.txt │ ├── lpsa.data │ ├── lr_data.txt │ ├── mllib │ │ ├── als │ │ │ ├── sample_movielens_ratings.txt │ │ │ └── test.data │ │ ├── kmeans_data.txt │ │ ├── lr-data │ │ │ └── random.data │ │ ├── ml-latest-small │ │ │ ├── README.txt │ │ │ ├── links.csv │ │ │ ├── movies.csv │ │ │ ├── ratings.csv │ │ │ └── tags.csv │ │ ├── sample_binary_classification_data.txt │ │ ├── sample_fpgrowth.txt │ │ ├── sample_isotonic_regression_data.txt │ │ ├── sample_kmeans_data.txt │ │ ├── sample_lda_data.txt │ │ ├── sample_lda_libsvm_data.txt │ │ ├── sample_libsvm_data.txt │ │ ├── sample_linear_regression_data.txt │ │ ├── sample_movielens_data.txt │ │ └── sample_multiclass_classification_data.txt │ ├── pagerank_data.txt │ ├── people.json │ ├── people.txt │ ├── states.csv │ └── test.json ├── docker-compose.yml ├── hello.js ├── logQuery.js ├── ml │ ├── aft_survival_regression_example.js │ ├── als_example.js │ ├── binarizer_example.js │ ├── bisecting_kmeans_example.js │ ├── bucketizer_example.js │ ├── chi_sq_selector_example.js │ ├── count_vectorizer_example.js │ ├── dct_example.js │ ├── decision_tree_classification_example.js │ ├── decision_tree_regression_example.js │ ├── elementwise_product_example.js │ ├── estimator_transformer_param_example.js │ ├── gaussian_mixture_example.js │ ├── generalized_linear_regression_example.js │ ├── gradient_boosted_tree_classifier_example.js │ ├── gradient_boosted_tree_regressor_example.js │ ├── index_to_string_example.js │ ├── kmeans_example.js │ ├── lda_example.js │ ├── linear_regression_with_elastic_net_example.js │ ├── logistic_regression_summary_example.js │ ├── logistic_regression_with_elastic_net_example.js │ ├── max_abs_scaler_example.js │ ├── min_max_scaler_example.js │ ├── model_selection_via_cross_validation_example.js │ ├── model_selection_via_train_validation_split_example.js │ ├── movie_recommender.js │ ├── multilayer_perceptron_classifier_example.js │ ├── naive_bayes_example.js │ ├── ngram_example.js │ ├── normalizer_example.js │ ├── one_hot_encoder_example.js │ ├── one_vs_rest_example.js │ ├── pca_example.js │ ├── pipeline_example.js │ ├── polynomial_expansion_example.js │ ├── quantile_discretizer_example.js │ ├── random_forest_classifier_example.js │ ├── random_forest_regressor_example.js │ ├── rformula_example.js │ ├── simple_text_classification_pipeline.js │ ├── sql_transformer_example.js │ ├── standard_scaler_example.js │ ├── stop_words_remover_example.js │ ├── string_indexer_example.js │ ├── tfld_example.js │ ├── tokenizer_example.js │ ├── vector_assembler_example.js │ ├── vector_indexer_example.js │ ├── vector_slicer_example.js │ └── word2vec_example.js ├── mllib │ ├── als.js │ ├── association_rules_example.js │ ├── binary_classification_metrics_example.js │ ├── bisecting_k_means_example.js │ ├── decision_tree_classification_example.js │ ├── decision_tree_regression_example.js │ ├── fp_growth_example.js │ ├── gradient_boosting_classification_example.js │ ├── gradient_boosting_regression_example.js │ ├── isotonic_regression_example.js │ ├── kmeans_example.js │ ├── largeDataset.js │ ├── lbfgs_example.js │ ├── lda_example.js │ ├── linear_regression_example.js │ ├── lr_example.js │ ├── movie_recommender.js │ ├── multiclass_classification_metrics_example.js │ ├── multilabel_classification_metrics_example.js │ ├── naive_bayes_example.js │ ├── pca_example.js │ ├── power_iteration_clustering_example.js │ ├── prefix_span_example.js │ ├── random_forest_classification_example.js │ ├── random_forest_regression_example.js │ ├── random_rdd_generation_example.js │ ├── ranking_metrics_example.js │ ├── recommendation_example.js │ ├── regression_metrics_example.js │ ├── sampled_rdds.js │ ├── svd_example.js │ └── svm_with_sgd_example.js ├── notebooks │ ├── movie_recomennder.ipynb │ ├── sparksql.ipynb │ └── word_count.ipynb ├── page_rank.js ├── pump.sh ├── run.sh ├── simple-lambda-require.js ├── simple │ ├── addOne.js │ └── goodbye.js ├── spark_lr.js ├── spark_pi.js ├── spark_status_tracker.js ├── spark_tc.js ├── sql │ ├── sparkjdbc.js │ ├── sparksql.js │ └── streaming │ │ ├── structuredNetworkWordCount.js │ │ └── structuredNetworkWordCountWindowed.js ├── streaming │ ├── direct_kafka_word_count.js │ ├── kafka_word_count.js │ ├── mhub_word_count.js │ ├── network_word_count.js │ ├── queue_count.js │ ├── recoverable_network_word_count.js │ └── twitter_popular_tags.js └── word_count.js ├── icla.txt ├── jsdoc_conf.json ├── kernel.json ├── pom.xml ├── setup.py ├── src ├── main │ ├── java │ │ ├── examples │ │ │ ├── LargeDataset.java │ │ │ └── MovieRecommender.java │ │ └── org │ │ │ └── eclairjs │ │ │ └── nashorn │ │ │ ├── Bootstrap.java │ │ │ ├── EclairJSGatewayServer.java │ │ │ ├── JSBaseFunction.java │ │ │ ├── JSComparator.java │ │ │ ├── JSDoubleFunction.java │ │ │ ├── JSFilterFunction.java │ │ │ ├── JSFlatMapFunction.java │ │ │ ├── JSFlatMapFunction2.java │ │ │ ├── JSForeachFunction.java │ │ │ ├── JSForeachPartitionFunction.java │ │ │ ├── JSFunction.java │ │ │ ├── JSFunction0.java │ │ │ ├── JSFunction2.java │ │ │ ├── JSMapFunction.java │ │ │ ├── JSMapPartitionsFunction.java │ │ │ ├── JSONSerializer.java │ │ │ ├── JSPairFlatMapFunction.java │ │ │ ├── JSPairFunction.java │ │ │ ├── JSReduceFunction.java │ │ │ ├── JSVoidFunction.java │ │ │ ├── ModuleUtils.java │ │ │ ├── NashornEngineSingleton.java │ │ │ ├── SparkBootstrap.java │ │ │ ├── SparkJS.java │ │ │ ├── Utils.java │ │ │ ├── mllib │ │ │ └── clustering │ │ │ │ └── PowerIterationClusteringRunFunction.java │ │ │ ├── sql │ │ │ ├── JSForeachWriter.java │ │ │ ├── JSStreamingQueryListener.java │ │ │ ├── JSUDF.java │ │ │ ├── JSUDF1.java │ │ │ ├── JSUDF10.java │ │ │ ├── JSUDF11.java │ │ │ ├── JSUDF12.java │ │ │ ├── JSUDF13.java │ │ │ ├── JSUDF14.java │ │ │ ├── JSUDF15.java │ │ │ ├── JSUDF16.java │ │ │ ├── JSUDF17.java │ │ │ ├── JSUDF18.java │ │ │ ├── JSUDF19.java │ │ │ ├── JSUDF2.java │ │ │ ├── JSUDF20.java │ │ │ ├── JSUDF21.java │ │ │ ├── JSUDF22.java │ │ │ ├── JSUDF3.java │ │ │ ├── JSUDF4.java │ │ │ ├── JSUDF5.java │ │ │ ├── JSUDF6.java │ │ │ ├── JSUDF7.java │ │ │ ├── JSUDF8.java │ │ │ ├── JSUDF9.java │ │ │ └── SqlContextCreateDataFrameFunction.java │ │ │ └── wrap │ │ │ ├── FloatRDD.java │ │ │ ├── List.java │ │ │ ├── PairRDD.java │ │ │ ├── RDD.java │ │ │ ├── Tuple2.java │ │ │ ├── Tuple3.java │ │ │ ├── Tuple4.java │ │ │ ├── Tuple5.java │ │ │ ├── WrappedClass.java │ │ │ ├── WrappedFunction.java │ │ │ ├── ml │ │ │ └── linalg │ │ │ │ ├── DenseVector.java │ │ │ │ ├── SparseVector.java │ │ │ │ ├── Vector.java │ │ │ │ └── Vectors.java │ │ │ ├── mllib │ │ │ ├── linalg │ │ │ │ ├── DenseVector.java │ │ │ │ ├── SparseVector.java │ │ │ │ ├── Vector.java │ │ │ │ └── Vectors.java │ │ │ ├── recommendation │ │ │ │ └── Rating.java │ │ │ └── regression │ │ │ │ └── LabeledPoint.java │ │ │ └── sql │ │ │ ├── Builder.java │ │ │ ├── Dataset.java │ │ │ ├── Encoder.java │ │ │ ├── Encoders.java │ │ │ ├── Row.java │ │ │ ├── RowFactory.java │ │ │ ├── SparkSession.java │ │ │ ├── SqlDate.java │ │ │ ├── SqlTimestamp.java │ │ │ └── streaming │ │ │ ├── DataStreamReader.java │ │ │ ├── DataStreamWriter.java │ │ │ ├── ProcessingTime.java │ │ │ ├── SinkStatus.java │ │ │ ├── SourceStatus.java │ │ │ ├── StreamingQuery.java │ │ │ ├── StreamingQueryInfo.java │ │ │ └── StreamingQueryManager.java │ ├── resources │ │ ├── conf │ │ │ └── log4j.prop │ │ ├── eclair.js │ │ ├── eclairjs │ │ │ ├── Accumulable.js │ │ │ ├── AccumulableParam.js │ │ │ ├── Accumulator.js │ │ │ ├── AccumulatorParam.js │ │ │ ├── DebugUtils.js │ │ │ ├── EclairJS_Globals.js │ │ │ ├── FloatAccumulatorParam.js │ │ │ ├── FloatRDD.js │ │ │ ├── FutureAction.js │ │ │ ├── HashPartitioner.js │ │ │ ├── IntAccumulatorParam.js │ │ │ ├── JavaWrapper.js │ │ │ ├── List.js │ │ │ ├── Logger.js │ │ │ ├── ModuleUtils.js │ │ │ ├── PairRDD.js │ │ │ ├── Partitioner.js │ │ │ ├── RDD.js │ │ │ ├── RangePartitioner.js │ │ │ ├── Serializable.js │ │ │ ├── Serialize.js │ │ │ ├── SparkConf.js │ │ │ ├── SparkContext.js │ │ │ ├── SparkFiles.js │ │ │ ├── SparkJobInfo.js │ │ │ ├── SparkStageInfo.js │ │ │ ├── SparkStatusTracker.js │ │ │ ├── Tuple2.js │ │ │ ├── Tuple3.js │ │ │ ├── Tuple4.js │ │ │ ├── Tuple5.js │ │ │ ├── Utils.js │ │ │ ├── broadcast.js │ │ │ ├── broadcast │ │ │ │ ├── Broadcast.js │ │ │ │ └── TorrentBroadcast.js │ │ │ ├── jvm-npm │ │ │ │ └── jvm-npm.js │ │ │ ├── ml.js │ │ │ ├── ml │ │ │ │ ├── Estimator.js │ │ │ │ ├── Model.js │ │ │ │ ├── Pipeline.js │ │ │ │ ├── PipelineModel.js │ │ │ │ ├── PipelineStage.js │ │ │ │ ├── PredictionModel.js │ │ │ │ ├── Predictor.js │ │ │ │ ├── Transformer.js │ │ │ │ ├── UnaryTransformer.js │ │ │ │ ├── attribute.js │ │ │ │ ├── attribute │ │ │ │ │ ├── Attribute.js │ │ │ │ │ ├── AttributeGroup.js │ │ │ │ │ └── NumericAttribute.js │ │ │ │ ├── classification.js │ │ │ │ ├── classification │ │ │ │ │ ├── BinaryLogisticRegressionSummary.js │ │ │ │ │ ├── BinaryLogisticRegressionTrainingSummary.js │ │ │ │ │ ├── ClassificationModel.js │ │ │ │ │ ├── Classifier.js │ │ │ │ │ ├── DecisionTreeClassificationModel.js │ │ │ │ │ ├── DecisionTreeClassifier.js │ │ │ │ │ ├── GBTClassificationModel.js │ │ │ │ │ ├── GBTClassifier.js │ │ │ │ │ ├── LogisticRegression.js │ │ │ │ │ ├── LogisticRegressionModel.js │ │ │ │ │ ├── LogisticRegressionSummary.js │ │ │ │ │ ├── LogisticRegressionTrainingSummary.js │ │ │ │ │ ├── MultilayerPerceptronClassificationModel.js │ │ │ │ │ ├── MultilayerPerceptronClassifier.js │ │ │ │ │ ├── NaiveBayes.js │ │ │ │ │ ├── NaiveBayesModel.js │ │ │ │ │ ├── OneVsRest.js │ │ │ │ │ ├── OneVsRestModel.js │ │ │ │ │ ├── ProbabilisticClassificationModel.js │ │ │ │ │ ├── ProbabilisticClassifier.js │ │ │ │ │ ├── RandomForestClassificationModel.js │ │ │ │ │ └── RandomForestClassifier.js │ │ │ │ ├── clustering.js │ │ │ │ ├── clustering │ │ │ │ │ ├── BisectingKMeans.js │ │ │ │ │ ├── BisectingKMeansModel.js │ │ │ │ │ ├── DistributedLDAModel.js │ │ │ │ │ ├── GaussianMixture.js │ │ │ │ │ ├── GaussianMixtureModel.js │ │ │ │ │ ├── GaussianMixtureSummary.js │ │ │ │ │ ├── KMeans.js │ │ │ │ │ ├── KMeansModel.js │ │ │ │ │ ├── LDA.js │ │ │ │ │ ├── LDAModel.js │ │ │ │ │ └── LocalLDAModel.js │ │ │ │ ├── evaluation.js │ │ │ │ ├── evaluation │ │ │ │ │ ├── BinaryClassificationEvaluator.js │ │ │ │ │ ├── MulticlassClassificationEvaluator.js │ │ │ │ │ └── RegressionEvaluator.js │ │ │ │ ├── feature.js │ │ │ │ ├── feature │ │ │ │ │ ├── Binarizer.js │ │ │ │ │ ├── Bucketizer.js │ │ │ │ │ ├── ChiSqSelector.js │ │ │ │ │ ├── ChiSqSelectorModel.js │ │ │ │ │ ├── CountVectorizer.js │ │ │ │ │ ├── CountVectorizerModel.js │ │ │ │ │ ├── DCT.js │ │ │ │ │ ├── ElementwiseProduct.js │ │ │ │ │ ├── HashingTF.js │ │ │ │ │ ├── IDF.js │ │ │ │ │ ├── IDFModel.js │ │ │ │ │ ├── IndexToString.js │ │ │ │ │ ├── MaxAbsScaler.js │ │ │ │ │ ├── MaxAbsScalerModel.js │ │ │ │ │ ├── MinMaxScaler.js │ │ │ │ │ ├── MinMaxScalerModel.js │ │ │ │ │ ├── NGram.js │ │ │ │ │ ├── Normalizer.js │ │ │ │ │ ├── OneHotEncoder.js │ │ │ │ │ ├── PCA.js │ │ │ │ │ ├── PCAModel.js │ │ │ │ │ ├── PolynomialExpansion.js │ │ │ │ │ ├── QuantileDiscretizer.js │ │ │ │ │ ├── RFormula.js │ │ │ │ │ ├── RFormulaModel.js │ │ │ │ │ ├── RegexTokenizer.js │ │ │ │ │ ├── SQLTransformer.js │ │ │ │ │ ├── StandardScaler.js │ │ │ │ │ ├── StandardScalerModel.js │ │ │ │ │ ├── StopWordsRemover.js │ │ │ │ │ ├── StringIndexer.js │ │ │ │ │ ├── StringIndexerModel.js │ │ │ │ │ ├── Tokenizer.js │ │ │ │ │ ├── VectorAssembler.js │ │ │ │ │ ├── VectorIndexer.js │ │ │ │ │ ├── VectorIndexerModel.js │ │ │ │ │ ├── VectorSlicer.js │ │ │ │ │ ├── Word2Vec.js │ │ │ │ │ └── Word2VecModel.js │ │ │ │ ├── linalg.js │ │ │ │ ├── linalg │ │ │ │ │ ├── DenseVector.js │ │ │ │ │ ├── SparseVector.js │ │ │ │ │ ├── Vector.js │ │ │ │ │ ├── VectorUDT.js │ │ │ │ │ └── Vectors.js │ │ │ │ ├── param.js │ │ │ │ ├── param │ │ │ │ │ ├── BooleanParam.js │ │ │ │ │ ├── DoubleParam.js │ │ │ │ │ ├── IntArrayParam.js │ │ │ │ │ ├── IntParam.js │ │ │ │ │ ├── Param.js │ │ │ │ │ ├── ParamMap.js │ │ │ │ │ ├── ParamPair.js │ │ │ │ │ └── StringArrayParam.js │ │ │ │ ├── recommendation.js │ │ │ │ ├── recommendation │ │ │ │ │ ├── ALS.js │ │ │ │ │ └── ALSModel.js │ │ │ │ ├── regression.js │ │ │ │ ├── regression │ │ │ │ │ ├── AFTSurvivalRegression.js │ │ │ │ │ ├── AFTSurvivalRegressionModel.js │ │ │ │ │ ├── DecisionTreeRegressionModel.js │ │ │ │ │ ├── DecisionTreeRegressor.js │ │ │ │ │ ├── GBTRegressionModel.js │ │ │ │ │ ├── GBTRegressor.js │ │ │ │ │ ├── GeneralizedLinearRegression.js │ │ │ │ │ ├── GeneralizedLinearRegressionModel.js │ │ │ │ │ ├── GeneralizedLinearRegressionSummary.js │ │ │ │ │ ├── GeneralizedLinearRegressionTrainingSummary.js │ │ │ │ │ ├── LinearRegression.js │ │ │ │ │ ├── LinearRegressionModel.js │ │ │ │ │ ├── LinearRegressionSummary.js │ │ │ │ │ ├── LinearRegressionTrainingSummary.js │ │ │ │ │ ├── RandomForestRegressionModel.js │ │ │ │ │ ├── RandomForestRegressor.js │ │ │ │ │ └── RegressionModel.js │ │ │ │ ├── tuning.js │ │ │ │ ├── tuning │ │ │ │ │ ├── CrossValidator.js │ │ │ │ │ ├── CrossValidatorModel.js │ │ │ │ │ ├── ParamGridBuilder.js │ │ │ │ │ ├── TrainValidationSplit.js │ │ │ │ │ └── TrainValidationSplitModel.js │ │ │ │ ├── util.js │ │ │ │ └── util │ │ │ │ │ ├── DefaultParamsWritable.js │ │ │ │ │ ├── MLReader.js │ │ │ │ │ ├── MLWritable.js │ │ │ │ │ └── MLWriter.js │ │ │ ├── mllib.js │ │ │ ├── mllib │ │ │ │ ├── MLUtils.js │ │ │ │ ├── classification.js │ │ │ │ ├── classification │ │ │ │ │ ├── ClassificationModel.js │ │ │ │ │ ├── LogisticRegressionModel.js │ │ │ │ │ ├── LogisticRegressionWithLBFGS.js │ │ │ │ │ ├── LogisticRegressionWithSGD.js │ │ │ │ │ ├── NaiveBayes.js │ │ │ │ │ ├── NaiveBayesModel.js │ │ │ │ │ ├── SVMModel.js │ │ │ │ │ └── SVMWithSGD.js │ │ │ │ ├── clustering.js │ │ │ │ ├── clustering │ │ │ │ │ ├── BisectingKMeans.js │ │ │ │ │ ├── BisectingKMeansModel.js │ │ │ │ │ ├── DistributedLDAModel.js │ │ │ │ │ ├── KMeans.js │ │ │ │ │ ├── KMeansModel.js │ │ │ │ │ ├── LDA.js │ │ │ │ │ ├── LDAModel.js │ │ │ │ │ ├── LocalLDAModel.js │ │ │ │ │ ├── PowerIterationClustering.js │ │ │ │ │ ├── PowerIterationClusteringAssignment.js │ │ │ │ │ └── PowerIterationClusteringModel.js │ │ │ │ ├── evaluation.js │ │ │ │ ├── evaluation │ │ │ │ │ ├── BinaryClassificationMetrics.js │ │ │ │ │ ├── MulticlassMetrics.js │ │ │ │ │ ├── MultilabelMetrics.js │ │ │ │ │ ├── RankingMetrics.js │ │ │ │ │ └── RegressionMetrics.js │ │ │ │ ├── feature.js │ │ │ │ ├── feature │ │ │ │ │ ├── Word2Vec.js │ │ │ │ │ └── Word2VecModel.js │ │ │ │ ├── fpm.js │ │ │ │ ├── fpm │ │ │ │ │ ├── AssociationRules.js │ │ │ │ │ ├── FPGrowth.js │ │ │ │ │ ├── FPGrowthModel.js │ │ │ │ │ ├── FreqItemset.js │ │ │ │ │ ├── PrefixSpan.js │ │ │ │ │ ├── PrefixSpanFreqSequence.js │ │ │ │ │ ├── PrefixSpanModel.js │ │ │ │ │ └── Rule.js │ │ │ │ ├── linalg.js │ │ │ │ ├── linalg │ │ │ │ │ ├── DenseMatrix.js │ │ │ │ │ ├── DenseVector.js │ │ │ │ │ ├── Matrices.js │ │ │ │ │ ├── Matrix.js │ │ │ │ │ ├── QRDecomposition.js │ │ │ │ │ ├── SingularValueDecomposition.js │ │ │ │ │ ├── SparseMatrix.js │ │ │ │ │ ├── SparseVector.js │ │ │ │ │ ├── Vector.js │ │ │ │ │ ├── VectorUDT.js │ │ │ │ │ ├── Vectors.js │ │ │ │ │ ├── distributed.js │ │ │ │ │ └── distributed │ │ │ │ │ │ ├── DistributedMatrix.js │ │ │ │ │ │ └── RowMatrix.js │ │ │ │ ├── optimization.js │ │ │ │ ├── optimization │ │ │ │ │ ├── Gradient.js │ │ │ │ │ ├── LBFGS.js │ │ │ │ │ ├── LogisticGradient.js │ │ │ │ │ ├── SquaredL2Updater.js │ │ │ │ │ └── Updater.js │ │ │ │ ├── random.js │ │ │ │ ├── random │ │ │ │ │ └── RandomRDDs.js │ │ │ │ ├── recommendation.js │ │ │ │ ├── recommendation │ │ │ │ │ ├── ALS.js │ │ │ │ │ ├── MatrixFactorizationModel.js │ │ │ │ │ └── Rating.js │ │ │ │ ├── regression.js │ │ │ │ ├── regression │ │ │ │ │ ├── GeneralizedLinearModel.js │ │ │ │ │ ├── IsotonicRegression.js │ │ │ │ │ ├── IsotonicRegressionModel.js │ │ │ │ │ ├── LabeledPoint.js │ │ │ │ │ ├── LinearRegressionModel.js │ │ │ │ │ └── LinearRegressionWithSGD.js │ │ │ │ ├── tree.js │ │ │ │ └── tree │ │ │ │ │ ├── DecisionTree.js │ │ │ │ │ ├── GradientBoostedTrees.js │ │ │ │ │ ├── RandomForest.js │ │ │ │ │ ├── configuration.js │ │ │ │ │ ├── configuration │ │ │ │ │ ├── BoostingStrategy.js │ │ │ │ │ └── Strategy.js │ │ │ │ │ ├── loss.js │ │ │ │ │ ├── loss │ │ │ │ │ └── Loss.js │ │ │ │ │ ├── model.js │ │ │ │ │ └── model │ │ │ │ │ ├── DecisionTreeModel.js │ │ │ │ │ ├── GradientBoostedTreesModel.js │ │ │ │ │ └── RandomForestModel.js │ │ │ ├── partial.js │ │ │ ├── partial │ │ │ │ └── PartialResult.js │ │ │ ├── sql.js │ │ │ ├── sql │ │ │ │ ├── Column.js │ │ │ │ ├── DataFrameHolder.js │ │ │ │ ├── DataFrameNaFunctions.js │ │ │ │ ├── DataFrameReader.js │ │ │ │ ├── DataFrameStatFunctions.js │ │ │ │ ├── DataFrameWriter.js │ │ │ │ ├── Dataset.js │ │ │ │ ├── Encoder.js │ │ │ │ ├── Encoders.js │ │ │ │ ├── RelationalGroupedDataset.js │ │ │ │ ├── Row.js │ │ │ │ ├── RowFactory.js │ │ │ │ ├── SQLContext.js │ │ │ │ ├── SparkSession.js │ │ │ │ ├── SparkSessionBuilder.js │ │ │ │ ├── SqlDate.js │ │ │ │ ├── SqlTimestamp.js │ │ │ │ ├── UDFRegistration.js │ │ │ │ ├── UserDefinedFunction.js │ │ │ │ ├── execution.js │ │ │ │ ├── execution │ │ │ │ │ └── QueryExecution.js │ │ │ │ ├── functions.js │ │ │ │ ├── streaming.js │ │ │ │ ├── streaming │ │ │ │ │ ├── DataStreamReader.js │ │ │ │ │ ├── DataStreamWriter.js │ │ │ │ │ ├── ProcessingTime.js │ │ │ │ │ ├── SinkStatus.js │ │ │ │ │ ├── SourceStatus.js │ │ │ │ │ ├── StreamingQuery.js │ │ │ │ │ ├── StreamingQueryInfo.js │ │ │ │ │ ├── StreamingQueryListener.js │ │ │ │ │ └── StreamingQueryManager.js │ │ │ │ ├── types.js │ │ │ │ └── types │ │ │ │ │ ├── ArrayType.js │ │ │ │ │ ├── BinaryType.js │ │ │ │ │ ├── BooleanType.js │ │ │ │ │ ├── ByteType.js │ │ │ │ │ ├── CalendarIntervalType.js │ │ │ │ │ ├── DataType.js │ │ │ │ │ ├── DataTypes.js │ │ │ │ │ ├── DateType.js │ │ │ │ │ ├── DecimalType.js │ │ │ │ │ ├── DoubleType.js │ │ │ │ │ ├── FloatType.js │ │ │ │ │ ├── IntegerType.js │ │ │ │ │ ├── LongType.js │ │ │ │ │ ├── MapType.js │ │ │ │ │ ├── Metadata.js │ │ │ │ │ ├── NullType.js │ │ │ │ │ ├── NumericType.js │ │ │ │ │ ├── ShortType.js │ │ │ │ │ ├── StringType.js │ │ │ │ │ ├── StructField.js │ │ │ │ │ ├── StructType.js │ │ │ │ │ └── TimestampType.js │ │ │ ├── storage.js │ │ │ ├── storage │ │ │ │ └── StorageLevel.js │ │ │ ├── streaming.js │ │ │ ├── streaming │ │ │ │ ├── Duration.js │ │ │ │ ├── StreamingContext.js │ │ │ │ ├── Time.js │ │ │ │ ├── dstream.js │ │ │ │ ├── dstream │ │ │ │ │ ├── DStream.js │ │ │ │ │ └── PairDStream.js │ │ │ │ ├── kafka.js │ │ │ │ ├── kafka │ │ │ │ │ └── KafkaUtils.js │ │ │ │ ├── twitter.js │ │ │ │ └── twitter │ │ │ │ │ ├── TwitterAuthorization.js │ │ │ │ │ └── TwitterUtils.js │ │ │ ├── util.js │ │ │ └── util │ │ │ │ └── StatCounter.js │ │ └── jaas.conf │ └── scala │ │ └── org │ │ └── eclairjs │ │ └── nashorn │ │ ├── EclairjsLoggerAppender.scala │ │ ├── JavascriptInterpreter.scala │ │ └── KafkaInputDStream.scala └── test │ ├── java │ └── org │ │ └── eclairjs │ │ └── nashorn │ │ ├── CoreExamplesTest.java │ │ ├── CoreTest.java │ │ ├── DStreamTest.java │ │ ├── JSRunner.java │ │ ├── MlLibTest.java │ │ ├── MlTest.java │ │ ├── PairRDDTest.java │ │ ├── SparkContextTest.java │ │ ├── SqlDataset.java │ │ ├── SqlStreamingTest.java │ │ ├── SqlTest.java │ │ ├── SqlUDFTest.java │ │ ├── TestCase.java │ │ ├── TestClass.java │ │ ├── TestKernel.java │ │ ├── TestUtils.java │ │ ├── Tests.java │ │ ├── WrappedObjectTest.java │ │ └── ZClusterTest.java │ └── resources │ ├── TestUtils.js │ ├── clusterTest.js │ ├── conf │ └── log4j.prop │ ├── core_examples_test.js │ ├── data │ └── sql │ │ ├── people.txt │ │ ├── peopleDuplicates.txt │ │ ├── peopleNullValues.txt │ │ ├── peopleNullValues2.txt │ │ ├── streaming │ │ └── people.csv │ │ └── timestamp.json │ ├── dream.txt │ ├── dstreamtest.js │ ├── ml │ └── mltest.js │ ├── mllib │ └── mllibtest.js │ ├── nashorntest.js │ ├── pair_rdd_test.js │ ├── rddtest.js │ ├── sparkcontexttests.js │ ├── sql │ ├── dataframetest.js │ ├── dataset.js │ ├── streaming │ │ └── streaming.js │ ├── timestamp.js │ └── user_defined_function_test.js │ ├── test.json │ └── top10words.js └── tools ├── generateJS ├── READMD.md ├── build.sbt ├── project │ ├── build.properties │ └── plugins.sbt ├── src │ ├── main │ │ ├── resources │ │ │ └── template.properties │ │ └── scala │ │ │ └── org │ │ │ └── eclairjs │ │ │ └── tools │ │ │ └── generate │ │ │ ├── GenerateApp.scala │ │ │ ├── GenerateJSBase.scala │ │ │ ├── GenerateJavaWrapper.scala │ │ │ ├── GenerateNashorn.scala │ │ │ ├── GenerateNode.scala │ │ │ ├── ParseSource.scala │ │ │ ├── Statistics.scala │ │ │ └── org │ │ │ └── eclairjs │ │ │ └── tools │ │ │ └── generate │ │ │ └── model │ │ │ ├── Comment.scala │ │ │ └── Model.scala │ └── test │ │ └── scala │ │ └── Test1.scala └── wontImplement.txt └── js2Notebook ├── pom.xml └── src └── main └── scala └── Main.scala /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | target 4 | dependency-reduced-pom.xml 5 | .DS_Store 6 | module*.zip 7 | -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /docs/jsdoc/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/docs/jsdoc/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /docs/jsdoc/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /docs/jsdoc/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /eclairjs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/eclairjs/__init__.py -------------------------------------------------------------------------------- /eclairjs/jars/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EclairJS/eclairjs-nashorn/6723b80d5a7b0c97fd72eb1bcd5c0fa46b493080/eclairjs/jars/__init__.py -------------------------------------------------------------------------------- /examples/accumulator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | Usage: 19 | bin/eclairjs.sh examples/accumulator.js" 20 | */ 21 | 22 | 23 | function run(sc){ 24 | 25 | sc.parallelize([1, 2, 3, 4]).foreach(function(x, accum) { 26 | accum.add(x); 27 | }, [accum]); 28 | return accum.value(); 29 | } 30 | 31 | 32 | /* 33 | check if SparkContext is defined, if it is we are being run from Unit Test 34 | */ 35 | 36 | if (typeof sparkContext === 'undefined') { 37 | var SparkConf = require('eclairjs/SparkConf'); 38 | var SparkContext = require('eclairjs/SparkContext'); 39 | var conf = new SparkConf().setAppName("JavaScript accumulators test"); 40 | var sc = new SparkContext(conf); 41 | var accum = sc.accumulator([0]); 42 | var result=run(sc); 43 | print(result); 44 | 45 | sc.stop(); 46 | } -------------------------------------------------------------------------------- /examples/data/lpsa.data: -------------------------------------------------------------------------------- 1 | -0.4307829,-1.63735562648104 -2.00621178480549 -1.86242597251066 -1.02470580167082 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 2 | -0.1625189,-1.98898046126935 -0.722008756122123 -0.787896192088153 -1.02470580167082 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 3 | -0.1625189,-1.57881887548545 -2.1887840293994 1.36116336875686 -1.02470580167082 -0.522940888712441 -0.863171185425945 0.342627053981254 -0.155348103855541 4 | -0.1625189,-2.16691708463163 -0.807993896938655 -0.787896192088153 -1.02470580167082 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 5 | 0.3715636,-0.507874475300631 -0.458834049396776 -0.250631301876899 -1.02470580167082 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 6 | 0.7654678,-2.03612849966376 -0.933954647105133 -1.86242597251066 -1.02470580167082 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 7 | 0.8544153,-0.557312518810673 -0.208756571683607 -0.787896192088153 0.990146852537193 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 8 | 1.2669476,-0.929360463147704 -0.0578991819441687 0.152317365781542 -1.02470580167082 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 9 | 1.2669476,-2.28833047634983 -0.0706369432557794 -0.116315079324086 0.80409888772376 -0.522940888712441 -0.863171185425945 -1.04215728919298 -0.864466507337306 10 | 1.2669476,0.223498042876113 -1.41471935455355 -0.116315079324086 -1.02470580167082 -0.522940888712441 -0.29928234305568 0.342627053981254 0.199211097885341 11 | -------------------------------------------------------------------------------- /examples/data/mllib/als/test.data: -------------------------------------------------------------------------------- 1 | 1,1,5.0 2 | 1,2,1.0 3 | 1,3,5.0 4 | 1,4,1.0 5 | 2,1,5.0 6 | 2,2,1.0 7 | 2,3,5.0 8 | 2,4,1.0 9 | 3,1,1.0 10 | 3,2,5.0 11 | 3,3,1.0 12 | 3,4,5.0 13 | 4,1,1.0 14 | 4,2,5.0 15 | 4,3,1.0 16 | 4,4,5.0 17 | -------------------------------------------------------------------------------- /examples/data/mllib/kmeans_data.txt: -------------------------------------------------------------------------------- 1 | 0.0 0.0 0.0 2 | 0.1 0.1 0.1 3 | 0.2 0.2 0.2 4 | 9.0 9.0 9.0 5 | 9.1 9.1 9.1 6 | 9.2 9.2 9.2 -------------------------------------------------------------------------------- /examples/data/mllib/sample_fpgrowth.txt: -------------------------------------------------------------------------------- 1 | r z h k p 2 | z y x w v u t s 3 | s x o n r 4 | x z y m t s q e 5 | z 6 | x z y r q t p 7 | -------------------------------------------------------------------------------- /examples/data/mllib/sample_kmeans_data.txt: -------------------------------------------------------------------------------- 1 | 0 1:0.0 2:0.0 3:0.0 2 | 1 1:0.1 2:0.1 3:0.1 3 | 2 1:0.2 2:0.2 3:0.2 4 | 3 1:9.0 2:9.0 3:9.0 5 | 4 1:9.1 2:9.1 3:9.1 6 | 5 1:9.2 2:9.2 3:9.2 7 | -------------------------------------------------------------------------------- /examples/data/mllib/sample_lda_data.txt: -------------------------------------------------------------------------------- 1 | 1 2 6 0 2 3 1 1 0 0 3 2 | 1 3 0 1 3 0 0 2 0 0 1 3 | 1 4 1 0 0 4 9 0 1 2 0 4 | 2 1 0 3 0 0 5 0 2 3 9 5 | 3 1 1 9 3 0 2 0 0 1 3 6 | 4 2 0 3 4 5 1 1 1 4 0 7 | 2 1 0 3 0 0 5 0 2 2 9 8 | 1 1 1 9 2 1 2 0 0 1 3 9 | 4 4 0 3 4 2 1 3 0 0 0 10 | 2 8 2 0 3 0 2 0 2 7 2 11 | 1 1 1 9 0 2 2 0 0 3 3 12 | 4 1 0 0 4 5 1 3 0 1 0 -------------------------------------------------------------------------------- /examples/data/mllib/sample_lda_libsvm_data.txt: -------------------------------------------------------------------------------- 1 | 0 1:1 2:2 3:6 4:0 5:2 6:3 7:1 8:1 9:0 10:0 11:3 2 | 1 1:1 2:3 3:0 4:1 5:3 6:0 7:0 8:2 9:0 10:0 11:1 3 | 2 1:1 2:4 3:1 4:0 5:0 6:4 7:9 8:0 9:1 10:2 11:0 4 | 3 1:2 2:1 3:0 4:3 5:0 6:0 7:5 8:0 9:2 10:3 11:9 5 | 4 1:3 2:1 3:1 4:9 5:3 6:0 7:2 8:0 9:0 10:1 11:3 6 | 5 1:4 2:2 3:0 4:3 5:4 6:5 7:1 8:1 9:1 10:4 11:0 7 | 6 1:2 2:1 3:0 4:3 5:0 6:0 7:5 8:0 9:2 10:2 11:9 8 | 7 1:1 2:1 3:1 4:9 5:2 6:1 7:2 8:0 9:0 10:1 11:3 9 | 8 1:4 2:4 3:0 4:3 5:4 6:2 7:1 8:3 9:0 10:0 11:0 10 | 9 1:2 2:8 3:2 4:0 5:3 6:0 7:2 8:0 9:2 10:7 11:2 11 | 10 1:1 2:1 3:1 4:9 5:0 6:2 7:2 8:0 9:0 10:3 11:3 12 | 11 1:4 2:1 3:0 4:0 5:4 6:5 7:1 8:3 9:0 10:1 11:0 13 | -------------------------------------------------------------------------------- /examples/data/pagerank_data.txt: -------------------------------------------------------------------------------- 1 | 1 2 2 | 1 3 3 | 1 4 4 | 2 1 5 | 3 1 6 | 4 1 7 | -------------------------------------------------------------------------------- /examples/data/people.json: -------------------------------------------------------------------------------- 1 | {"name": "Michael", "age": "29", "male": true } 2 | {"name": "Andy", "age": "40", "male": true} 3 | {"name": "Debbie", "age": "19", "male": false} 4 | {"name": "Sue", "age": "33", "male": false} -------------------------------------------------------------------------------- /examples/data/people.txt: -------------------------------------------------------------------------------- 1 | Michael, 29 2 | Andy, 30 3 | Justin, 19 -------------------------------------------------------------------------------- /examples/data/states.csv: -------------------------------------------------------------------------------- 1 | st,name,code 2 | 01,Alabama,AL 3 | 02,Alaska,AK 4 | 04,Arizona,AZ 5 | 05,Arkansas,AR 6 | 06,California,CA 7 | 08,Colorado,CO 8 | 09,Connecticut,CT 9 | 10,Delaware,DE 10 | 11,District of Columbia,DC 11 | 12,Florida,FL 12 | 13,Georgia,GA 13 | 15,Hawaii,HI 14 | 16,Idaho,ID 15 | 17,Illinois,IL 16 | 18,Indiana,IN 17 | 19,Iowa,IA 18 | 20,Kansas,KS 19 | 21,Kentucky,KY 20 | 22,Louisiana,LA 21 | 23,Maine,ME 22 | 24,Maryland,MD 23 | 25,Massachusetts,MA 24 | 26,Michigan,MI 25 | 27,Minnesota,MN 26 | 28,Mississippi,MS 27 | 29,Missouri,MO 28 | 30,Montana,MT 29 | 31,Nebraska,NE 30 | 32,Nevada,NV 31 | 33,New Hampshire,NH 32 | 34,New Jersey,NJ 33 | 35,New Mexico,NM 34 | 36,New York,NY 35 | 37,North Carolina,NC 36 | 38,North Dakota,ND 37 | 39,Ohio,OH 38 | 40,Oklahoma,OK 39 | 41,Oregon,OR 40 | 42,Pennsylvania,PA 41 | 44,Rhode Island,RI 42 | 45,South Carolina,SC 43 | 46,South Dakota,SD 44 | 47,Tennessee,TN 45 | 48,Texas,TX 46 | 49,Utah,UT 47 | 50,Vermont,VT 48 | 51,Virginia,VA 49 | 53,Washington,WA 50 | 54,West Virginia,WV 51 | 55,Wisconsin,WI 52 | 56,Wyoming,WY 53 | 72,Puerto Rico,PR -------------------------------------------------------------------------------- /examples/data/test.json: -------------------------------------------------------------------------------- 1 | {"first": "Luke", "last": "Skywalker"} 2 | {"first": "Darth", "last": "Vader"} 3 | {"first": "Darth", "last": "Sidious"} 4 | {"first": "Darth", "last": "Maul"} 5 | -------------------------------------------------------------------------------- /examples/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | zookeeper: 5 | image: wurstmeister/zookeeper 6 | ports: 7 | - "2181:2181" 8 | kafka: 9 | image: wurstmeister/kafka:0.8.2.2 10 | ports: 11 | - "9092:9092" 12 | links: 13 | - zookeeper:zk 14 | environment: 15 | KAFKA_ADVERTISED_HOST_NAME: ${KAFKA_HOST} 16 | KAFKA_ADVERTISED_PORT: 9092 17 | KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 18 | KAFKA_CREATE_TOPICS: "tlog:1:1" 19 | volumes: 20 | - /var/run/docker.sock:/var/run/docker.sock 21 | depends_on: 22 | - zookeeper 23 | pump: 24 | image: wurstmeister/kafka:0.8.2.2 25 | environment: 26 | ZK: ${KAFKA_HOST}:2181 27 | HOST_IP: ${KAFKA_HOST} 28 | volumes: 29 | - /var/run/docker.sock:/var/run/docker.sock 30 | - ./data/dream.txt:/dream.txt 31 | - ./run.sh:/run.sh 32 | command: /run.sh 33 | depends_on: 34 | - kafka 35 | -------------------------------------------------------------------------------- /examples/hello.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | var goodbye = require("examples/simple/goodbye"); 18 | 19 | function sayHello(x) { 20 | print('sayHello x: ' + x); 21 | var num = x || 2; 22 | for (var i = 0; i < num; i++) { 23 | print('Hello World'); 24 | goodbye(i); 25 | } 26 | }; 27 | 28 | module.exports = sayHello; 29 | -------------------------------------------------------------------------------- /examples/ml/bisecting_kmeans_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/bisecting_kmeans_example.js" 19 | */ 20 | 21 | 22 | function run(spark) { 23 | var BisectingKMeans = require("eclairjs/ml/clustering/BisectingKMeans"); 24 | 25 | 26 | // Load the data 27 | var dataset = spark.read().format("libsvm").load("examples/data/mllib/sample_kmeans_data.txt"); 28 | 29 | // Trains a bisecting-k-means model 30 | var bkm = new BisectingKMeans() 31 | .setK(2) 32 | .setSeed(1); 33 | var model = bkm.fit(dataset); 34 | 35 | // Shows the result 36 | var centers = model.clusterCenters(); 37 | 38 | return centers; 39 | } 40 | 41 | 42 | /* 43 | check if SparkSession is defined, if it is we are being run from Unit Test 44 | */ 45 | 46 | if (typeof sparkSession === 'undefined') { 47 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 48 | var spark = SparkSession 49 | .builder() 50 | .appName("JavaScript BisectingKMeans Example") 51 | .getOrCreate(); 52 | var result = run(spark); 53 | print("Cluster Centers: "); 54 | result.forEach(function (center) { 55 | print(center); 56 | }); 57 | 58 | spark.stop(); 59 | } 60 | -------------------------------------------------------------------------------- /examples/ml/gaussian_mixture_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/gaussian_mixture_example.js 19 | */ 20 | 21 | function run(spark) { 22 | var GaussianMixture = require("eclairjs/ml/clustering/GaussianMixture"); 23 | 24 | 25 | // Load training data 26 | var dataset = spark.read().format("libsvm").load("examples/data/mllib/sample_kmeans_data.txt"); 27 | 28 | // Trains a GaussianMixture model 29 | var gmm = new GaussianMixture() 30 | .setK(2); 31 | var model = gmm.fit(dataset); 32 | 33 | // Shows the result 34 | var ret = {}; 35 | ret.weights = model.weights(); 36 | ret.gaussianDF = model.gaussiansDF(); 37 | 38 | return ret; 39 | } 40 | 41 | 42 | /* 43 | check if SparkSession is defined, if it is we are being run from Unit Test 44 | */ 45 | 46 | if (typeof sparkSession === 'undefined') { 47 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 48 | var spark = SparkSession 49 | .builder() 50 | .appName("JavaScript GaussianMixture Example") 51 | .getOrCreate(); 52 | var result = run(spark); 53 | print("weights=", result.weights); 54 | result.gaussianDF.show(5); 55 | 56 | spark.stop(); 57 | } 58 | -------------------------------------------------------------------------------- /examples/ml/kmeans_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/kmeans_example.js [] []" 19 | */ 20 | 21 | 22 | var inputFile = ((typeof args !== "undefined") && (args.length > 1)) ? args[1] : "examples/data/mllib/sample_kmeans_data.txt"; 23 | var k = 2; 24 | 25 | function run(spark) { 26 | var KMeans = require("eclairjs/ml/clustering/KMeans"); 27 | 28 | 29 | // Loads data. 30 | var dataset = spark.read().format("libsvm").load(inputFile); 31 | 32 | // Trains a k-means model. 33 | var kmeans = new KMeans().setK(k).setSeed(1); 34 | var model = kmeans.fit(dataset); 35 | 36 | 37 | // Shows the result 38 | var centers = model.clusterCenters(); 39 | 40 | return centers; 41 | } 42 | 43 | 44 | /* 45 | check if SparkSession is defined, if it is we are being run from Unit Test 46 | */ 47 | 48 | if (typeof sparkSession === 'undefined') { 49 | if (args.length > 1) { 50 | inputFile = args[1]; 51 | } 52 | if (args.length > 2) { 53 | k = parseInt(args[2]); 54 | } 55 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 56 | var spark = SparkSession 57 | .builder() 58 | .appName("JavaScript KMeans Example") 59 | .getOrCreate(); 60 | var result = run(spark); 61 | print("Cluster Centers: "); 62 | result.forEach(function (center) { 63 | print(center); 64 | }); 65 | 66 | spark.stop(); 67 | } 68 | -------------------------------------------------------------------------------- /examples/ml/max_abs_scaler_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/max_abs_scaler_example.js" 19 | */ 20 | 21 | function run(spark) { 22 | var MaxAbsScaler = require("eclairjs/ml/feature/MaxAbsScaler"); 23 | 24 | 25 | var dataFrame = spark.read().format("libsvm").load("examples/data/mllib/sample_libsvm_data.txt"); 26 | var scaler = new MaxAbsScaler() 27 | .setInputCol("features") 28 | .setOutputCol("scaledFeatures"); 29 | 30 | // Compute summary statistics and generate MaxAbsScalerModel 31 | var scalerModel = scaler.fit(dataFrame); 32 | 33 | // rescale each feature to range [min, max]. 34 | return scalerModel.transform(dataFrame); 35 | 36 | } 37 | 38 | 39 | /* 40 | check if SparkSession is defined, if it is we are being run from Unit Test 41 | */ 42 | 43 | if (typeof sparkSession === 'undefined') { 44 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 45 | var spark = SparkSession 46 | .builder() 47 | .appName("JavaScript MaxAbsScaler Example") 48 | .getOrCreate(); 49 | 50 | var result = run(spark); 51 | result.show(); 52 | 53 | spark.stop(); 54 | } 55 | -------------------------------------------------------------------------------- /examples/ml/min_max_scaler_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/min_max_scaler_example.js" 19 | */ 20 | 21 | function run(spark) { 22 | var MinMaxScaler = require("eclairjs/ml/feature/MinMaxScaler"); 23 | 24 | 25 | var dataFrame = spark.read().format("libsvm").load("examples/data/mllib/sample_libsvm_data.txt"); 26 | var scaler = new MinMaxScaler() 27 | .setInputCol("features") 28 | .setOutputCol("scaledFeatures"); 29 | 30 | // Compute summary statistics and generate MinMaxScalerModel 31 | var scalerModel = scaler.fit(dataFrame); 32 | 33 | // rescale each feature to range [min, max]. 34 | return scalerModel.transform(dataFrame); 35 | 36 | } 37 | 38 | 39 | /* 40 | check if SparkSession is defined, if it is we are being run from Unit Test 41 | */ 42 | 43 | if (typeof sparkSession === 'undefined') { 44 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 45 | var spark = SparkSession 46 | .builder() 47 | .appName("JavaScript MinMaxScaler Example") 48 | .getOrCreate(); 49 | 50 | var result = run(spark); 51 | result.show(); 52 | 53 | spark.stop(); 54 | } 55 | -------------------------------------------------------------------------------- /examples/ml/normalizer_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/normalizer_example.js" 19 | */ 20 | 21 | function run(spark) { 22 | var Normalizer = require("eclairjs/ml/feature/Normalizer"); 23 | 24 | var dataFrame = spark.read().format("libsvm").load("examples/data/mllib/sample_libsvm_data.txt"); 25 | 26 | // Normalize each Vector using $L^1$ norm. 27 | var normalizer = new Normalizer() 28 | .setInputCol("features") 29 | .setOutputCol("normFeatures") 30 | .setP(1.0); 31 | 32 | 33 | // Normalize each Vector using $L^\infty$ norm. 34 | return normalizer.transform(dataFrame, normalizer.p().w(Number.POSITIVE_INFINITY)); 35 | 36 | } 37 | 38 | 39 | /* 40 | check if SparkSession is defined, if it is we are being run from Unit Test 41 | */ 42 | 43 | if (typeof sparkSession === 'undefined') { 44 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 45 | var spark = SparkSession 46 | .builder() 47 | .appName("JavaScript Normalizer Example") 48 | .getOrCreate(); 49 | var result = run(spark); 50 | result.show(); 51 | 52 | spark.stop(); 53 | } 54 | -------------------------------------------------------------------------------- /examples/ml/standard_scaler_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Usage: 18 | bin/eclairjs.sh examples/ml/vector_slicer_example.js" 19 | */ 20 | 21 | function run(spark) { 22 | 23 | 24 | var StandardScaler = require('eclairjs/ml/feature/StandardScaler'); 25 | 26 | var dataFrame = spark.read().format("libsvm").load("examples/data/mllib/sample_libsvm_data.txt"); 27 | 28 | var scaler = new StandardScaler() 29 | .setInputCol("features") 30 | .setOutputCol("scaledFeatures") 31 | .setWithStd(true) 32 | .setWithMean(false); 33 | 34 | // Compute summary statistics by fitting the StandardScaler 35 | var scalerModel = scaler.fit(dataFrame); 36 | 37 | // Normalize each feature to have unit standard deviation. 38 | var scaledData = scalerModel.transform(dataFrame); 39 | 40 | return scaledData; 41 | 42 | 43 | } 44 | 45 | /* 46 | check if SparkSession is defined, if it is we are being run from Unit Test 47 | */ 48 | 49 | if (typeof sparkSession === 'undefined') { 50 | var SparkSession = require(EclairJS_Globals.NAMESPACE + '/sql/SparkSession'); 51 | var spark = SparkSession 52 | .builder() 53 | .appName("JavaScript StandardScaler Example") 54 | .getOrCreate(); 55 | var result = run(spark); 56 | 57 | result.show(20,true); 58 | 59 | // $example off$ 60 | spark.stop(); 61 | } 62 | -------------------------------------------------------------------------------- /examples/mllib/association_rules_example.js: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2016 IBM Corp. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | var AssociationRules = require('eclairjs/mllib/fpm/AssociationRules'); 19 | var FreqItemset = require('eclairjs/mllib/fpm/FreqItemset'); 20 | 21 | function run(sc) { 22 | 23 | var freqItemsets = sc.parallelize([ 24 | new FreqItemset(["a"], 15), 25 | new FreqItemset(["b"], 35), 26 | new FreqItemset(["a","b"], 12) 27 | ]); 28 | 29 | var arules = new AssociationRules() 30 | .setMinConfidence(0.8); 31 | var results = arules.run(freqItemsets); 32 | var rules = results.collect(); 33 | 34 | return rules; 35 | } 36 | 37 | /* 38 | check if SparkContext is defined, if it is we are being run from Unit Test 39 | */ 40 | 41 | if (typeof sparkContext === 'undefined') { 42 | var SparkConf = require('eclairjs/SparkConf'); 43 | var SparkContext = require('eclairjs/SparkContext'); 44 | var sparkConf = new SparkConf().setAppName("JavaScriptAssociationRulesExample"); 45 | var sc = new SparkContext(sparkConf); 46 | var rules = run(sc); 47 | var str = ""; 48 | rules.forEach(function(rule){ 49 | str += rule.antecedent() + " => " + rule.consequent() + ", " + rule.confidence(); 50 | }); 51 | print(str); 52 | } 53 | -------------------------------------------------------------------------------- /examples/mllib/pca_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | Usage: 19 | bin/eclairjs.sh examples/mllib/pca_example.js" 20 | */ 21 | 22 | var Vector = require("eclairjs/mllib/linalg/Vector"); 23 | var Vectors = require("eclairjs/mllib/linalg/Vectors"); 24 | var RowMatrix = require("eclairjs/mllib/linalg/distributed/RowMatrix"); 25 | 26 | function run(sc) { 27 | 28 | var rowsList = [Vectors.dense([1.12, 2.05, 3.12]), Vectors.dense([5.56, 6.28, 8.94]), Vectors.dense([10.2, 8.0, 20.5])]; 29 | 30 | var rows = sc.parallelize(rowsList); 31 | 32 | // Create a RowMatrix from JavaRDD. 33 | var mat = new RowMatrix(rows); 34 | 35 | // Compute the top 3 principal components. 36 | var pc = mat.computePrincipalComponents(3); 37 | var projected = mat.multiply(pc); 38 | 39 | //Vector[] collectPartitions = (Vector[])projected.rows().collect(); 40 | var collectPartitions = projected.rows().collect(); 41 | return collectPartitions; 42 | } 43 | 44 | /* 45 | check if SparkContext is defined, if it is we are being run from Unit Test 46 | */ 47 | 48 | if (typeof sparkContext === 'undefined') { 49 | var SparkConf = require('eclairjs/SparkConf'); 50 | var SparkContext = require('eclairjs/SparkContext'); 51 | var sparkConf = new SparkConf().setAppName("PCA Example"); 52 | var sc = new SparkContext(sparkConf); 53 | var result = run(sc); 54 | print("Projected vector of principal component:"); 55 | result.forEach(function(vector){ 56 | print("\t" + JSON.stringify(vector)); 57 | }); 58 | } 59 | -------------------------------------------------------------------------------- /examples/mllib/power_iteration_clustering_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | Usage: 19 | bin/eclairjs.sh examples/mllib/power_iteration_clustering_example.js" 20 | */ 21 | 22 | var PowerIterationClustering = require('eclairjs/mllib/clustering/PowerIterationClustering'); 23 | var Tuple3 = require('eclairjs/Tuple3'); 24 | 25 | function run(sc) { 26 | 27 | var similarities = sc.parallelize([ 28 | new Tuple3(0.0, 1.0, 0.9), 29 | new Tuple3(1.0, 2.0, 0.9), 30 | new Tuple3(2.0, 3.0, 0.9), 31 | new Tuple3(3.0, 4.0, 0.1), 32 | new Tuple3(4.0, 5.0, 0.9) 33 | ]); 34 | 35 | var pic = new PowerIterationClustering() 36 | .setK(2) 37 | .setMaxIterations(10); 38 | var model = pic.run(similarities); 39 | 40 | return model.assignments().collect(); 41 | 42 | } 43 | 44 | /* 45 | check if SparkContext is defined, if it is we are being run from Unit Test 46 | */ 47 | 48 | if (typeof sparkContext === 'undefined') { 49 | var SparkConf = require('eclairjs/SparkConf'); 50 | var SparkContext = require('eclairjs/SparkContext'); 51 | var sparkConf = new SparkConf().setAppName("PowerIterationClusteringExample"); 52 | var sc = new SparkContext(sparkConf); 53 | var result = run(sc); 54 | result.forEach(function(a){ 55 | print(a.id() + " -> " + a.cluster()); 56 | }); 57 | 58 | sc.stop(); 59 | } 60 | -------------------------------------------------------------------------------- /examples/mllib/prefix_span_example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | Usage: 19 | bin/eclairjs.sh examples/mllib/prefix_span_example.js" 20 | */ 21 | 22 | var PrefixSpan = require('eclairjs/mllib/fpm/PrefixSpan'); 23 | 24 | function run(sc) { 25 | var List = require('eclairjs/List'); 26 | 27 | var sequences = sc.parallelize([ 28 | new List([new List([1, 2]), new List([3])]), 29 | new List([new List([1]), new List([3, 2]), new List([1, 2])]), 30 | new List([new List([1, 2]), new List([5])]), 31 | new List([new List([6])]) 32 | ], 2); 33 | 34 | var prefixSpan = new PrefixSpan() 35 | .setMinSupport(0.5) 36 | .setMaxPatternLength(5); 37 | var model = prefixSpan.run(sequences); 38 | 39 | return model.freqSequences().collect(); 40 | 41 | } 42 | 43 | /* 44 | check if SparkContext is defined, if it is we are being run from Unit Test 45 | */ 46 | 47 | if (typeof sparkContext === 'undefined') { 48 | var SparkConf = require('eclairjs/SparkConf'); 49 | var SparkContext = require('eclairjs/SparkContext'); 50 | var sparkConf = new SparkConf().setAppName("PrefixSpanExample"); 51 | var sc = new SparkContext(sparkConf); 52 | var result = run(sc); 53 | print(JSON.stringify(result)); 54 | 55 | sc.stop(); 56 | } 57 | -------------------------------------------------------------------------------- /examples/pump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker run --rm -v `pwd`:/data -v /var/run/docker.sock:/var/run/docker.sock -e HOST_IP=$1 -e ZK=$1:2181 -i -t wurstmeister/kafka:0.8.2.2 /data/run.sh 4 | -------------------------------------------------------------------------------- /examples/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat /dream.txt | while read x ; do sleep 1 ; echo $x ; done | /opt/kafka_2.10-0.8.2.2/bin/kafka-console-producer.sh --topic=tlog --broker-list=`broker-list.sh` 4 | -------------------------------------------------------------------------------- /examples/simple-lambda-require.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | var hello = require('examples/hello'); 17 | var goodbye = require('examples/simple/goodbye'); 18 | var LabeledPoint = require('eclairjs/mllib/regression/LabeledPoint'); 19 | var test = require('https://raw.githubusercontent.com/jtbarbetta/testrepo/master/public/javascript/test-external.js'); 20 | var mustache = require('https://raw.githubusercontent.com/janl/mustache.js/master/mustache.js'); 21 | 22 | var SparkConf = require('eclairjs/SparkConf'); 23 | var SparkContext = require('eclairjs/SparkContext'); 24 | 25 | //var conf = new SparkConf().setAppName("Simple module binding to lambda function example").setMaster("spark://127.0.0.1:7077"); 26 | var conf = new SparkConf().setAppName("Simple module binding to lambda function example").setMaster("local[*]"); 27 | var sc = new SparkContext(conf); 28 | 29 | var doHello = function(){ 30 | sc.parallelize([1, 2, 3, 4]).foreach(function(x, hello, goodbye, LabeledPoint, test, mustache) { 31 | hello(x); 32 | goodbye(1); 33 | test(2); 34 | print('mustache.escapeHtml: ' + Mustache.escape("Hello from mustache!")); 35 | print('mustache.version: '+Mustache.version); 36 | }, [hello, goodbye, LabeledPoint, test, mustache]); 37 | } 38 | 39 | doHello(); 40 | -------------------------------------------------------------------------------- /examples/simple/addOne.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | function addOne(x) { 18 | return x+1; 19 | }; 20 | 21 | module.exports = addOne; 22 | -------------------------------------------------------------------------------- /examples/simple/goodbye.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | function sayGoodbye(x) { 18 | print('sayGoodbye x: ' + x); 19 | var num = x || 2; 20 | for (var i = 0; i < num; i++) { 21 | print('Goodbye World'); 22 | } 23 | }; 24 | 25 | module.exports = sayGoodbye; 26 | -------------------------------------------------------------------------------- /examples/spark_pi.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | Usage: 19 | bin/eclairjs.sh examples/spark_pi.js" 20 | */ 21 | 22 | /** 23 | * Computes an approximation to pi 24 | */ 25 | 26 | 27 | function run(spark) { 28 | 29 | var sc=spark.sparkContext(); 30 | var slices = 50; 31 | 32 | var n = 10000 * slices; 33 | var l = []; 34 | for (var i = 0; i < n; i++) { 35 | l.push(i); 36 | } 37 | 38 | 39 | var dataSet = sc.parallelize(l, slices); 40 | 41 | 42 | var count = dataSet.map(function (i) { 43 | var x = Math.random() * 2 - 1; 44 | var y = Math.random() * 2 - 1; 45 | return (x * x + y * y < 1) ? 1 : 0; 46 | }).reduce(function (int1, int2) { 47 | return int1 + int2; 48 | }); 49 | 50 | return (4.0 * count / n) 51 | 52 | } 53 | 54 | /* 55 | check if SparkContext is defined, if it is we are being run from Unit Test 56 | */ 57 | 58 | if (typeof sparkSession === 'undefined') { 59 | var SparkSession = require('eclairjs/sql/SparkSession'); 60 | var spark = SparkSession 61 | .builder() 62 | .appName("JavaScript Spark Pi") 63 | .getOrCreate(); 64 | var result = run(spark); 65 | print("Pi is roughly " + result); 66 | spark.stop(); 67 | } 68 | 69 | 70 | -------------------------------------------------------------------------------- /examples/streaming/queue_count.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | var Duration = require('eclairjs/streaming/Duration'); 18 | var StreamingContext = require('eclairjs/streaming/StreamingContext'); 19 | var Tuple2 = require('eclairjs/Tuple2'); 20 | var SparkConf = require(EclairJS_Globals.NAMESPACE + '/SparkConf'); 21 | 22 | // Create the context with a 1 second batch size 23 | 24 | var conf = new SparkConf().setAppName("Javascript Queue Stream"); 25 | var ssc = new StreamingContext(conf, new Duration(1000)); 26 | 27 | // Create the queue through which RDDs can be pushed to 28 | // a QueueInputDStream 29 | var rddQueue = []; 30 | 31 | // Create and push some RDDs into the queue 32 | var list = []; 33 | for (var i = 0; i < 1000; i++) { 34 | list.push(i); 35 | } 36 | for (var i = 0; i < 30; i++) { 37 | rddQueue.push(ssc.sparkContext().parallelize(list)); 38 | } 39 | 40 | // Create the QueueInputDStream and use it do some processing 41 | var inputStream = ssc.queueStream(rddQueue); 42 | var mappedStream = inputStream.mapToPair( 43 | function (i, Tuple2) { 44 | return new Tuple2(i % 10, 1); 45 | }, [Tuple2]); 46 | var reducedStream = mappedStream.reduceByKey( 47 | function (i1, i2) { 48 | return i1 + i2; 49 | }); 50 | 51 | reducedStream.print(); 52 | 53 | 54 | ssc.start(); 55 | ssc.awaitTermination(); 56 | -------------------------------------------------------------------------------- /jsdoc_conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": true, 4 | "dictionaries": ["jsdoc","closure"] 5 | }, 6 | "source": { 7 | "include": [ "src/main/resources" ], 8 | "exclude": [ ], 9 | "includePattern": ".+\\.js(doc)?$", 10 | "excludePattern": "(^|\\/|\\\\)_" 11 | }, 12 | "plugins": [], 13 | "templates": { 14 | "cleverLinks": false, 15 | "monospaceLinks": false 16 | }, 17 | "opts": { 18 | //"template": "templates/default", // same as -t templates/default 19 | "encoding": "utf8", // same as -e utf8 20 | "destination": "./docs/jsdocs/", // same as -d ./out/ 21 | "recurse": true // same as -r 22 | //"tutorials": "path/to/tutorials", // same as -u path/to/tutorials 23 | } 24 | } -------------------------------------------------------------------------------- /kernel.json: -------------------------------------------------------------------------------- 1 | { 2 | "display_name": "Spark 1.6.0 (EclairJS)", 3 | "language": "javascript", 4 | "argv": [ 5 | "/bin/spark-kernel", 6 | "--interpreter-plugin", 7 | "eclair:org.eclairjs.nashorn.JavascriptInterpreter", 8 | "--default-interpreter", 9 | "eclair", 10 | "--nosparkcontext", 11 | "--profile", 12 | "{connection_file}" 13 | ], 14 | "env": { 15 | "SPARK_OPTS": "--jars file:", 16 | "SPARK_HOME": "" 17 | }, 18 | "codemirror_mode": "scala" 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/Bootstrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import javax.script.ScriptEngine; 20 | 21 | /** 22 | * Created by bburns on 10/21/15. 23 | */ 24 | public interface Bootstrap { 25 | public void load(ScriptEngine engine); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSDoubleFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | s * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import jdk.nashorn.api.scripting.ScriptObjectMirror; 20 | import org.apache.commons.lang.ArrayUtils; 21 | import org.apache.spark.api.java.function.DoubleFunction; 22 | 23 | import javax.script.Invocable; 24 | import javax.script.ScriptEngine; 25 | 26 | public class JSDoubleFunction extends JSBaseFunction implements DoubleFunction { 27 | 28 | public JSDoubleFunction(String func, Object[] o) 29 | { 30 | super(func,o); 31 | } 32 | 33 | @SuppressWarnings({ "null", "unchecked" }) 34 | @Override 35 | public double call(Object o) throws Exception { 36 | 37 | Object params[] = { o}; 38 | Object ret = callScript(params); 39 | 40 | return ((Double)ret).doubleValue(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSFilterFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import org.apache.spark.api.java.function.FilterFunction; 20 | 21 | 22 | public class JSFilterFunction extends JSBaseFunction implements FilterFunction { 23 | public JSFilterFunction(String func, Object[] o) { 24 | super(func,o); 25 | } 26 | 27 | @SuppressWarnings("unchecked") 28 | @Override 29 | public boolean call(Object o) throws Exception { 30 | Object params[] = { o}; 31 | 32 | Object ret = callScript(params); 33 | return (boolean)ret; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSFlatMapFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import javax.script.Invocable; 20 | import javax.script.ScriptEngine; 21 | 22 | import org.apache.commons.lang.ArrayUtils; 23 | import org.apache.spark.api.java.function.FlatMapFunction; 24 | import jdk.nashorn.api.scripting.ScriptObjectMirror; 25 | import org.apache.spark.sql.Encoder; 26 | 27 | import java.util.*; 28 | 29 | 30 | public class JSFlatMapFunction extends JSBaseFunction implements FlatMapFunction { 31 | Encoder encoder; 32 | 33 | public JSFlatMapFunction(String func, Encoder encoder, Object[] o) { 34 | super(func,o); 35 | this.encoder=encoder; 36 | } 37 | public JSFlatMapFunction(String func, Object[] o) { 38 | super(func,o); 39 | this.encoder=null; 40 | } 41 | @SuppressWarnings("unchecked") 42 | @Override 43 | public Iterator call(Object o) throws Exception { 44 | Object params[] = { o}; 45 | 46 | Object ret = callScript(params); 47 | return toIterator(ret,encoder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSForeachFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | s * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import org.apache.spark.api.java.function.ForeachFunction; 20 | 21 | public class JSForeachFunction extends JSBaseFunction implements ForeachFunction { 22 | 23 | public JSForeachFunction(String func, Object[] o) { 24 | super(func,o); 25 | } 26 | 27 | @SuppressWarnings({ "null", "unchecked" }) 28 | @Override 29 | public void call(Object o) throws Exception { 30 | 31 | Object [] params={o}; 32 | Object ret = callScript(params); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSForeachPartitionFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | s * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import org.apache.spark.api.java.function.ForeachPartitionFunction; 20 | 21 | import java.util.ArrayList; 22 | import java.util.Iterator; 23 | 24 | public class JSForeachPartitionFunction extends JSBaseFunction implements ForeachPartitionFunction { 25 | 26 | public JSForeachPartitionFunction(String func, Object[] o) { 27 | super(func,o); 28 | } 29 | 30 | @SuppressWarnings({ "null", "unchecked" }) 31 | @Override 32 | public void call(Iterator iter) throws Exception { 33 | 34 | java.util.List list = new ArrayList(); 35 | while (iter.hasNext()) 36 | list.add(iter.next()); 37 | Object params[] = { list.toArray()}; 38 | Object ret = callScript(params); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | s * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import javax.script.Invocable; 20 | import javax.script.ScriptEngine; 21 | 22 | import jdk.nashorn.api.scripting.ScriptObjectMirror; 23 | import org.apache.commons.lang.ArrayUtils; 24 | import org.apache.spark.api.java.function.Function; 25 | 26 | public class JSFunction extends JSBaseFunction implements Function { 27 | 28 | public JSFunction(String func, Object[] o) { 29 | super(func,o); 30 | } 31 | 32 | @SuppressWarnings({ "null", "unchecked" }) 33 | @Override 34 | public Object call(Object o) throws Exception { 35 | 36 | Object [] params={o}; 37 | Object ret = callScript(params); 38 | ret = Utils.jsToJava(ret); 39 | 40 | return ret; 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSFunction0.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import javax.script.Invocable; 23 | import javax.script.ScriptEngine; 24 | import org.apache.commons.lang.ArrayUtils; 25 | import org.apache.spark.api.java.function.Function0; 26 | 27 | public class JSFunction0 extends JSBaseFunction implements Function0 { 28 | 29 | public JSFunction0(String func, Object[] o) { 30 | super(func,o); 31 | } 32 | 33 | @SuppressWarnings({ "null", "unchecked" }) 34 | @Override 35 | public Object call() throws Exception { 36 | Object params[] = {}; 37 | 38 | Object ret = callScript( params); 39 | 40 | return ret; 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSFunction2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import jdk.nashorn.api.scripting.ScriptObjectMirror; 20 | import org.apache.commons.lang.ArrayUtils; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import javax.script.Invocable; 26 | import javax.script.ScriptEngine; 27 | 28 | public class JSFunction2 extends JSBaseFunction implements org.apache.spark.api.java.function.Function2 { 29 | 30 | 31 | public JSFunction2(String func, Object[] o) { 32 | super(func,o); 33 | } 34 | 35 | @SuppressWarnings({ "null", "unchecked" }) 36 | @Override 37 | public Object call(Object o, Object o2) throws Exception { 38 | Object params[] = { o, o2}; 39 | Object ret = callScript( params); 40 | return ret; 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSMapFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import org.apache.spark.sql.Encoder; 20 | 21 | public class JSMapFunction extends JSBaseFunction implements org.apache.spark.api.java.function.MapFunction { 22 | 23 | 24 | private Encoder encoder; 25 | 26 | public JSMapFunction(String func, Encoder encoder, Object[] o) { 27 | super(func,o); 28 | this.encoder=encoder; 29 | } 30 | 31 | public JSMapFunction(String func, Object[] o) { 32 | super(func,o); 33 | } 34 | 35 | @SuppressWarnings({ "null", "unchecked" }) 36 | @Override 37 | public Object call(Object o) throws Exception { 38 | Object params[] = { o}; 39 | Object ret = callScript( params); 40 | 41 | return castDataType(ret,encoder); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSMapPartitionsFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import org.apache.spark.sql.Encoder; 20 | 21 | import java.util.ArrayList; 22 | import java.util.Iterator; 23 | 24 | public class JSMapPartitionsFunction extends JSBaseFunction implements org.apache.spark.api.java.function.MapPartitionsFunction { 25 | 26 | Encoder encoder; 27 | 28 | public JSMapPartitionsFunction(String func, Encoder encoder, Object[] o) { 29 | super(func,o); 30 | this.encoder=encoder; 31 | } 32 | 33 | public JSMapPartitionsFunction(String func, Object[] o) { 34 | super(func,o); 35 | } 36 | 37 | @SuppressWarnings({ "null", "unchecked" }) 38 | @Override 39 | public Iterator call(Iterator iter) throws Exception { 40 | java.util.List list = new ArrayList(); 41 | while (iter.hasNext()) 42 | list.add(iter.next()); 43 | Object params[] = { list.toArray()}; 44 | Object ret = callScript( params); 45 | 46 | return toIterator(ret,encoder); 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSONSerializer.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | /* 3 | * Copyright 2016 IBM Corp. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | To send a JavaScript object to a spark worker we need to convert it to a Java object that implements java.io.Serializable. 20 | JSONSerializer is that object, this object has a string properties that is the JSON representation of the JavaScript object 21 | to be sent to the workers. Once it arrives at the workers it must be converted back to a JavaScript object (Serialize.JSONSerializer) 22 | for use in the LAMBDA function. 23 | */ 24 | public class JSONSerializer implements java.io.Serializable { 25 | private String json; 26 | 27 | public JSONSerializer(String json) { 28 | this.json = json; 29 | } 30 | 31 | public JSONSerializer(Object json) { 32 | this.json = "json"; 33 | } 34 | 35 | public JSONSerializer() { 36 | this.json = null; 37 | } 38 | public String getJson() { 39 | return json; 40 | } 41 | 42 | public void setJson(String json) { 43 | this.json = json; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return this.getJson(); 49 | } 50 | 51 | @Override 52 | public boolean equals(Object o) { 53 | if (this == o) return true; 54 | if (o == null || getClass() != o.getClass()) return false; 55 | JSONSerializer json = (JSONSerializer) o; 56 | return json.getJson().equals(this.getJson()); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSPairFlatMapFunction.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | 3 | import jdk.nashorn.api.scripting.ScriptObjectMirror; 4 | import org.apache.commons.lang.ArrayUtils; 5 | import org.apache.spark.api.java.function.PairFlatMapFunction; 6 | import scala.Tuple2; 7 | 8 | import javax.script.Invocable; 9 | import javax.script.ScriptEngine; 10 | import java.util.ArrayList; 11 | import java.util.Iterator; 12 | import java.util.List; 13 | 14 | public class JSPairFlatMapFunction extends JSBaseFunction implements PairFlatMapFunction { 15 | 16 | public JSPairFlatMapFunction(String func, Object[] o) { 17 | super(func,o); 18 | } 19 | 20 | @Override 21 | public Iterator call(Object o) throws Exception { 22 | Object params[] = {o}; 23 | 24 | 25 | Object ret = callScript(params); 26 | 27 | List l = (List)ret; 28 | 29 | return l.iterator(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSPairFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import jdk.nashorn.api.scripting.ScriptObjectMirror; 20 | 21 | import org.apache.commons.lang.ArrayUtils; 22 | import org.apache.spark.api.java.function.PairFunction; 23 | 24 | import scala.Tuple2; 25 | 26 | import javax.script.Invocable; 27 | import javax.script.ScriptEngine; 28 | import java.util.ArrayList; 29 | import java.util.List; 30 | 31 | /** 32 | * Created by bburns on 9/13/15. 33 | */ 34 | public class JSPairFunction extends JSBaseFunction implements PairFunction { 35 | 36 | 37 | public JSPairFunction(String func, Object[] o) { 38 | super(func,o); 39 | } 40 | 41 | @SuppressWarnings("unchecked") 42 | @Override 43 | public Tuple2 call(Object o) throws Exception { 44 | Object params[] = { o}; 45 | 46 | Object ret = callScript(params); 47 | 48 | return (Tuple2)ret; 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSReduceFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | public class JSReduceFunction extends JSBaseFunction implements org.apache.spark.api.java.function.ReduceFunction { 20 | 21 | 22 | public JSReduceFunction(String func, Object[] o) { 23 | super(func,o); 24 | } 25 | 26 | @SuppressWarnings({ "null", "unchecked" }) 27 | @Override 28 | public Object call(Object o, Object o2) throws Exception { 29 | Object params[] = { o, o2}; 30 | Object ret = callScript( params); 31 | return ret; 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/JSVoidFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | s * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import javax.script.Invocable; 23 | import javax.script.ScriptEngine; 24 | import org.apache.commons.lang.ArrayUtils; 25 | import org.apache.spark.api.java.function.VoidFunction; 26 | 27 | public class JSVoidFunction extends JSBaseFunction implements VoidFunction { 28 | public JSVoidFunction(String func, Object[] o) { 29 | super(func,o); 30 | } 31 | 32 | @SuppressWarnings({ "null", "unchecked" }) 33 | @Override 34 | public void call(Object o) throws Exception { 35 | Object params[] = {o}; 36 | 37 | callScript(params); 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/mllib/clustering/PowerIterationClusteringRunFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | s * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclairjs.nashorn.mllib.clustering; 18 | 19 | import org.apache.spark.api.java.function.Function; 20 | import scala.Tuple3; 21 | 22 | 23 | public class PowerIterationClusteringRunFunction implements Function { 24 | private String func = null; 25 | private Object args[] = null; 26 | 27 | public PowerIterationClusteringRunFunction() { 28 | 29 | } 30 | 31 | @SuppressWarnings({ "null", "unchecked" }) 32 | @Override 33 | /* 34 | The RDD we get from Nashorn is a Tuple(Double, Double, Double) 35 | what we need for PowerIterationClustering,run is a RDD> 36 | the only way to accomplish this is to RDD.map() the RDD from what we are given to what is required. 37 | then give the resulting RDD to the run(). 38 | */ 39 | public Object call(Object o) throws Exception { 40 | Tuple3 t = (Tuple3) o; 41 | Double l1 = (Double)t._1(); 42 | Double l2 = (Double)t._2(); 43 | Tuple3 x = new Tuple3(l1.longValue(), l2.longValue(), (Double) t._3()); 44 | return x; 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF1.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF1; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF1 extends JSUDF implements UDF1 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF1(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF10.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF10; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF10 extends JSUDF implements UDF10 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF10(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4,Object o5, Object o6, Object o7, Object o8, Object o9, Object o10) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF11.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF11; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF11 extends JSUDF implements UDF11 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF11(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4,Object o5, Object o6, Object o7, Object o8, Object o9, 37 | Object o10, Object o11 38 | ) throws Exception { 39 | ScriptEngine e = NashornEngineSingleton.getEngine(); 40 | if (this.fn == null) { 41 | this.fn = e.eval(func); 42 | } 43 | Invocable invocable = (Invocable) e; 44 | 45 | Object params[] = {this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11}; 46 | 47 | if (this.args != null && this.args.length > 0 ) { 48 | params = ArrayUtils.addAll(params, this.args); 49 | } 50 | 51 | Object ret = invocable.invokeFunction("Utils_invoke", params); 52 | ret = this.castValueToReturnType(ret); 53 | return ret; 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF2.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF2; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF2 extends JSUDF implements UDF2 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF2(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF3.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF3; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF3 extends JSUDF implements UDF3 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF3(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF4.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF4; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF4 extends JSUDF implements UDF4 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF4(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3, o4}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF5.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF5; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF5 extends JSUDF implements UDF5 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF5(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4, Object o5) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3, o4, o5}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF7.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF7; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF7 extends JSUDF implements UDF7 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF7(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4,Object o5, Object o6, Object o7) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3, o4, o5, o6, o7}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF8.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF8; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF8 extends JSUDF implements UDF8 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF8(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4,Object o5, Object o6, Object o7, Object o8) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3, o4, o5, o6, o7, o8}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/sql/JSUDF9.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.sql;/* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.commons.lang.ArrayUtils; 18 | import org.apache.spark.sql.api.java.UDF9; 19 | import org.eclairjs.nashorn.NashornEngineSingleton; 20 | 21 | import javax.script.Invocable; 22 | import javax.script.ScriptEngine; 23 | 24 | public class JSUDF9 extends JSUDF implements UDF9 { 25 | private String func = null; 26 | private Object args[] = null; 27 | private Object fn = null; 28 | 29 | public JSUDF9(String func, Object[] o) { 30 | this.func = func; 31 | this.args = o; 32 | } 33 | 34 | @SuppressWarnings({ "null", "unchecked" }) 35 | @Override 36 | public Object call(Object o, Object o2, Object o3, Object o4,Object o5, Object o6, Object o7, Object o8, Object o9) throws Exception { 37 | ScriptEngine e = NashornEngineSingleton.getEngine(); 38 | if (this.fn == null) { 39 | this.fn = e.eval(func); 40 | } 41 | Invocable invocable = (Invocable) e; 42 | 43 | Object params[] = {this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9}; 44 | 45 | if (this.args != null && this.args.length > 0 ) { 46 | params = ArrayUtils.addAll(params, this.args); 47 | } 48 | 49 | Object ret = invocable.invokeFunction("Utils_invoke", params); 50 | ret = this.castValueToReturnType(ret); 51 | return ret; 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/eclairjs/nashorn/wrap/WrappedFunction.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn.wrap; 2 | 3 | import jdk.nashorn.api.scripting.AbstractJSObject; 4 | 5 | public abstract class WrappedFunction extends AbstractJSObject { 6 | 7 | @Override 8 | public boolean isFunction() { 9 | return true; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/conf/log4j.prop: -------------------------------------------------------------------------------- 1 | # Set everything to be logged to the console 2 | log4j.rootCategory=WARN, console 3 | log4j.appender.console=org.apache.log4j.ConsoleAppender 4 | log4j.appender.console.target=System.err 5 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n 7 | 8 | # Settings to quiet third party logs that are too verbose 9 | log4j.logger.org.spark-project.jetty=WARN 10 | log4j.logger.org.spark-project.jetty.util.component.AbstractLifeCycle=ERROR 11 | log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=WARN 12 | log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=WARN 13 | 14 | # SPARK-9183: Settings to avoid annoying messages when looking up nonexistent UDFs in SparkSQL with Hive support 15 | log4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=FATAL 16 | log4j.logger.org.apache.hadoop.hive.ql.exec.FunctionRegistry=ERROR 17 | 18 | log4j.logger.org.eclairjs.nashorn=ERROR -------------------------------------------------------------------------------- /src/main/resources/eclairjs/FloatAccumulatorParam.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | var AccumulableParam = require(EclairJS_Globals.NAMESPACE + '/AccumulableParam'); 23 | var logger = Logger.getLogger("FloatAccumulatorParam_js"); 24 | 25 | /** 26 | * @constructor 27 | * @memberof module:eclairjs 28 | * @extends module:eclairjs.AccumulableParam 29 | */ 30 | var FloatAccumulatorParam = function () { 31 | logger.debug("constructor"); 32 | var jvmObject; 33 | if (arguments.length == 1) { 34 | jvmObject = arguments[0] 35 | } else { 36 | /* 37 | * Note nashorn converts a JavaScript Float to a Java Double. 38 | */ 39 | jvmObject = new org.apache.spark.AccumulatorParam.DoubleAccumulatorParam$(); 40 | } 41 | 42 | AccumulableParam.call(this, jvmObject); 43 | 44 | } 45 | 46 | FloatAccumulatorParam.prototype = Object.create(AccumulableParam.prototype); 47 | 48 | FloatAccumulatorParam.prototype.constructor = FloatAccumulatorParam; 49 | 50 | FloatAccumulatorParam.prototype.convert = function (t1) { 51 | print("convert " + t1) 52 | return parseFloat(t1); 53 | } 54 | 55 | module.exports = FloatAccumulatorParam; 56 | 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/IntAccumulatorParam.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | var AccumulableParam = require(EclairJS_Globals.NAMESPACE + '/AccumulableParam'); 23 | var logger = Logger.getLogger("IntAccumulatorParam_js"); 24 | 25 | /** 26 | * @constructor 27 | * @memberof module:eclairjs 28 | * @extends module:eclairjs.AccumulableParam 29 | */ 30 | var IntAccumulatorParam = function () { 31 | logger.debug("constructor"); 32 | var jvmObject; 33 | if (arguments.length == 1) { 34 | jvmObject = arguments[0] 35 | } else { 36 | jvmObject = new org.apache.spark.AccumulatorParam.IntAccumulatorParam$(); 37 | } 38 | 39 | AccumulableParam.call(this, jvmObject); 40 | 41 | } 42 | 43 | IntAccumulatorParam.prototype = Object.create(AccumulableParam.prototype); 44 | 45 | IntAccumulatorParam.prototype.constructor = IntAccumulatorParam; 46 | 47 | module.exports = IntAccumulatorParam; 48 | 49 | })(); 50 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/JavaWrapper.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 19 | var javaWrapperLogger = Logger.getLogger("JavaWrapper_js"); 20 | 21 | var JavaWrapper = function (jvmObj) { 22 | this._jvmObj = jvmObj; 23 | javaWrapperLogger.debug("JavaWrapper constructor"); 24 | }; 25 | 26 | JavaWrapper.prototype.getJavaObject = function () { 27 | javaWrapperLogger.debug("getJavaObject"); 28 | return this._jvmObj; 29 | }; 30 | 31 | JavaWrapper.prototype.setJavaObject = function (obj) { 32 | javaWrapperLogger.debug("setJavaObject"); 33 | this._jvmObj = obj; 34 | }; 35 | 36 | JavaWrapper.prototype.toString = function () { 37 | return this._jvmObj.toString(); 38 | } 39 | 40 | JavaWrapper.prototype.toJSON = function () { 41 | return this.toString(); 42 | } 43 | 44 | module.exports = JavaWrapper; 45 | 46 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/SparkFiles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 19 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 20 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 21 | 22 | /** 23 | * @constructor 24 | * @memberof module:eclairjs 25 | * @classdesc Resolves paths to files added through SparkContext.addFile(). 26 | */ 27 | var SparkFiles = function () { 28 | 29 | }; 30 | /** 31 | * Get the absolute path of a file added through SparkContext.addFile(). 32 | * @param {string} fileName 33 | * @returns {string} 34 | */ 35 | SparkFiles.get = function (fileName) { 36 | return org.apache.spark.SparkFiles.get(fileName); 37 | }; 38 | /** 39 | * Get the root directory that contains files added through SparkContext.addFile(). 40 | * @param {string} fileName 41 | * @returns {string} 42 | */ 43 | SparkFiles.getRootDirectory = function (fileName) { 44 | return org.apache.spark.SparkFiles.getRootDirectory(fileName); 45 | }; 46 | 47 | module.exports = SparkFiles; 48 | 49 | 50 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/SparkJobInfo.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | var logger = Logger.getLogger("SparkJobInfo_js"); 23 | 24 | 25 | /** 26 | * 27 | * 28 | * @constructor 29 | * @memberof module:eclairjs 30 | */ 31 | var SparkJobInfo = function (jvmObject) { 32 | 33 | JavaWrapper.call(this, jvmObject); 34 | 35 | }; 36 | 37 | SparkJobInfo.prototype = Object.create(JavaWrapper.prototype); 38 | 39 | SparkJobInfo.prototype.constructor = SparkJobInfo; 40 | 41 | 42 | /** 43 | * @returns {number} 44 | */ 45 | SparkJobInfo.prototype.jobId = function () { 46 | return this.getJavaObject().jobId(); 47 | }; 48 | 49 | /** 50 | * @returns {number[]} 51 | */ 52 | SparkJobInfo.prototype.stageIds = function () { 53 | return this.getJavaObject().stageIds(); 54 | }; 55 | 56 | 57 | /** 58 | * @returns {JobExecutionStatus} 59 | */ 60 | SparkJobInfo.prototype.status = function () { 61 | throw "not implemented by ElairJS"; 62 | // var javaObject = this.getJavaObject().status(); 63 | // return new JobExecutionStatus(javaObject); 64 | }; 65 | 66 | 67 | 68 | module.exports = SparkJobInfo; 69 | 70 | })(); 71 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/Tuple2.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | 19 | /** 20 | * @classdesc 21 | * @param {object} obj 22 | * @param {object} obj 23 | * @constructor Tuple2 24 | * @memberof module:eclairjs 25 | */ 26 | 27 | var Tuple2 = Java.type('org.eclairjs.nashorn.wrap.Tuple2'); 28 | 29 | /** 30 | * 31 | * @function 32 | * @name module:eclairjs.Tuple2#_1 33 | * @returns {object} 34 | */ 35 | 36 | /** 37 | * 38 | * @function 39 | * @name module:eclairjs.Tuple2#_2 40 | * @returns {object} 41 | */ 42 | 43 | 44 | 45 | module.exports = Tuple2; 46 | 47 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/Tuple3.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | 19 | /** 20 | * @classdesc 21 | * @param {object} obj 22 | * @param {object} obj 23 | * @constructor Tuple3 24 | * @memberof module:eclairjs 25 | */ 26 | var Tuple3 = Java.type('org.eclairjs.nashorn.wrap.Tuple3'); 27 | 28 | /** 29 | * 30 | * @function 31 | * @name module:eclairjs.Tuple3#_1 32 | * @returns {object} 33 | */ 34 | 35 | /** 36 | * 37 | * @function 38 | * @name module:eclairjs.Tuple3#_2 39 | * @returns {object} 40 | */ 41 | 42 | /** 43 | * 44 | * @function 45 | * @name module:eclairjs.Tuple3#_3 46 | * @returns {object} 47 | */ 48 | 49 | 50 | module.exports = Tuple3; 51 | 52 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/Tuple4.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | /** 19 | * @classdesc 20 | * @param {object} obj 21 | * @param {object} obj 22 | * @constructor Tuple4 23 | * @memberof module:eclairjs 24 | */ 25 | var Tuple4 = Java.type('org.eclairjs.nashorn.wrap.Tuple4'); 26 | 27 | /** 28 | * 29 | * @function 30 | * @name module:eclairjs.Tuple4#_1 31 | * @returns {object} 32 | */ 33 | 34 | /** 35 | * 36 | * @function 37 | * @name module:eclairjs.Tuple4#_2 38 | * @returns {object} 39 | */ 40 | 41 | /** 42 | * 43 | * @function 44 | * @name module:eclairjs.Tuple4#_3 45 | * @returns {object} 46 | */ 47 | 48 | /** 49 | * 50 | * @function 51 | * @name module:eclairjs.Tuple4#_4 52 | * @returns {object} 53 | */ 54 | 55 | module.exports = Tuple4; 56 | 57 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/Tuple5.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | /** 19 | * @classdesc 20 | * @param {object} obj 21 | * @param {object} obj 22 | * @constructor Tuple5 23 | * @memberof module:eclairjs 24 | */ 25 | var Tuple5 = Java.type('org.eclairjs.nashorn.wrap.Tuple5'); 26 | 27 | /** 28 | * 29 | * @function 30 | * @name module:eclairjs.Tuple5#_1 31 | * @returns {object} 32 | */ 33 | 34 | /** 35 | * 36 | * @function 37 | * @name module:eclairjs.Tuple5#_2 38 | * @returns {object} 39 | */ 40 | 41 | /** 42 | * 43 | * @function 44 | * @name module:eclairjs.Tuple5#_3 45 | * @returns {object} 46 | */ 47 | 48 | /** 49 | * 50 | * @function 51 | * @name module:eclairjs.Tuple5#_4 52 | * @returns {object} 53 | */ 54 | 55 | /** 56 | * 57 | * @function 58 | * @name module:eclairjs.Tuple5#_5 59 | * @returns {object} 60 | */ 61 | 62 | module.exports = Tuple5; 63 | 64 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/broadcast.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * broadcast module. 4 | * @example 5 | * var broadcast = require('eclairjs/broadcast'); 6 | * @module eclairjs/broadcast 7 | */ 8 | module.exports = { 9 | Broadcast: require(EclairJS_Globals.NAMESPACE + '/broadcast/Broadcast'), 10 | TorrentBroadcast: require(EclairJS_Globals.NAMESPACE + '/broadcast/TorrentBroadcast') 11 | /* 12 | Factories are implementation of BroadcastFactory that is invoked by SparkContext.broadcast. 13 | So they will not be implemented in JavaScript 14 | */ 15 | // HttpBroadcastFactory: require(EclairJS_Globals.NAMESPACE + '/broadcast/HttpBroadcastFactory'), 16 | // TorrentBroadcastFactory: require(EclairJS_Globals.NAMESPACE + '/broadcast/TorrentBroadcastFactory') 17 | } 18 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/broadcast/TorrentBroadcast.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | var Broadcast = require(EclairJS_Globals.NAMESPACE + '/broadcast/Broadcast'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | var logger = Logger.getLogger("broadcast_TorrentBroadcast_js"); 23 | 24 | 25 | /** 26 | * @classdesc 27 | * A broadcast variable. Broadcast variables allow the programmer to keep a read-only variable 28 | * cached on each machine rather than shipping a copy of it with tasks. They can be used, for 29 | * example, to give every node a copy of a large input dataset in an efficient manner. Spark also 30 | * attempts to distribute broadcast variables using efficient broadcast algorithms to reduce 31 | * communication cost. 32 | * 33 | * 34 | * @class 35 | * @memberof module:eclairjs/broadcast 36 | * @extends module:eclairjs/broadcast.Broadcast 37 | */ 38 | 39 | var TorrentBroadcast = function (jvmObject) { 40 | Broadcast.call(this, jvmObject); 41 | 42 | }; 43 | 44 | TorrentBroadcast.prototype = Object.create(Broadcast.prototype); 45 | 46 | TorrentBroadcast.prototype.constructor = TorrentBroadcast; 47 | 48 | 49 | module.exports = TorrentBroadcast; 50 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * ml feature module. 19 | * @example 20 | * var param = require('eclairjs/ml'); 21 | * @module eclairjs/ml 22 | */ 23 | module.exports = { 24 | Model: require(EclairJS_Globals.NAMESPACE + '/ml/Model'), 25 | Transformer: require(EclairJS_Globals.NAMESPACE + '/ml/Transformer'), 26 | Estimator: require(EclairJS_Globals.NAMESPACE + '/ml/Estimator'), 27 | Pipeline: require(EclairJS_Globals.NAMESPACE + '/ml/Pipeline'), 28 | PipelineModel: require(EclairJS_Globals.NAMESPACE + '/ml/PipelineModel'), 29 | PipelineStage: require(EclairJS_Globals.NAMESPACE + '/ml/PipelineStage'), 30 | Predictor: require(EclairJS_Globals.NAMESPACE + '/ml/Predictor'), 31 | PredictionModel: require(EclairJS_Globals.NAMESPACE + '/ml/PredictionModel'), 32 | UnaryTransformer: require(EclairJS_Globals.NAMESPACE + '/ml/UnaryTransformer') 33 | } 34 | 35 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/attribute.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * ml attribute module. 4 | * @example 5 | * var attribute = require('eclairjs/ml/attribute'); 6 | * @module eclairjs/ml/attribute 7 | */ 8 | module.exports = { 9 | NumericAttribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/NumericAttribute'), 10 | Attribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/Attribute'), 11 | // NominalAttribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/NominalAttribute'), 12 | AttributeGroup: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/AttributeGroup') 13 | // NominalAttribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/NominalAttribute'), 14 | // AttributeType: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/AttributeType'), 15 | // BinaryAttribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/BinaryAttribute'), 16 | // AttributeType: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/AttributeType'), 17 | // AttributeGroup: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/AttributeGroup'), 18 | // BinaryAttribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/BinaryAttribute'), 19 | // NumericAttribute: require(EclairJS_Globals.NAMESPACE + '/ml/attribute/NumericAttribute') 20 | } 21 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/attribute/Attribute.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | 23 | 24 | 25 | /** 26 | * @classdesc 27 | * Abstract class for ML attributes. 28 | * @class 29 | * @memberof module:eclairjs/ml/attribute 30 | */ 31 | 32 | /** 33 | * @constructor 34 | */ 35 | var Attribute = function(jvmObject) { 36 | // this.logger = Logger.getLogger("Attribute_js"); 37 | JavaWrapper.call(this, jvmObject); 38 | 39 | }; 40 | 41 | Attribute.prototype = Object.create(JavaWrapper.prototype); 42 | 43 | Attribute.prototype.constructor = Attribute; 44 | 45 | 46 | 47 | module.exports = Attribute; 48 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/clustering.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * ml clustering module. 20 | * @module eclairjs/ml/clustering 21 | */ 22 | module.exports = { 23 | LDA: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/LDA'), 24 | LDAModel: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/LDAModel'), 25 | LocalLDAModel: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/LocalLDAModel'), 26 | DistributedLDAModel: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/DistributedLDAModel'), 27 | KMeans: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/KMeans'), 28 | KMeansModel: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/KMeansModel'), 29 | BisectingKMeans: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/BisectingKMeans'), 30 | BisectingKMeansModel: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/BisectingKMeansModel'), 31 | GaussianMixture: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/GaussianMixture'), 32 | GaussianMixtureModel: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/GaussianMixtureModel'), 33 | GaussianMixtureSummary: require(EclairJS_Globals.NAMESPACE + '/ml/clustering/GaussianMixtureSummary') 34 | 35 | } 36 | 37 | })(); 38 | 39 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/evaluation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * ml feature module. 20 | * @example 21 | * var evaluation = require('eclairjs/ml/evaluation'); 22 | * @module eclairjs/ml/evaluation 23 | */ 24 | module.exports = { 25 | BinaryClassificationEvaluator: require(EclairJS_Globals.NAMESPACE + '/ml/evaluation/BinaryClassificationEvaluator'), 26 | //Evaluator: require(EclairJS_Globals.NAMESPACE + '/ml/evaluation/Evaluator'), 27 | RegressionEvaluator: require(EclairJS_Globals.NAMESPACE + '/ml/evaluation/RegressionEvaluator'), 28 | MulticlassClassificationEvaluator: require(EclairJS_Globals.NAMESPACE + '/ml/evaluation/MulticlassClassificationEvaluator') 29 | } 30 | 31 | })(); 32 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/linalg/DenseVector.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | /** 19 | * A dense vector represented by a value array. 20 | * @classdesc 21 | */ 22 | 23 | /** 24 | * @param {number[]} values 25 | * @class DenseVector 26 | * @memberof module:eclairjs/ml/linalg 27 | * @extends module:eclairjs/ml/linalg.Vector 28 | */ 29 | var DenseVector = Java.type('org.eclairjs.nashorn.wrap.ml.linalg.DenseVector'); 30 | 31 | 32 | /** 33 | * @function 34 | * @name module:eclairjs/ml/linalg.DenseVector#values 35 | * @returns {number[]} 36 | */ 37 | 38 | 39 | module.exports = DenseVector; 40 | 41 | })(); 42 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/linalg/SparseVector.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | /** 19 | * A sparse vector represented by an index array and an value array. 20 | * 21 | * @param size size of the vector. 22 | * @param indices index array, assume to be strictly increasing. 23 | * @param values value array, must have the same length as the index array. 24 | * @classdesc 25 | */ 26 | 27 | 28 | /** 29 | * @param {integer} size 30 | * @param {integer[]} indices 31 | * @param {float[]} values 32 | * @class SparseVector 33 | * @memberof module:eclairjs/ml/linalg 34 | * @extends module:eclairjs/ml/linalg.Vector 35 | */ 36 | var SparseVector = Java.type('org.eclairjs.nashorn.wrap.ml.linalg.SparseVector'); 37 | 38 | /** 39 | * @function 40 | * @name module:eclairjs/ml/linalg.SparseVector#indices 41 | * @returns {integer[]} 42 | */ 43 | 44 | 45 | /** 46 | * @function 47 | * @name module:eclairjs/ml/linalg.SparseVector#values 48 | * @returns {module:eclairjs.Tuple2} 49 | */ 50 | 51 | 52 | module.exports = SparseVector; 53 | 54 | })(); 55 | 56 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/param.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | (function () { 19 | /** 20 | * ml feature module. 21 | * @example 22 | * var param = require('eclairjs/ml/param'); 23 | * @module eclairjs/ml/param 24 | */ 25 | module.exports = { 26 | Param: require(EclairJS_Globals.NAMESPACE + '/ml/param/Param'), 27 | BooleanParam: require(EclairJS_Globals.NAMESPACE + '/ml/param/BooleanParam'), 28 | DoubleParam: require(EclairJS_Globals.NAMESPACE + '/ml/param/DoubleParam'), 29 | IntParam: require(EclairJS_Globals.NAMESPACE + '/ml/param/IntParam'), 30 | IntArrayParam: require(EclairJS_Globals.NAMESPACE + '/ml/param/IntArrayParam'), 31 | StringArrayParam: require(EclairJS_Globals.NAMESPACE + '/ml/param/StringArrayParam'), 32 | ParamPair: require(EclairJS_Globals.NAMESPACE + '/ml/param/ParamPair'), 33 | ParamMap: require(EclairJS_Globals.NAMESPACE + '/ml/param/ParamMap') 34 | } 35 | 36 | })(); 37 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/param/BooleanParam.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 19 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 20 | var Param = require(EclairJS_Globals.NAMESPACE + '/ml/param/Param'); 21 | 22 | 23 | /** 24 | * @param {string} parent 25 | * @param {string} name 26 | * @param {string} doc 27 | * @class 28 | * @extends module:eclairjs/ml/param.Param 29 | * @memberof module:eclairjs/ml/param 30 | */ 31 | var BooleanParam = function (parent, name, doc) { 32 | var jvmObject; 33 | if (arguments[0] instanceof org.apache.spark.ml.param.BooleanParam) { 34 | jvmObject = arguments[0]; 35 | } else { 36 | jvmObject = new org.apache.spark.ml.param.BooleanParam(parent, name, doc); 37 | } 38 | 39 | this.logger = Logger.getLogger("BooleanParam_js"); 40 | Param.call(this, jvmObject); 41 | 42 | }; 43 | 44 | BooleanParam.prototype = Object.create(Param.prototype); 45 | 46 | BooleanParam.prototype.constructor = BooleanParam; 47 | 48 | 49 | 50 | module.exports = BooleanParam; 51 | 52 | })(); 53 | 54 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/param/DoubleParam.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 19 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 20 | var Param = require(EclairJS_Globals.NAMESPACE + '/ml/param/Param'); 21 | 22 | 23 | /** 24 | * @param {string} parent 25 | * @param {string} name 26 | * @param {string} doc 27 | * @class 28 | * @extends module:eclairjs/ml/param.Param 29 | * @memberof module:eclairjs/ml/param 30 | */ 31 | var DoubleParam = function (parent, name, doc) { 32 | var jvmObject; 33 | if (arguments[0] instanceof org.apache.spark.ml.param.DoubleParam) { 34 | jvmObject = arguments[0]; 35 | } else { 36 | jvmObject = new org.apache.spark.ml.param.DoubleParam(parent, name, doc); 37 | } 38 | 39 | this.logger = Logger.getLogger("DoubleParam_js"); 40 | Param.call(this, jvmObject); 41 | 42 | }; 43 | 44 | DoubleParam.prototype = Object.create(Param.prototype); 45 | 46 | DoubleParam.prototype.constructor = DoubleParam; 47 | 48 | 49 | 50 | module.exports = DoubleParam; 51 | 52 | })(); 53 | 54 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/param/IntParam.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 19 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 20 | var Param = require(EclairJS_Globals.NAMESPACE + '/ml/param/Param'); 21 | 22 | 23 | /** 24 | * @param {string} parent 25 | * @param {string} name 26 | * @param {string} doc 27 | * @class 28 | * @extends module:eclairjs/ml/param.Param 29 | * @memberof module:eclairjs/ml/param 30 | */ 31 | var IntParam = function (parent, name, doc) { 32 | var jvmObject; 33 | if (arguments[0] instanceof org.apache.spark.ml.param.IntParam) { 34 | jvmObject = arguments[0]; 35 | } else { 36 | jvmObject = new org.apache.spark.ml.param.IntParam(parent, name, doc); 37 | } 38 | 39 | this.logger = Logger.getLogger("IntParam_js"); 40 | Param.call(this, jvmObject); 41 | 42 | }; 43 | 44 | IntParam.prototype = Object.create(Param.prototype); 45 | 46 | IntParam.prototype.constructor = IntParam; 47 | 48 | 49 | 50 | module.exports = IntParam; 51 | 52 | })(); 53 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/param/ParamPair.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 19 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 20 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 21 | 22 | 23 | /** 24 | * A param and its value. 25 | * @classdesc 26 | * @param {module:eclairjs/ml/param.Param} param 27 | * @param {object} value 28 | * @class 29 | * @memberof module:eclairjs/ml/param 30 | */ 31 | var ParamPair = function (param, value) { 32 | var jvmObject; 33 | if (arguments[0] instanceof org.apache.spark.ml.param.ParamPair) { 34 | jvmObject = arguments[0]; 35 | } else { 36 | jvmObject = new org.apache.spark.ml.param.ParamPair(param, value); 37 | } 38 | this.logger = Logger.getLogger("ParamPair_js"); 39 | JavaWrapper.call(this, jvmObject); 40 | 41 | }; 42 | 43 | ParamPair.prototype = Object.create(JavaWrapper.prototype); 44 | 45 | ParamPair.prototype.constructor = ParamPair; 46 | 47 | module.exports = ParamPair; 48 | 49 | })(); 50 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/param/StringArrayParam.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 19 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 20 | var Param = require(EclairJS_Globals.NAMESPACE + '/ml/param/Param'); 21 | 22 | 23 | /** 24 | * @param {string} parent 25 | * @param {string} name 26 | * @param {string} doc 27 | * @class 28 | * @extends module:eclairjs/ml/param.Param 29 | * @memberof module:eclairjs/ml/param 30 | */ 31 | var StringArrayParam = function (parent, name, doc) { 32 | var jvmObject; 33 | if (arguments[0] instanceof org.apache.spark.ml.param.StringArrayParam) { 34 | jvmObject = arguments[0]; 35 | } else { 36 | jvmObject = new org.apache.spark.ml.param.StringArrayParam(parent, name, doc); 37 | } 38 | 39 | this.logger = Logger.getLogger("StringArrayParam_js"); 40 | Param.call(this, jvmObject); 41 | 42 | }; 43 | 44 | StringArrayParam.prototype = Object.create(Param.prototype); 45 | 46 | StringArrayParam.prototype.constructor = StringArrayParam; 47 | 48 | 49 | 50 | module.exports = StringArrayParam; 51 | 52 | })(); 53 | 54 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/recommendation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * ml feature module. 20 | * @example 21 | * var recommendation = require('eclairjs/ml/recommendation'); 22 | * @module eclairjs/ml/recommendation 23 | */ 24 | module.exports = { 25 | ALS: require(EclairJS_Globals.NAMESPACE + '/ml/recommendation/ALS'), 26 | ALSModel: require(EclairJS_Globals.NAMESPACE + '/ml/recommendation/ALSModel') 27 | } 28 | 29 | })(); 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/regression/RegressionModel.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | var PredictionModel = require(EclairJS_Globals.NAMESPACE + '/ml/PredictionModel'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | 23 | 24 | 25 | /** 26 | * @classdesc 27 | * 28 | * Model 29 | * 30 | * @class 31 | * @memberof module:eclairjs/ml/regression 32 | * @extends module:eclairjs/ml.PredictionModel 33 | */ 34 | 35 | var RegressionModel = function(jvmObject) { 36 | this.logger = Logger.getLogger("RegressionModel_js"); 37 | PredictionModel.call(this, jvmObject); 38 | 39 | }; 40 | 41 | RegressionModel.prototype = Object.create(PredictionModel.prototype); 42 | 43 | RegressionModel.prototype.constructor = RegressionModel; 44 | 45 | 46 | module.exports = RegressionModel; 47 | 48 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/tuning.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * ml tuning module. 4 | * @example 5 | * var tuning = require('eclairjs/ml/tuning'); 6 | * @module eclairjs/ml/tuning 7 | */ 8 | module.exports = { 9 | CrossValidator: require(EclairJS_Globals.NAMESPACE + '/ml/tuning/CrossValidator'), 10 | CrossValidatorModel: require(EclairJS_Globals.NAMESPACE + '/ml/tuning/CrossValidatorModel'), 11 | ParamGridBuilder: require(EclairJS_Globals.NAMESPACE + '/ml/tuning/ParamGridBuilder'), 12 | TrainValidationSplit: require(EclairJS_Globals.NAMESPACE + '/ml/tuning/TrainValidationSplit') 13 | TrainValidationSplitModel: require(EclairJS_Globals.NAMESPACE + '/ml/tuning/TrainValidationSplitModel') 14 | } 15 | })(); 16 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/ml/util.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * ml util module. 4 | * @example 5 | * var util = require('eclairjs/ml/util'); 6 | * @module eclairjs/ml/util 7 | */ 8 | module.exports = { 9 | MLWritable: require(EclairJS_Globals.NAMESPACE + '/ml/util/MLWritable'), 10 | MLWriter: require(EclairJS_Globals.NAMESPACE + '/ml/util/MLWriter'), 11 | MLReader: require(EclairJS_Globals.NAMESPACE + '/ml/util/MLReader'), 12 | // MLReadable: require(EclairJS_Globals.NAMESPACE + '/ml/util/MLReadable'), 13 | DefaultParamsWritable: require(EclairJS_Globals.NAMESPACE + '/ml/util/DefaultParamsWritable') 14 | } 15 | })(); 16 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib module. 20 | * @example 21 | * var mllib = require('eclairjs/mllib'); 22 | * @module eclairjs/mllib 23 | */ 24 | module.exports = { 25 | MLUtils: require(EclairJS_Globals.NAMESPACE + '/mllib/MLUtils') 26 | } 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/MLUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 18 | /** 19 | * @class 20 | * @memberof module:eclairjs/mllib 21 | */ 22 | var MLUtils = function(){}; 23 | 24 | MLUtils.loadLibSVMFile = function (sc, 25 | path, 26 | numFeatures, 27 | minPartitions, 28 | multiclass) { 29 | if (arguments.length == 2) { 30 | return Utils.javaToJs(org.apache.spark.mllib.util.MLUtils.loadLibSVMFile( 31 | sc.getJavaObject().sc(), 32 | path).toJavaRDD() 33 | ); 34 | } 35 | } 36 | 37 | /** 38 | * Returns a new vector with 1.0 (bias) appended to the input vector. 39 | * @param {module:eclairjs/mllib/linalg.Vector} vector 40 | */ 41 | MLUtils.appendBias = function (vector) { 42 | return new Utils.javaToJs(org.apache.spark.mllib.util.MLUtils.appendBias(Utils.unwrapObject(vector))); 43 | } 44 | 45 | module.exports = MLUtils; 46 | 47 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/classification.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib classification module. 20 | * @example 21 | * var mllibClassif = require('eclairjs/mllib/classification'); 22 | * @module eclairjs/mllib/classification 23 | */ 24 | module.exports = { 25 | ClassificationModel: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/ClassificationModel'), 26 | LogisticRegressionModel: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/LogisticRegressionModel'), 27 | LogisticRegressionWithSGD: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/LogisticRegressionWithSGD'), 28 | LogisticRegressionWithLBFGS: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/LogisticRegressionWithLBFGS'), 29 | NaiveBayes: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/NaiveBayes'), 30 | NaiveBayesModel: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/NaiveBayesModel'), 31 | SVMModel: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/SVMModel'), 32 | SVMWithSGD: require(EclairJS_Globals.NAMESPACE + '/mllib/classification/SVMWithSGD') 33 | } 34 | })(); 35 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/evaluation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib evaluation module. 20 | * @example 21 | * var mllibEval = require('eclairjs/mllib/evaluation'); 22 | * @module eclairjs/mllib/evaluation 23 | */ 24 | module.exports = { 25 | BinaryClassificationMetrics: require(EclairJS_Globals.NAMESPACE + '/mllib/evaluation/BinaryClassificationMetrics'), 26 | MulticlassMetrics: require(EclairJS_Globals.NAMESPACE + '/mllib/evaluation/MulticlassMetrics'), 27 | MultilabelMetrics: require(EclairJS_Globals.NAMESPACE + '/mllib/evaluation/MultilabelMetrics'), 28 | RankingMetrics: require(EclairJS_Globals.NAMESPACE + '/mllib/evaluation/RankingMetrics'), 29 | RegressionMetrics: require(EclairJS_Globals.NAMESPACE + '/mllib/evaluation/RegressionMetrics') 30 | } 31 | })(); 32 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/feature.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib feature module. 20 | * @example 21 | * var mllibFeature = require('eclairjs/mllib/feature'); 22 | * @module eclairjs/mllib/feature 23 | */ 24 | module.exports = { 25 | Word2Vec: require(EclairJS_Globals.NAMESPACE + '/mllib/feature/Word2Vec'), 26 | Word2VecModel: require(EclairJS_Globals.NAMESPACE + '/mllib/feature/Word2VecModel') 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/fpm.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib fpm module. 20 | * @example 21 | * var mllibFPM = require('eclairjs/mllib/fpm'); 22 | * @module eclairjs/mllib/fpm 23 | */ 24 | module.exports = { 25 | AssociationRules: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/AssociationRules'), 26 | FPGrowth: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/FPGrowth'), 27 | FPGrowthModel: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/FPGrowthModel'), 28 | FreqItemset: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/FreqItemset'), 29 | PrefixSpan: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/PrefixSpan'), 30 | PrefixSpanFreqSequence: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/PrefixSpanFreqSequence'), 31 | PrefixSpanModel: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/PrefixSpanModel'), 32 | Rule: require(EclairJS_Globals.NAMESPACE + '/mllib/fpm/Rule') 33 | } 34 | })(); 35 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/linalg/distributed.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib linalg distributed module. 20 | * @example 21 | * var mllibDistrib = require('eclairjs/mllib/linalg/distributed'); 22 | * var rm = new mllibDistrib.RowMatrix(...); 23 | * @module eclairjs/mllib/linalg/distributed 24 | */ 25 | module.exports = { 26 | DistributedMatrix: require(EclairJS_Globals.NAMESPACE + '/mllib/linalg/distributed/DistributedMatrix'), 27 | RowMatrix: require(EclairJS_Globals.NAMESPACE + '/mllib/linalg/distributed/RowMatrix') 28 | } 29 | })(); 30 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/optimization.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib optimization module. 20 | * @example 21 | * var mllibOptimization = require('eclairjs/mllib/optimization'); 22 | * @module eclairjs/mllib/optimization 23 | */ 24 | module.exports = { 25 | Gradient: require(EclairJS_Globals.NAMESPACE + '/mllib/optimization/Gradient'), 26 | LBFGS: require(EclairJS_Globals.NAMESPACE + '/mllib/optimization/LBFGS'), 27 | LogisticGradient: require(EclairJS_Globals.NAMESPACE + '/mllib/optimization/LogisticGradient'), 28 | SquaredL2Updater: require(EclairJS_Globals.NAMESPACE + '/mllib/optimization/SquaredL2Updater'), 29 | Updater: require(EclairJS_Globals.NAMESPACE + '/mllib/optimization/Updater') 30 | } 31 | })(); 32 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/random.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib recommendation module. 20 | * @example 21 | * var random = require('eclairjs/mllib/random'); 22 | * @module eclairjs/mllib/random 23 | */ 24 | module.exports = { 25 | RandomRDDs: require(EclairJS_Globals.NAMESPACE + '/mllib/random/RandomRDDs') 26 | 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/recommendation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib recommendation module. 20 | * @example 21 | * var recommendation = require('eclairjs/mllib/recommendation'); 22 | * @module eclairjs/mllib/recommendation 23 | */ 24 | module.exports = { 25 | ALS: require(EclairJS_Globals.NAMESPACE + '/mllib/recommendation/ALS'), 26 | MatrixFactorizationModel: require(EclairJS_Globals.NAMESPACE + '/mllib/recommendation/MatrixFactorizationModel'), 27 | Rating: require(EclairJS_Globals.NAMESPACE + '/mllib/recommendation/Rating') 28 | 29 | } 30 | })(); 31 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/recommendation/Rating.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | (function () { 18 | 19 | 20 | 21 | /** 22 | * A more class to represent a rating than array[Int, Int, float]. 23 | * @classdesc 24 | */ 25 | 26 | /** 27 | * @param {integer} user 28 | * @param {integer} product 29 | * @param {float} rating 30 | * @class Rating 31 | * @memberof module:eclairjs/mllib/recommendation 32 | */ 33 | var Rating = Java.type('org.eclairjs.nashorn.wrap.mllib.recommendation.Rating'); 34 | 35 | /** 36 | * @function module:eclairjs/mllib/recommendation.Rating#user 37 | * @returns {integer} 38 | */ 39 | 40 | /** 41 | * @function module:eclairjs/mllib/recommendation.Rating#product 42 | * @returns {integer} 43 | */ 44 | 45 | /** 46 | * @function module:eclairjs/mllib/recommendation.Rating#rating 47 | * @returns {float} 48 | */ 49 | 50 | module.exports = Rating; 51 | 52 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/regression.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib regression module. 20 | * @example 21 | * var mllibRegress = require('eclairjs/mllib/regression'); 22 | * var mllibLinalg = require('eclairjs/mllib/linalg'); 23 | * var lp = new mllibRegress.LabeledPoint(0, new DenseVector([0.0, 0.1, 0.2])); 24 | * @module eclairjs/mllib/regression 25 | */ 26 | module.exports = { 27 | GeneralizedLinearModel: require(EclairJS_Globals.NAMESPACE + '/mllib/regression/GeneralizedLinearModel'), 28 | IsotonicRegression: require(EclairJS_Globals.NAMESPACE + '/mllib/regression/IsotonicRegression').IsotonicRegression, 29 | IsotonicRegressionModel: require(EclairJS_Globals.NAMESPACE + '/mllib/regression/IsotonicRegression').IsotonicRegressionModel, 30 | LabeledPoint: require(EclairJS_Globals.NAMESPACE + '/mllib/regression/LabeledPoint'), 31 | LinearRegressionModel: require(EclairJS_Globals.NAMESPACE + '/mllib/regression/LinearRegressionModel'), 32 | LinearRegressionWithSGD: require(EclairJS_Globals.NAMESPACE + '/mllib/regression/LinearRegressionWithSGD') 33 | } 34 | })(); 35 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/regression/GeneralizedLinearModel.js: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2015 IBM Corp. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | 19 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 22 | 23 | /** 24 | * @constructor 25 | * @memberof module:eclairjs/mllib/regression 26 | * @classdesc GeneralizedLinearModel (GLM) represents a model trained using GeneralizedLinearAlgorithm. 27 | * GLMs consist of a weight vector and an intercept. 28 | * @param {module:eclairjs/mllib/linalg.Vector} weights 29 | * @param {float} intercept 30 | */ 31 | var GeneralizedLinearModel = function(jvmObj) { 32 | this.logger = Logger.getLogger("mllib.regression.GeneralizedLinearModel_js"); 33 | 34 | JavaWrapper.call(this, jvmObj); 35 | }; 36 | 37 | GeneralizedLinearModel.prototype = Object.create(JavaWrapper.prototype); 38 | 39 | GeneralizedLinearModel.prototype.constructor = GeneralizedLinearModel; 40 | /** 41 | * Predict values for a single data point using the model trained. 42 | * @param {module:eclairjs/mllib/linalg.Vector} testData 43 | * @returns {float} 44 | */ 45 | GeneralizedLinearModel.prototype.predict = function(testData) { 46 | 47 | return this.getJavaObject().predict(Utils.unwrapObject(testData)); 48 | }; 49 | 50 | module.exports = GeneralizedLinearModel; 51 | 52 | })(); 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/regression/LinearRegressionModel.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 19 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 20 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 21 | 22 | /** 23 | * @constructor 24 | * @memberof module:eclairjs/mllib/regression 25 | * @classdesc Model produced by LinearRegression. 26 | */ 27 | var LinearRegressionModel = function (jvmObj) { 28 | this.logger = Logger.getLogger("mllib.regression.LinearRegressionModel_js"); 29 | 30 | JavaWrapper.call(this, jvmObj); 31 | }; 32 | 33 | LinearRegressionModel.prototype = Object.create(JavaWrapper.prototype); 34 | 35 | LinearRegressionModel.prototype.constructor = LinearRegressionModel; 36 | /** 37 | * Predict label for the given features. 38 | * @param {module:eclairjs/mllib/linalg.Vector} features 39 | * @returns {float} 40 | */ 41 | LinearRegressionModel.prototype.predict = function (features) { 42 | 43 | var p = this.getJavaObject().predict(Utils.unwrapObject(features)); 44 | this.logger.debug("p " + p); 45 | return p; 46 | }; 47 | 48 | module.exports = LinearRegressionModel; 49 | 50 | })(); 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/tree.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * mllib tree module. 20 | * @example 21 | * var tree = require('eclairjs/mllib/tree'); 22 | * var dv = new tree.RandomForest(); 23 | * @module eclairjs/mllib/tree 24 | */ 25 | module.exports = { 26 | DecisionTree: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/DecisionTree'), 27 | GradientBoostedTrees: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/GradientBoostedTrees'), 28 | RandomForest: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/RandomForest') 29 | 30 | } 31 | })(); 32 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/tree/configuration.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * configuration module. 19 | * @example 20 | * var configuration = require('eclairjs/mllib/tree/configuration'); 21 | * var at = new configuration.BoostingStrategy(); 22 | * @module eclairjs/mllib/tree/configuration 23 | */ 24 | module.exports = { 25 | BoostingStrategy: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/configuration/BoostingStrategy'), 26 | Strategy: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/configuration/Strategy') 27 | 28 | } 29 | })(); 30 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/tree/loss.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * model module. 19 | * @example 20 | * var loss = require('eclairjs/mllib/tree/loss'); 21 | * var at = new loss.Loass(); 22 | * @module eclairjs/mllib/tree/loss 23 | */ 24 | module.exports = { 25 | Loss: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/loss/Loss') 26 | 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/mllib/tree/model.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * model module. 19 | * @example 20 | * var model = require('eclairjs/mllib/tree/model'); 21 | * var at = new model.DecisionTreeModel(); 22 | * @module eclairjs/mllib/tree/model 23 | */ 24 | module.exports = { 25 | DecisionTreeModel: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/model/DecisionTreeModel'), 26 | GradientBoostedTreesModel: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/model/GradientBoostedTreesModel'), 27 | RandomForestModel: require(EclairJS_Globals.NAMESPACE + '/mllib/tree/model/RandomForestModel'), 28 | 29 | } 30 | })(); 31 | 32 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/partial.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * partial module. 19 | * @example 20 | * var partial = require('eclairjs/partial'); 21 | * @module eclairjs/partial 22 | */ 23 | module.exports = { 24 | PartialResult: require(EclairJS_Globals.NAMESPACE + '/partial/PartialResult') 25 | } 26 | })(); 27 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/DataFrameHolder.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 19 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 20 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 21 | var logger = Logger.getLogger("sql.DataFrameHolder_js"); 22 | 23 | /** 24 | * @constructor 25 | * @memberof module:eclairjs/sql 26 | * @classdesc A container for a DataFrame, used for implicit conversions. 27 | */ 28 | var DataFrameHolder = function (jvmDataFrame) { 29 | JavaWrapper.call(this, jvmDataFrame); 30 | 31 | // Initialize our Row-specific properties 32 | }; 33 | 34 | DataFrameHolder.prototype = Object.create(JavaWrapper.prototype); 35 | 36 | DataFrameHolder.prototype.constructor = DataFrameHolder; 37 | 38 | /** 39 | * @returns {module:eclairjs/sql.DataFrame} 40 | */ 41 | DataFrameHolder.prototype.toDF = function () { 42 | return Utils.javaToJs(this.getJavaObject().toDF()); 43 | }; 44 | 45 | module.exports = DataFrameHolder; 46 | 47 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/execution.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * sql/execution types module. 19 | * @example 20 | * var execution = require('eclairjs/sql/execution'); 21 | * @module eclairjs/sql/execution 22 | */ 23 | module.exports = { 24 | QueryExecution: require(EclairJS_Globals.NAMESPACE + '/sql/execution/QueryExecution') 25 | 26 | } 27 | })(); 28 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/streaming.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * sql streaming module. 4 | * @example 5 | * var streaming = require('eclairjs/sql/streaming'); 6 | * @module eclairjs/sql/streaming 7 | */ 8 | module.exports = { 9 | StreamingQueryManager: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/StreamingQueryManager'), 10 | // StreamingQueryException: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/StreamingQueryException'), 11 | StreamingQueryListener: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/StreamingQueryListener'), 12 | SinkStatus: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/SinkStatus'), 13 | // Trigger: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/Trigger'), 14 | ProcessingTime: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/ProcessingTime'), 15 | StreamingQueryInfo: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/StreamingQueryInfo'), 16 | StreamingQuery: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/StreamingQuery'), 17 | ProcessingTime: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/ProcessingTime'), 18 | DataStreamWriter: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/DataStreamWriter'), 19 | DataStreamReader: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/DataStreamReader'), 20 | SourceStatus: require(EclairJS_Globals.NAMESPACE + '/sql/streaming/SourceStatus') 21 | } 22 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/streaming/SinkStatus.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var SinkStatus = Java.type('org.eclairjs.nashorn.wrap.sql.streaming.SinkStatus'); 19 | 20 | 21 | /** 22 | * @classdesc 23 | * Status and metrics of a streaming {@link Sink}. 24 | * 25 | * @since EclairJS 0.7 Spark 2.0.0 26 | * @class SinkStatus 27 | * @memberof module:eclairjs/sql/streaming 28 | */ 29 | 30 | /** 31 | * 32 | * 33 | * @function 34 | * @name module:eclairjs/sql/streaming.SinkStatus#description 35 | * @since EclairJS 0.7 Spark 2.0.0 36 | * @returns {string} 37 | */ 38 | 39 | /** 40 | * 41 | * 42 | * @function 43 | * @name module:eclairjs/sql/streaming.SinkStatus#offsetDesc 44 | * @since EclairJS 0.7 Spark 2.0.0 45 | * @returns {string} 46 | */ 47 | 48 | 49 | module.exports = SinkStatus; 50 | 51 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/streaming/SourceStatus.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var SourceStatus = Java.type('org.eclairjs.nashorn.wrap.sql.streaming.SourceStatus'); 19 | 20 | 21 | /** 22 | * @classdesc 23 | * Status and metrics of a streaming {@link Source}. 24 | * 25 | * @since EclairJS 0.7 Spark 2.0.0 26 | * @class SourceStatus 27 | * @memberof module:eclairjs/sql/streaming 28 | */ 29 | 30 | /** 31 | * 32 | * 33 | * @function 34 | * @name module:eclairjs/sql/streaming.SourceStatus#description 35 | * @since EclairJS 0.7 Spark 2.0.0 36 | * @returns {string} 37 | */ 38 | 39 | /** 40 | * 41 | * 42 | * @function 43 | * @name module:eclairjs/sql/streaming.SourceStatus#offsetDesc 44 | * @since EclairJS 0.7 Spark 2.0.0 45 | * @returns {string} 46 | */ 47 | 48 | 49 | module.exports = SourceStatus; 50 | 51 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/streaming/StreamingQueryListener.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | var StreamingQueryListener = Java.type('org.apache.spark.sql.streaming.StreamingQueryListener'); 18 | 19 | 20 | /** 21 | * @classdesc 22 | * listening to events related to {@link module:eclairjs/sql/streaming.StreamingQuery}. 23 | * 24 | * @since EclairJS 0.7 Spark 2.0.0 25 | * @class StreamingQueryListener 26 | * @memberof module:eclairjs/sql/streaming 27 | */ 28 | 29 | 30 | module.exports = StreamingQueryListener; 31 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/types/BinaryType.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var DataType = require(EclairJS_Globals.NAMESPACE + '/sql/types/DataType'); 19 | 20 | /** 21 | * @constructor 22 | * @extends module:eclairjs/sql/types.DataType 23 | * @classdesc The data type representing Array[Byte] values. Please use the singleton DataTypes.BinaryType. 24 | * @memberof module:eclairjs/sql/types 25 | */ 26 | 27 | var BinaryType = function () { 28 | var jvmObj = arguments[0]; 29 | DataType.call(this, jvmObj); 30 | }; 31 | 32 | 33 | BinaryType.prototype = Object.create(DataType.prototype); 34 | 35 | 36 | BinaryType.prototype.constructor = BinaryType; 37 | 38 | /** 39 | * The default size of a value of the BinaryType is 4096 bytes. 40 | * @returns {integer} 41 | */ 42 | BinaryType.prototype.defaultSize = function () { 43 | return this.getJavaObject().defaultSize(); 44 | }; 45 | BinaryType.prototype.ordering = function () { 46 | throw "not implemented by ElairJS"; 47 | //return this.getJavaObject().ordering(); 48 | }; 49 | BinaryType.prototype.tag = function () { 50 | throw "not implemented by ElairJS"; 51 | //return this.getJavaObject().tag(); 52 | }; 53 | 54 | module.exports = BinaryType; 55 | 56 | })(); 57 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/types/BooleanType.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var DataType = require(EclairJS_Globals.NAMESPACE + '/sql/types/DataType'); 19 | 20 | /** 21 | * @constructor 22 | * @extends module:eclairjs/sql/types.DataType 23 | * @classdesc The data type representing Boolean values. Please use the singleton DataTypes.BooleanType. 24 | * @memberof module:eclairjs/sql/types 25 | */ 26 | 27 | function BooleanType(jvmObj) { 28 | 29 | DataType.call(this, jvmObj); 30 | }; 31 | 32 | 33 | BooleanType.prototype = Object.create(DataType.prototype); 34 | 35 | 36 | BooleanType.prototype.constructor = BooleanType; 37 | 38 | /** 39 | * The default size of a value of the BooleanType is 1 byte. 40 | * @returns {integer} 41 | */ 42 | BooleanType.prototype.defaultSize = function () { 43 | return this.getJavaObject().defaultSize(); 44 | }; 45 | BooleanType.prototype.classTag = function () { 46 | throw "not implemented by ElairJS"; 47 | //return this.getJavaObject().classTag(); 48 | }; 49 | BooleanType.prototype.ordering = function () { 50 | throw "not implemented by ElairJS"; 51 | //return this.getJavaObject().ordering(); 52 | }; 53 | BooleanType.prototype.tag = function () { 54 | throw "not implemented by ElairJS"; 55 | //return this.getJavaObject().tag(); 56 | }; 57 | 58 | module.exports = BooleanType; 59 | 60 | })(); 61 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/types/CalendarIntervalType.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var DataType = require(EclairJS_Globals.NAMESPACE + '/sql/types/DataType'); 19 | 20 | /** 21 | * @constructor 22 | * @extends module:eclairjs/sql/types.DataType 23 | * @classdesc The data type representing calendar time intervals. 24 | * The calendar time interval is stored internally in two components: number of months the number of microseconds. 25 | * Note that calendar intervals are not comparable. 26 | * @memberof module:eclairjs/sql/types 27 | */ 28 | 29 | var CalendarIntervalType = function (jvmObj) { 30 | 31 | DataType.call(this, jvmObj); 32 | }; 33 | 34 | 35 | CalendarIntervalType.prototype = Object.create(DataType.prototype); 36 | 37 | 38 | CalendarIntervalType.prototype.constructor = CalendarIntervalType; 39 | 40 | /** 41 | * The default size of a value of this data type, used internally for size estimation. 42 | * @returns {integer} 43 | */ 44 | CalendarIntervalType.prototype.defaultSize = function () { 45 | return this.getJavaObject().defaultSize(); 46 | }; 47 | 48 | module.exports = CalendarIntervalType; 49 | 50 | })(); 51 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/types/NullType.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var DataType = require(EclairJS_Globals.NAMESPACE + '/sql/types/DataType'); 19 | 20 | /** 21 | * @constructor 22 | * @extends module:eclairjs/sql/types.DataType 23 | * @classdesc The data type representing NULL values. Please use the singleton DataTypes.NullType. 24 | * @memberof module:eclairjs/sql/types 25 | */ 26 | 27 | var NullType = function(jvmObj) { 28 | var jvmObj = arguments[0]; 29 | DataType.call(this, jvmObj); 30 | }; 31 | 32 | 33 | NullType.prototype = Object.create(DataType.prototype); 34 | 35 | 36 | NullType.prototype.constructor = NullType; 37 | 38 | /** 39 | * The default size of a value of this data type, used internally for size estimation. 40 | * @returns {integer} 41 | */ 42 | NullType.prototype.defaultSize = function () { 43 | return this.getJavaObject().defaultSize(); 44 | }; 45 | 46 | module.exports = NullType; 47 | 48 | })(); 49 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/types/StringType.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var DataType = require(EclairJS_Globals.NAMESPACE + '/sql/types/DataType'); 19 | 20 | /** 21 | * @constructor 22 | * @extends module:eclairjs/sql/types.DataType 23 | * @classdesc The data type representing String values. Please use the singleton DataTypes.StringType. 24 | * @memberof module:eclairjs/sql/types 25 | */ 26 | 27 | var StringType = function(jvmObj) { 28 | 29 | DataType.call(this, jvmObj); 30 | }; 31 | 32 | 33 | StringType.prototype = Object.create(DataType.prototype); 34 | 35 | 36 | StringType.prototype.constructor = StringType; 37 | 38 | /** 39 | * The default size of a value of the StringType is 4096 bytes. 40 | * @returns {integer} 41 | */ 42 | StringType.prototype.defaultSize = function () { 43 | return this.getJavaObject().defaultSize(); 44 | }; 45 | StringType.prototype.classTag = function () { 46 | throw "not implemented by ElairJS"; 47 | //return this.getJavaObject().classTag(); 48 | }; 49 | StringType.prototype.ordering = function () { 50 | throw "not implemented by ElairJS"; 51 | //return this.getJavaObject().ordering(); 52 | }; 53 | StringType.prototype.tag = function () { 54 | throw "not implemented by ElairJS"; 55 | //return this.getJavaObject().tag(); 56 | }; 57 | 58 | module.exports = StringType; 59 | 60 | })(); 61 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/sql/types/TimestampType.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var DataType = require(EclairJS_Globals.NAMESPACE + '/sql/types/DataType'); 19 | 20 | /** 21 | * @constructor 22 | * @extends module:eclairjs/sql/types.DataType 23 | * @memberof module:eclairjs/sql/types 24 | * @classdesc The data type representing java.sql.Timestamp values. Please use the singleton DataTypes.TimestampType. 25 | */ 26 | 27 | var TimestampType = function(jvmObj) { 28 | 29 | DataType.call(this, jvmObj); 30 | }; 31 | 32 | 33 | TimestampType.prototype = Object.create(DataType.prototype); 34 | 35 | 36 | TimestampType.prototype.constructor = TimestampType; 37 | 38 | /** 39 | * The default size of a value of the TimestampType is 8 bytes. 40 | * @returns {integer} 41 | */ 42 | TimestampType.prototype.defaultSize = function () { 43 | return this.getJavaObject().defaultSize(); 44 | }; 45 | TimestampType.prototype.classTag = function () { 46 | throw "not implemented by ElairJS"; 47 | //return this.getJavaObject().classTag(); 48 | }; 49 | TimestampType.prototype.ordering = function () { 50 | throw "not implemented by ElairJS"; 51 | //return this.getJavaObject().ordering(); 52 | }; 53 | TimestampType.prototype.tag = function () { 54 | throw "not implemented by ElairJS"; 55 | //return this.getJavaObject().tag(); 56 | }; 57 | 58 | module.exports = TimestampType; 59 | 60 | })(); 61 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/storage.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | /** 18 | * storage module. 19 | * @example 20 | * var storage = require('eclairjs/storage'); 21 | * var at = new storage.StorageLevel(); 22 | * @module eclairjs/storage 23 | */ 24 | module.exports = { 25 | StorageLevel: require(EclairJS_Globals.NAMESPACE + '/storage/StorageLevel') 26 | 27 | } 28 | })(); 29 | 30 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/streaming.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * streaming module. 20 | * @example 21 | * var streaming = require('eclairjs/streaming'); 22 | * @module eclairjs/streaming 23 | */ 24 | module.exports = { 25 | Duration: require(EclairJS_Globals.NAMESPACE + '/streaming/Duration'), 26 | StreamingContext: require(EclairJS_Globals.NAMESPACE + '/streaming/StreamingContext'), 27 | Time: require(EclairJS_Globals.NAMESPACE + '/streaming/Time') 28 | } 29 | 30 | })(); 31 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/streaming/dstream.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * streaming dstream module. 20 | * @example 21 | * var dstream = require('eclairjs/streaming/dstream'); 22 | * @module eclairjs/streaming/dstream 23 | */ 24 | module.exports = { 25 | DStream: require(EclairJS_Globals.NAMESPACE + '/streaming/dstream/DStream'), 26 | PairDStream: require(EclairJS_Globals.NAMESPACE + '/streaming/dstream/PairDStream') 27 | } 28 | 29 | })(); 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/streaming/kafka.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * streaming kafka module. 20 | * @example 21 | * var kafka = require('eclairjs/streaming/kafka'); 22 | * @module eclairjs/streaming/kafka 23 | */ 24 | module.exports = { 25 | KafkaUtils: require(EclairJS_Globals.NAMESPACE + '/streaming/kafka/KafkaUtils') 26 | } 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/streaming/twitter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | (function () { 18 | /** 19 | * streaming twitter module. 20 | * @example 21 | * var twitter = require('eclairjs/streaming/twitter'); 22 | * @module eclairjs/streaming/twitter 23 | */ 24 | module.exports = { 25 | TwitterAuthorization: require(EclairJS_Globals.NAMESPACE + '/streaming/twitter/TwitterAuthorization'), 26 | TwitterUtils: require(EclairJS_Globals.NAMESPACE + '/streaming/twitter/TwitterUtils') 27 | } 28 | 29 | })(); 30 | -------------------------------------------------------------------------------- /src/main/resources/eclairjs/streaming/twitter/TwitterAuthorization.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | (function () { 17 | 18 | var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper'); 19 | var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger'); 20 | var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils'); 21 | 22 | /** 23 | * @constructor 24 | * @memberof module:eclairjs/streaming/twitter 25 | * @classdesc Twitter Authorization. 26 | * @param {string} oauthConsumerKey 27 | * @param {string} oauthConsumerSecret 28 | * @param {string} oauthAccessToken 29 | * @param {string} oauthAccessTokenSecret 30 | */ 31 | var TwitterAuthorization = function (oauthConsumerKey, oauthConsumerSecret, oauthAccessToken, oauthAccessTokenSecret) { 32 | var AuthorizationFactory = Java.type("twitter4j.auth.AuthorizationFactory"); 33 | var ConfigurationBuilder = Java.type("twitter4j.conf.ConfigurationBuilder"); 34 | var conf = new ConfigurationBuilder().setOAuthConsumerKey(oauthConsumerKey).setOAuthConsumerSecret(oauthConsumerSecret).setOAuthAccessToken(oauthAccessToken).setOAuthAccessTokenSecret(oauthAccessTokenSecret).build(); 35 | var auth = AuthorizationFactory.getInstance(conf); 36 | JavaWrapper.call(this, auth); 37 | 38 | }; 39 | 40 | TwitterAuthorization.prototype = Object.create(JavaWrapper.prototype); 41 | 42 | TwitterAuthorization.prototype.constructor = TwitterAuthorization; 43 | 44 | module.exports = TwitterAuthorization; 45 | 46 | })(); -------------------------------------------------------------------------------- /src/main/resources/eclairjs/util.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * util module. 4 | * @example 5 | * var util = require('eclairjs/util'); 6 | * @module eclairjs/util 7 | */ 8 | module.exports = { 9 | // StatCounter: require(EclairJS_Globals.NAMESPACE + '/util/StatCounter'), 10 | StatCounter: require(EclairJS_Globals.NAMESPACE + '/util/StatCounter'), 11 | // RpcUtils: require(EclairJS_Globals.NAMESPACE + '/util/RpcUtils'), 12 | // Vector: require(EclairJS_Globals.NAMESPACE + '/util/Vector'), 13 | // collection: require(EclairJS_Globals.NAMESPACE + '/util/collection'), 14 | // io: require(EclairJS_Globals.NAMESPACE + '/util/io'), 15 | // logging: require(EclairJS_Globals.NAMESPACE + '/util/logging'), 16 | // random: require(EclairJS_Globals.NAMESPACE + '/util/random') 17 | } 18 | })(); -------------------------------------------------------------------------------- /src/main/resources/jaas.conf: -------------------------------------------------------------------------------- 1 | KafkaClient { 2 | org.apache.kafka.common.security.plain.PlainLoginModule required 3 | serviceName="kafka" 4 | username="$USERNAME" 5 | password="$PASSWORD"; 6 | }; -------------------------------------------------------------------------------- /src/test/java/org/eclairjs/nashorn/CoreTest.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | 6 | 7 | @Tests({ 8 | "rddtest.js" 9 | }) 10 | 11 | @RunWith(JSRunner.class) 12 | public class CoreTest { 13 | 14 | @Test 15 | public void version() throws Exception { 16 | 17 | 18 | } 19 | 20 | @Test 21 | public void testForeach() throws Exception { 22 | 23 | 24 | } 25 | 26 | @Test 27 | public void testFilter() throws Exception { 28 | 29 | 30 | } 31 | 32 | @Test 33 | public void testCartesian() throws Exception { 34 | 35 | 36 | } 37 | 38 | @Test 39 | public void testZipPartitions() throws Exception { 40 | 41 | } 42 | 43 | @Test 44 | public void testFlatMap() throws Exception { 45 | 46 | } 47 | 48 | @Test 49 | public void testAggregate() throws Exception { 50 | 51 | } 52 | 53 | @Test 54 | public void testMapToPair() throws Exception { 55 | 56 | } 57 | 58 | @Test 59 | public void testContext() throws Exception { 60 | 61 | } 62 | 63 | 64 | @Test 65 | public void testUserModule() throws Exception { 66 | 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /src/test/java/org/eclairjs/nashorn/TestCase.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | 3 | 4 | public class TestCase { 5 | 6 | public final String name; 7 | public final Runnable testCase; 8 | 9 | public TestCase(String name, Runnable testCase) { 10 | this.name = name; 11 | this.testCase = testCase; 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/java/org/eclairjs/nashorn/TestClass.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | 3 | 4 | import java.util.List; 5 | 6 | public class TestClass { 7 | public final List testCases; 8 | public final String name; 9 | 10 | public TestClass(String name, List testCases) { 11 | this.testCases = testCases; 12 | this.name = name; 13 | } 14 | 15 | public String junitName() { 16 | return name.replaceAll("(.*)\\.(.*)","$2.$1"); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/test/java/org/eclairjs/nashorn/TestKernel.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | 3 | import org.apache.spark.api.java.JavaSparkContext; 4 | 5 | public class TestKernel { 6 | 7 | private JavaSparkContext sc = null; 8 | 9 | public TestKernel() { 10 | this.sc = new JavaSparkContext("local[*]", "testapp"); 11 | } 12 | 13 | public JavaSparkContext javaSparkContext() { 14 | return this.sc; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/test/java/org/eclairjs/nashorn/Tests.java: -------------------------------------------------------------------------------- 1 | package org.eclairjs.nashorn; 2 | 3 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 4 | 5 | import java.lang.annotation.Retention; 6 | 7 | @Retention(RUNTIME) 8 | public @interface Tests { 9 | String[] value(); 10 | } -------------------------------------------------------------------------------- /src/test/resources/conf/log4j.prop: -------------------------------------------------------------------------------- 1 | # Set everything to be logged to the console 2 | log4j.rootCategory=ERROR, console 3 | log4j.appender.console=org.apache.log4j.ConsoleAppender 4 | log4j.appender.console.target=System.err 5 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n 7 | 8 | # Settings to quiet third party logs that are too verbose 9 | log4j.logger.org.spark-project.jetty=WARN 10 | log4j.logger.org.spark-project.jetty.util.component.AbstractLifeCycle=ERROR 11 | log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=ERROR 12 | log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=ERROR 13 | 14 | # SPARK-9183: Settings to avoid annoying messages when looking up nonexistent UDFs in SparkSQL with Hive support 15 | log4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=FATAL 16 | log4j.logger.org.apache.hadoop.hive.ql.exec.FunctionRegistry=ERROR 17 | 18 | log4j.logger.org.eclairjs.nashorn=ERROR -------------------------------------------------------------------------------- /src/test/resources/data/sql/people.txt: -------------------------------------------------------------------------------- 1 | Michael, 29, 1, 1996-03-07 00:00:00, 1200.40, true, 300000000.11 2 | Andy, 30, 2, 1998-12-07 00:00:00, 1500.44, false, 500000000.11 3 | Justin, 19, 3, 1992-03-07 00:00:00, 1600.00, true, 100000.00 -------------------------------------------------------------------------------- /src/test/resources/data/sql/peopleDuplicates.txt: -------------------------------------------------------------------------------- 1 | Michael, 29, 1, 1996-03-07 00:00:00, 1200.40, true, 300000000.11 2 | Andy, 30, 2, 1998-12-07 00:00:00, 1500.44, false, 500000000.11 3 | Justin, 19, 1, 1992-03-07 00:00:00, 1600.00, true, 100000.00 4 | Andy, 30, 2, 1998-12-07 00:00:00, 1500.44, false, 500000000.11 5 | Justin, 19, 1, 1992-03-07 00:00:00, 1600.00, true, 100000.00 -------------------------------------------------------------------------------- /src/test/resources/data/sql/peopleNullValues.txt: -------------------------------------------------------------------------------- 1 | Michael, 29, 1, 1996-03-07 00:00:00, , true, 300000000.11 2 | Andy, 30, 2, 1998-12-07 00:00:00, 1500.44, false, 500000000.11 3 | Justin, 19, 3, 1992-03-07 00:00:00, 1600.00, true, 100000.00 -------------------------------------------------------------------------------- /src/test/resources/data/sql/peopleNullValues2.txt: -------------------------------------------------------------------------------- 1 | Michael, 29, 1, 1996-03-07 00:00:00, , true, 300000000.11 2 | Andy, , 2, 1998-12-07 00:00:00, 1500.44, false, 500000000.11 3 | , 19, 3, 1992-03-07 00:00:00, 1600.00, true, 100000.00 -------------------------------------------------------------------------------- /src/test/resources/data/sql/streaming/people.csv: -------------------------------------------------------------------------------- 1 | Michael, 29, 1, 1996-03-07 00:00:00, 1200.40, true, 300000000.11 2 | Andy, 30, 2, 1998-12-07 00:00:00, 1500.44, false, 500000000.11 3 | Justin, 19, 3, 1992-03-07 00:00:00, 1600.00, true, 100000.00 -------------------------------------------------------------------------------- /src/test/resources/data/sql/timestamp.json: -------------------------------------------------------------------------------- 1 | [{"zero":"yada", "one":"foo", "alchemy_score":"99", "alchemy_text":"great score" , "day":5, "hours":10, "imagebox":"box10", "minutes":12, "month":3, "seconds":34, "visual_image":"image1", "eleven":"blah", "year":2016, "id":234}, {"zero":"yadayada", "one":"bar", "alchemy_score":"13", "alchemy_text":"bad score" , "day":2, "hours":6, "imagebox":"box15", "minutes":24, "month":2, "seconds":11, "visual_image":"image15", "eleven":"blahblah", "year":2015, "id":339}] 2 | -------------------------------------------------------------------------------- /src/test/resources/nashorntest.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | var SparkConf= require('eclairjs/SparkConf'); 19 | var SparkContext = require(EclairJS_Globals.NAMESPACE + '/SparkContext'); 20 | 21 | var logFile = "/tmp/dream.txt"; // Should be some file on your system 22 | //var master = "spark://MacBook-Pro.local:7077"; 23 | var master = "local[*]"; 24 | var conf = new SparkConf().setAppName("Simple Application").setMaster(master); 25 | //var sc = new JavaSparkContext(conf); 26 | var sc = new SparkContext(conf); 27 | var logData = sc.textFile(logFile).cache(); 28 | //var x = 2; 29 | var numAs = logData.filter(function (s) { 30 | //print("filter x = " + x); 31 | var ret = (s.indexOf("a") > -1); 32 | print(ret); 33 | return ret; 34 | }).count(); 35 | var numBs = logData.filter(function (s) { 36 | print("filter 2 " + s); 37 | var ret = (s.indexOf("b") > -1); 38 | print(ret); 39 | return ret; 40 | }).count(); 41 | //var y = x.count(); 42 | print(" numAs = " + numAs + " numBs = " + numBs); 43 | print(" count = " + logData.count()); 44 | -------------------------------------------------------------------------------- /src/test/resources/sql/timestamp.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | var SparkContext = require(EclairJS_Globals.NAMESPACE + '/SparkContext'); 17 | var SQLContext = require(EclairJS_Globals.NAMESPACE + '/sql/SQLContext'); 18 | //var SqlTimestamp = require(EclairJS_Globals.NAMESPACE + '/sql/SqlTimestamp'); 19 | 20 | var sparkContext = new SparkContext("local[*]", "simple timestamp test"); 21 | var sqlContext = new SQLContext(sparkContext); 22 | 23 | var file = "./src/test/resources/data/sql/timestamp.json"; 24 | var df = sqlContext.read().json(file); 25 | 26 | var rddRow = df.map(function(row, RowFactory, SqlTimestamp) { 27 | var d = new Date( 28 | parseInt(row.get(12), 29 | parseInt(row.get(8)), 30 | parseInt(row.get(4)), 31 | parseInt(row.get(5)), 32 | parseInt(row.get(7)), 33 | parseInt(row.get(9))) 34 | ); 35 | 36 | var newRow = RowFactory.create([ 37 | row.get(13), //id 38 | row.get(2), //alchemy_score 39 | row.get(3), //alchemy_text 40 | row.get(6), //imagebox 41 | row.get(10), //visual_image 42 | new SqlTimestamp(d) //timestamp 43 | ]); 44 | 45 | print("====>Created newRow in lambda: ", newRow.toString()); 46 | 47 | return newRow; 48 | }, [require("eclairjs/sql/RowFactory"), require("eclairjs/sql/SqlTimestamp")]) 49 | 50 | var rddNewRow = rddRow.collect(); 51 | print("====>rddNewRows: "+rddNewRow.toString()); 52 | -------------------------------------------------------------------------------- /src/test/resources/test.json: -------------------------------------------------------------------------------- 1 | {"first": "Luke", "last": "Skywalker"} 2 | {"first": "Darth", "last": "Vader"} 3 | {"first": "Darth", "last": "Sidious"} 4 | {"first": "Darth", "last": "Maul"} 5 | -------------------------------------------------------------------------------- /src/test/resources/top10words.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 IBM Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | var SparkContext = require(EclairJS_Globals.NAMESPACE + '/SparkContext'); 17 | var sparkContext = new SparkContext("local[*]", "top10"); 18 | 19 | var wordCount = function(file) { 20 | var rdd = sparkContext.textFile(file); 21 | 22 | 23 | var rdd2 = rdd.flatMap(function(sentence) { 24 | return sentence.split(" "); 25 | }); 26 | 27 | var rdd3 = rdd2.filter(function(word) { 28 | return word.trim().length > 0; 29 | }); 30 | 31 | var rdd4 = rdd3.mapToPair(function(word) { 32 | return [word, 1]; 33 | }); 34 | 35 | var rdd5 = rdd4.reduceByKey(function(a, b) { 36 | return a + b; 37 | }); 38 | 39 | var rdd6 = rdd5.mapToPair(function(tuple) { 40 | return [tuple[1]+0.0, tuple[0]]; 41 | }) 42 | 43 | var rdd7 = rdd6.sortByKey(false); 44 | 45 | return JSON.stringify(rdd7.take(10)); 46 | } 47 | -------------------------------------------------------------------------------- /tools/generateJS/READMD.md: -------------------------------------------------------------------------------- 1 | 2 | generatejs - Generate Javascript from Spark source 3 | ============= 4 | 5 | generatejs is a utility tool which scans the Apache Spark source files, and generates the 6 | appropriate skeleton javascript files for either elairjs-nashorn, or eclairjs-node. 7 | 8 | 9 | ## Building generatejs 10 | 11 | ```bash 12 | cd /path/to/eclairjs-nashorn/tools/generatejs 13 | sbt clean 14 | sbt compile 15 | sbt pack 16 | 17 | ./target/pack/bin/generateJS 18 | 19 | ``` 20 | 21 | 22 | ## Usage 23 | ```bash 24 | Option Description 25 | ------ ----------- 26 | --generateNode generate code for node (default is nashorn) 27 | --generatedPath path to generated javascript 28 | --gitrepo path to spark git repo 29 | -h, --help display help information 30 | --source path to a source directory 31 | --statistics generate statistics (no js generated) 32 | ``` 33 | 34 | For example, to generate nodejs files for the entire spark source 35 | 36 | ```bash 37 | generateJS --gitrepo /pathTo/spark/gitrepo --generatedPath /path/to/put/generatedjs --generateNode 38 | 39 | ``` 40 | -------------------------------------------------------------------------------- /tools/generateJS/build.sbt: -------------------------------------------------------------------------------- 1 | 2 | import scala.util.Properties 3 | import sbt._ 4 | import xerial.sbt.Pack._ 5 | 6 | 7 | name := "generateJS" 8 | 9 | 10 | scalaVersion := "2.10.4" 11 | 12 | sbtVersion := "0.13.7" 13 | 14 | /*RESOLVERS*/ 15 | resolvers += Resolver.typesafeRepo("releases") 16 | 17 | val scalaTestV = "2.2.5" 18 | 19 | // 20 | //// Automatically find def main(args:Array[String]) methods from classpath 21 | //packAutoSettings 22 | 23 | // If you need to specify main classes manually, use packSettings and packMain 24 | packSettings 25 | 26 | // [Optional] Creating `hello` command that calls org.mydomain.Hello#main(Array[String]) 27 | packMain := Map("generateJS" -> "org.eclairjs.tools.generate.Main") 28 | 29 | // 30 | // TEST DEPENDENCIES 31 | // 32 | libraryDependencies ++= Seq( 33 | "org.scalatest" %% "scalatest" % scalaTestV % "test", 34 | "org.scala-lang" % "scala-library" % scalaVersion.value, 35 | "org.scala-lang" % "scala-compiler" % scalaVersion.value, 36 | "org.scala-lang" % "scala-reflect" % scalaVersion.value, 37 | "net.sf.jopt-simple" % "jopt-simple" % "4.6" // MIT 38 | 39 | ) 40 | 41 | 42 | // Similar options used by spark kernel 43 | javaOptions ++= Seq("-Xmx2048M", "-XX:PermSize=128M", "-XX:MaxPermSize=256M") 44 | 45 | -------------------------------------------------------------------------------- /tools/generateJS/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.7 2 | 3 | -------------------------------------------------------------------------------- /tools/generateJS/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | // Provides ability to create a pack containing all jars and a script to run them 2 | // using `sbt pack` or `sbt pack-archive` to generate a *.tar.gz file 3 | addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.7.7") // for sbt-0.13.x or higher 4 | 5 | -------------------------------------------------------------------------------- /tools/generateJS/wontImplement.txt: -------------------------------------------------------------------------------- 1 | streaming/dstream/ReceiverInputDStream.js 2 | streaming/dstream/InputDStream.js 3 | streaming/dstream/DStream.js 4 | -saveAsObjectFiles 5 | streaming/dstream/InputDStream.js 6 | 7 | * RDD.js 8 | * cache X 9 | * coalesce X 10 | * distinct X 11 | * filter X 12 | * intersection X 13 | * persist X 14 | * randomSplit X 15 | * repartition X 16 | * sample X 17 | * setName X 18 | * sortBy X 19 | * subtract X 20 | * toString X 21 | * union X 22 | * unpersist X 23 | * wrapRDD 24 | Static functions 25 | * fromRDD 26 | * toRDD --------------------------------------------------------------------------------