jason810496 commented on code in PR #68939: URL: https://github.com/apache/airflow/pull/68939#discussion_r3472645325
########## java-sdk/scala_spark_example/src/scala/org/apache/airflow/example/ScalaSparkExample.scala: ########## @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.airflow.example + +import org.apache.airflow.sdk.{Bundle, BundleBuilder, Client, Context, Dag, Server, Task} +import org.apache.logging.log4j.{LogManager, Logger} +import org.apache.spark.sql.SparkSession +import org.apache.spark.sql.functions.sum + +/** + * A Scala + Apache Spark ETL bundle for the Java SDK. Each task runs in its own + * JVM with a fresh local `SparkSession` and passes scalar results over XCom. + * See README.md for the overview. + */ + +/** Deterministic in-memory sales dataset so downstream assertions are stable. */ +private object SalesData { + // (id, category, amount) + val rows: Seq[(Int, String, Long)] = Seq( + (1, "electronics", 100L), + (2, "books", 200L), + (3, "electronics", 300L), + (4, "clothing", 150L), + (5, "books", 250L), + ) + + val rowCount: Long = rows.size.toLong // 5 + val totalRevenue: Long = rows.map(_._3).sum // 1000 Review Comment: Addressed in https://github.com/apache/airflow/pull/68939/commits/f46122ace1e7a6a21b150b0d55dd54340f6e6e57, thanks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
