siddjain commented on issue #19239: URL: https://github.com/apache/beam/issues/19239#issuecomment-1159353731
btw, I also tried converting the code into scala using spotify scio. The performance is identical to Java if anyone interested. Apache Beam SDK for Java 2.38.0 <img width="285" alt="Screen Shot 2022-06-17 at 8 40 31 PM" src="https://user-images.githubusercontent.com/758321/174421548-c19ae167-47b0-459c-ab42-df4d9bf83a27.png"> scala code: ``` @BigQueryType.fromQuery("SELECT weight_pounds FROM [bigquery-public-data:samples.natality]") class Row @BigQueryType.toTable case class Result(weight_pounds: Double) def pipeline(cmdlineArgs: Array[String]): ScioContext = { val (sc, args) = ContextAndArgs(cmdlineArgs) sc.typedBigQuery[Row]() .map(r => r.weight_pounds.getOrElse(0.0)) // return 0 if weight_pounds is None .top(100) // select top 100. this returns a SCollection[Iterable[Double]] .flatMap(x => x) .map(x => Result(x)) .saveAsTypedBigQueryTable( Table.Spec(args("output")), writeDisposition = WRITE_TRUNCATE, createDisposition = CREATE_IF_NEEDED ) sc } ``` -- 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]
