我正在尝试使用 spark-sql-2.4.1 版本从 oracle 检索数据。我尝试将 JdbcOptions 设置为如下:
.option("lowerBound", "31-MAR-02");
.option("upperBound", "01-MAY-19");
.option("partitionColumn", "data_date");
.option("numPartitions", 240);
Run Code Online (Sandbox Code Playgroud)
但给出错误:
java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
at java.sql.Timestamp.valueOf(Timestamp.java:204)
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation$.toInternalBoundValue(JDBCRelation.scala:179)
Run Code Online (Sandbox Code Playgroud)
然后尝试如下
.option("lowerBound", "2002-03-31"); //changed the date format
.option("upperBound", "2019-05-02");
.option("partitionColumn", "data_date");
.option("numPartitions", 240);
Run Code Online (Sandbox Code Playgroud)
仍然没有运气。那么将日期作为“下限/上限”传递的正确方法是什么?有没有办法指定/设置选项参数数据类型?
Part-2 正确检查选项。它们在执行查询之前被覆盖。所以更正了。...现在该错误已解决。
但对于以下选项:
.option("lowerBound", "2002-03-31 00:00:00");
.option("upperBound", "2019-05-01 23:59:59");
.option("timestampFormat", "yyyy-mm-dd hh:mm:ss");
Run Code Online (Sandbox Code Playgroud)
请求参数 :
query -> ( SELECT * FROM MODEL_VALS ) T
Run Code Online (Sandbox Code Playgroud)
它引发了另一个错误:
java.sql.SQLException: ORA-12801: error signaled in parallel query server P022, instance nj0005
ORA-01861: literal does not …Run Code Online (Sandbox Code Playgroud) 我是 azure databricks 的新手,并尝试创建一个指向 Azure Data Lake Storage (ADLS) Gen-2 位置的外部表。
从 databricks 笔记本中,我尝试为 ADLS 访问设置 spark 配置。我仍然无法执行创建的 DDL。
注意:对我有用的一种解决方案是将 ADLS 帐户安装到集群,然后使用外部表的 DDL 中的安装位置。但是我需要检查是否可以使用没有安装位置的 ADLS 路径创建外部表 DDL。
# Using Principal credentials
spark.conf.set("dfs.azure.account.auth.type", "OAuth")
spark.conf.set("dfs.azure.account.oauth.provider.type", "ClientCredential")
spark.conf.set("dfs.azure.account.oauth2.client.id", "client_id")
spark.conf.set("dfs.azure.account.oauth2.client.secret", "client_secret")
spark.conf.set("dfs.azure.account.oauth2.client.endpoint",
"https://login.microsoftonline.com/tenant_id/oauth2/token")
Run Code Online (Sandbox Code Playgroud)
数据线
create external table test(
id string,
name string
)
partitioned by (pt_batch_id bigint, pt_file_id integer)
STORED as parquet
location 'abfss://container@account_name.dfs.core.windows.net/dev/data/employee
Run Code Online (Sandbox Code Playgroud)
收到错误
Error in SQL statement: AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: MetaException(message:Got exception: shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs.contracts.exceptions.ConfigurationPropertyNotFoundException Configuration property account_name.dfs.core.windows.net not found.);
Run Code Online (Sandbox Code Playgroud)
我需要帮助知道这是否可以直接在 DDL …
我在 Azure 环境中有一个简单的 ETL 过程
blob 存储 > 数据工厂 > 原始数据 > 数据块 > 数据湖策划 > 数据仓库(主 ETL)。
这个项目的数据集不是很大(大约 100 万行 20 列给予或接受)但是我想将它们作为 Parquet 文件在我的数据湖中正确分区。
目前我运行一些简单的逻辑来确定每个文件应该在我的湖中的哪个位置基于业务日历。
文件模糊地看起来像这样
Year Week Data
2019 01 XXX
2019 02 XXX
Run Code Online (Sandbox Code Playgroud)
然后我将给定的文件分区为以下格式,替换存在的数据并为新数据创建新文件夹。
curated ---
dataset --
Year 2019
- Week 01 - file.pq + metadata
- Week 02 - file.pq + metadata
- Week 03 - file.pq + datadata #(pre existing file)
Run Code Online (Sandbox Code Playgroud)
元数据是成功和自动生成的提交。
为此,我在 Pyspark 2.4.3 中使用以下查询
pyspark_dataframe.write.mode('overwrite')\
.partitionBy('Year','Week').parquet('\curated\dataset')
Run Code Online (Sandbox Code Playgroud)
现在,如果我单独使用此命令,它将覆盖目标分区中的任何现有数据
所以 …
我正在运行一些操作来在 azure databricks 上聚合大量数据(约 600GB)。我最近注意到笔记本崩溃并且数据块返回以下错误。相同的代码之前适用于较小的 6 节点集群。将其升级到 12 个节点后,我开始遇到此问题,我怀疑这是一个配置问题。
请提供任何帮助,我使用默认的 Spark 配置,分区数 = 200,并且我的节点上有 88 个执行程序。
Thanks
Internal error, sorry. Attach your notebook to a different cluster or restart the current cluster.
java.lang.RuntimeException: abort: DriverClient destroyed
at com.databricks.backend.daemon.driver.DriverClient.$anonfun$poll$3(DriverClient.scala:381)
at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at com.databricks.threading.NamedExecutor$$anon$2.$anonfun$run$1(NamedExecutor.scala:335)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at com.databricks.logging.UsageLogging.$anonfun$withAttributionContext$1(UsageLogging.scala:238)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
at com.databricks.logging.UsageLogging.withAttributionContext(UsageLogging.scala:233)
at com.databricks.logging.UsageLogging.withAttributionContext$(UsageLogging.scala:230)
at com.databricks.threading.NamedExecutor.withAttributionContext(NamedExecutor.scala:265)
at com.databricks.threading.NamedExecutor$$anon$2.run(NamedExecutor.scala:335)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Run Code Online (Sandbox Code Playgroud) 我正在运行 Databricks Community Edition,我想从以下 mnt 目录中删除文件
/mnt/driver-daemon/jars
我运行 dbutils 命令:
dbutils.fs.rm('/mnt/driver-daemon/jars/', True)
但是,当我运行命令时,我收到以下消息(这基本上意味着该文件夹尚未被删除)
Out[1]: False
有人可以让我知道我哪里出错了吗?理想情况下,我想删除 jars 文件夹中的所有文件,但是,如果有人可以帮助展示如何删除该文件夹,那就足够了。
我们有一个机器学习分类器模型,使用 pandas 数据框和标准 sklearn 管道(StandardScaler、RandomForestClassifier、GridSearchCV 等)进行训练。我们正在开发 Databricks,并希望使用 Spark 提供的并行计算功能将该管道扩展到大型数据集。
将 sklearn 管道转换为并行计算的最快方法是什么?(我们可以根据需要轻松地在 pandas 和 Spark DF 之间切换。)
就上下文而言,我们的选择似乎是:
对于选项 2,Spark-Sklearn 似乎已被弃用,但 Databricks建议我们使用 joblibspark。然而,这在 Databricks 上引发了一个例外:
from sklearn import svm, datasets
from sklearn.model_selection import GridSearchCV
from joblibspark import register_spark
from sklearn.utils import parallel_backend
register_spark() # register spark backend
iris = datasets.load_iris()
parameters = {'kernel':('linear', 'rbf'), 'C':[1, 10]}
svr = svm.SVC(gamma='auto')
clf = GridSearchCV(svr, parameters, cv=5)
with parallel_backend('spark', n_jobs=3):
clf.fit(iris.data, iris.target)
Run Code Online (Sandbox Code Playgroud)
提高
py4j.security.Py4JSecurityException: …Run Code Online (Sandbox Code Playgroud) 我在 Azure DevOps 中运行以下任务,它总是挂起等待输入?为什么我的 bash 自动供给不工作?
databricksUrl=https://...
databricksToken=*****
databricks configure --token << EOF
$(databricksUrl)
$(databricksToken)
EOF
Run Code Online (Sandbox Code Playgroud) 目前,在 Databricks 中,如果我们运行查询,它在第一次运行时总是返回 1000 行。如果我们需要所有行,我们需要再次执行查询。
在我们知道需要下载完整数据(1000+ 行)的情况下,是否有办法执行查询以在第一次运行时获取所有行而无需重新执行查询?
因为在 SQL Server 中,我们可以声明变量, declare @sparksql='<any query/value/string>'但在 Spark sql 中可以使用什么替代方法。这样我们就不需要对任何值/查询/字符串进行硬编码。
我正在将 Azure Databricks 与使用 vnet 注入的自定义配置结合使用,但无法在工作区中启动群集。给出的错误消息没有记录在 Microsoft 或 databricks 文档中的任何位置,这意味着我无法诊断集群未启动的原因。我重现了以下错误消息:
Instance ID: [redacted]
Azure error message:
Instance bootstrap failed.
Failure message: Cloud Provider Failure. Azure VM Extension stuck on transitioning state. Please try again later.
VM extension code: ProvisioningState/transitioning
instanceId: InstanceId([redacted])
workerEnv: workerenv-6662162805421143
Additional details (may be truncated): Enable in progress
Run Code Online (Sandbox Code Playgroud)
虽然它说“请稍后重试”,但我一整天都在尝试这个并收到相同的消息,这让我认为这个错误消息不是描述性的,而且确实发生了其他事情。
有人对问题可能是什么有想法吗?
databricks ×10
azure ×4
apache-spark ×3
pyspark ×2
python ×2
azure-devops ×1
hive ×1
scikit-learn ×1
sql ×1