我不明白我们使用的原因if let,只是通常的if. 在 Rust 书的第 6.3 章中,示例代码如下:
let some_u8_value = Some(0u8);
if let Some(3) = some_u8_value {
println!("three");
}
Run Code Online (Sandbox Code Playgroud)
上面的代码与:
let some_u8_value = Some(0u8);
if Some(3) == some_u8_value {
println!("three");
}
Run Code Online (Sandbox Code Playgroud)
关于我们为什么要使用if let它或它专门用于什么的任何其他原因?
我一直在尝试向 Kubernetes 提交应用程序。我已经按照https://spark.apache.org/docs/latest/running-on-kubernetes.html中的教程进行操作,例如构建 Spark 图像等。
但每当我尝试运行该命令时spark-submit,pod 总是抛出错误。这是来自命令的日志kubectl logs <spark-driver-pods>::
Error: Unable to initialize main class org.apache.spark.deploy.SparkSubmit
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/spi/Filter
Run Code Online (Sandbox Code Playgroud)
我尝试过使用类似的东西:
spark-submit
...
--jars $(echo /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/pyspark/jars/*.jar | tr ' ' ',')
...
Run Code Online (Sandbox Code Playgroud)
但这仍然会引发错误。
pyspark在终端中使用。我还应该做些什么吗?或者忘记做什么?
我想知道为什么Timestamp对象无法按预期工作?
它可以在测试环境中工作(我使用Mocha),但是在部署后会引发错误。
索引
import { Timestamp, QuerySnapshot } from "@google-cloud/firestore";
....
async someFunction() {
let col = firestore.collection("mycollection");
let now = Timestamp.now();
let twentyMinsAgo = Timestamp.fromMillis(now.toMillis() - (1200 * 1000));
return col
.where('LastEdited', '>=', twentyMinsAgo) //This throws error
.get()
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪
Argument "value" is not a valid QueryValue.
Detected an object of type "Timestamp" that doesn't match the expected instance.
Please ensure that the Firestore types you are using are from the same NPM package.
at Validator.(anonymous function).err [as isQueryValue] …Run Code Online (Sandbox Code Playgroud) firebase google-cloud-functions firebase-admin google-cloud-firestore