id stringlengths 7 11 | source stringclasses 1
value | category stringclasses 11
values | title stringlengths 15 214 | text stringlengths 70 30.5k | url stringlengths 57 160 | tags stringlengths 3 113 | created_at int64 1.22B 1.79B |
|---|---|---|---|---|---|---|---|
se_79667411 | stackoverflow | DATA_ENGINEERING | Process large compressed file in scala | Process large compressed file in scala
We have number of compressed file and to process them in scala, we are using -
new GZIPInputStream(new ByteArrayInputStream(payload))
the pay load here is Array[Byte]
However for extremely large file say 2GB it is failing with error - Array out of index or memory issue.
How to r... | https://stackoverflow.com/questions/79667411/process-large-compressed-file-in-scala | scala, apache-spark, compressed-files | 1,750,068,808 |
se_79665970 | stackoverflow | DATA_ENGINEERING | Can not read from S3 with AssumedRoleCredentialProvider after upgrade from EMR serverless 6.9 to 7.5 | Can not read from S3 with AssumedRoleCredentialProvider after upgrade from EMR serverless 6.9 to 7.5
I have a pyspark script that reads data from S3 in a different AWS account, using AssumedRoleCredentialProvider , it is working on emr serverless 6.9 but when I upgrade to EMR Serverless 7.5 it fails with the following... | https://stackoverflow.com/questions/79665970/can-not-read-from-s3-with-assumedrolecredentialprovider-after-upgrade-from-emr-s | apache-spark, hadoop, pyspark, amazon-emr, emr-serverless | 1,749,916,800 |
se_79668132 | stackoverflow | DATA_ENGINEERING | Get two different nodes to access and distribute the same SQL table in Apache spark? | Get two different nodes to access and distribute the same SQL table in Apache spark?
I have the following code to test. I created a table on worker 1. Then I tried to read the table on worker 2 and it got TABLE_OR_VIEW_NOT_FOUND. Worker 2 is in the some computer as Master.
I ran the code once where it created the tabl... | https://stackoverflow.com/questions/79668132/get-two-different-nodes-to-access-and-distribute-the-same-sql-table-in-apache-sp | sql, apache-spark, pyspark, apache-spark-sql, distributed-computing | 1,750,101,929 |
se_51220294 | stackoverflow | DATA_ENGINEERING | Spark Dataframe implementation similar to Oracle's LISTAGG function - Unable to Order with in the group | Spark Dataframe implementation similar to Oracle's LISTAGG function - Unable to Order with in the group
I want to implement a function similar to Oracle's LISTAGG function.
Equivalent oracle code is
select KEY,
listagg(CODE, '-') within group (order by DATE) as CODE
from demo_table
group by KEY
Here is my spa... | https://stackoverflow.com/questions/51220294/spark-dataframe-implementation-similar-to-oracles-listagg-function-unable-to | scala, apache-spark, apache-spark-sql, concatenation, aggregate | 1,530,942,255 |
se_31640729 | stackoverflow | DATA_ENGINEERING | Spark SQL replacement for MySQL's GROUP_CONCAT aggregate function | Spark SQL replacement for MySQL's GROUP_CONCAT aggregate function
I have a table of two string type columns (username, friend) and for each username, I want to collect all of its friends on one row, concatenated as strings. For example: ('username1', 'friends1, friends2, friends3')
I know MySQL does this with GRO... | https://stackoverflow.com/questions/31640729/spark-sql-replacement-for-mysqls-group-concat-aggregate-function | sql, apache-spark, apache-spark-sql, concatenation, aggregate-functions | 1,437,936,936 |
se_72380504 | stackoverflow | DATA_ENGINEERING | Spark SQL similar to LISTAGG() within group OR GROUP_CONCAT | Spark SQL similar to LISTAGG() within group OR GROUP_CONCAT
I need to implement a function similar to redshift listagg() within group (order by x_column) but it is important to be in Spark SQL, the one here https://spark.apache.org/docs/2.4.0/api/sql/
There is this similar question but the answer is not no SQL.
My que... | https://stackoverflow.com/questions/72380504/spark-sql-similar-to-listagg-within-group-or-group-concat | sql, apache-spark, apache-spark-sql, concatenation, aggregate | 1,653,492,829 |
se_76854920 | stackoverflow | DATA_ENGINEERING | Running Spark-Connect Server on kubernetes in cluster mode/high availability mode | Running Spark-Connect Server on kubernetes in cluster mode/high availability mode
I am trying to figure out how to effectively use the new Spark-Connect feature of Spark version >= 3.4.0. Specifically, I want so set up a kubernetes Spark cluster where various applications (mainly pyspark) will connect and submit their... | https://stackoverflow.com/questions/76854920/running-spark-connect-server-on-kubernetes-in-cluster-mode-high-availability-mod | apache-spark, kubernetes, pyspark, spark-connect | 1,691,439,266 |
se_63791178 | stackoverflow | DATA_ENGINEERING | Overwrite a Parquet file with Pyspark | Overwrite a Parquet file with Pyspark
I'm trying to overwrite a Parquet file stored in an S3 bucket using PySpark. The bucket has versioning enabled.
Here’s the code I’m using:
Initial Write (v1):
df_v1.repartition(1).write.parquet(path='s3a://bucket/file1.parquet')
Update and Overwrite (v2):
df_v1 = spark.read.parqu... | https://stackoverflow.com/questions/63791178/overwrite-a-parquet-file-with-pyspark | apache-spark, hadoop, pyspark, parquet | 1,599,557,928 |
se_70641676 | stackoverflow | DATA_ENGINEERING | how to remove every space inside string by pyspark? | how to remove every space inside string by pyspark?
df1 = spark.read.csv('/content/drive/MyDrive/BigData2021/Lecture23/datasets/cities.csv', header = True, inferSchema= True)
import pyspark.sql.functions as F
for name in df1.columns:
df1 = df1.withColumn(name, F.trim(df1[name]))
df1.show()
Here is my piece... | https://stackoverflow.com/questions/70641676/how-to-remove-every-space-inside-string-by-pyspark | apache-spark, pyspark, apache-spark-sql | 1,641,734,438 |
se_79666224 | stackoverflow | DATA_ENGINEERING | Spark cluster fails with NoSuchFileException on temporary connection files | Spark cluster fails with NoSuchFileException on temporary connection files
I have a Python celery application utilising Apache Spark for large-scale processing. Everything was going fine until today, when I received:
Exception in thread "main" java.nio.file.NoSuchFileException: /tmp/tmpkqdh2glm/connection167586659904... | https://stackoverflow.com/questions/79666224/spark-cluster-fails-with-nosuchfileexception-on-temporary-connection-files | apache-spark, hadoop, pyspark | 1,749,945,248 |
se_79628267 | stackoverflow | DATA_ENGINEERING | Error starting the driver Pod in EKS with spark submit | Error starting the driver Pod in EKS with spark submit
I am trying the deploy the spark job in the EKS cluster in AWS. However I keep getting this error when creating the driver pod. The deploy mode is set to cluster.
"failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create... | https://stackoverflow.com/questions/79628267/error-starting-the-driver-pod-in-eks-with-spark-submit | apache-spark, kubernetes, amazon-eks, spark-submit | 1,747,639,337 |
se_79665399 | stackoverflow | DATA_ENGINEERING | Is Apache Spark 3.5.5 compatible with Hive 4.0.1? If not, which Hive version is fully compatible? | Is Apache Spark 3.5.5 compatible with Hive 4.0.1? If not, which Hive version is fully compatible?
I'm currently using Apache Spark 3.5.5 (Scala 2.12, built for Hadoop 3) and trying to integrate it with Apache Hive 4.0.1 on a YARN-based Hadoop cluster but got few issues on this.
However, I'm facing several issues durin... | https://stackoverflow.com/questions/79665399/is-apache-spark-3-5-5-compatible-with-hive-4-0-1-if-not-which-hive-version-is | scala, apache-spark, hadoop, apache-spark-sql, hive | 1,749,849,819 |
se_38118572 | stackoverflow | DATA_ENGINEERING | Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources | Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
I'm trying to run the spark examples from Eclipse and getting this generic error: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered... | https://stackoverflow.com/questions/38118572/initial-job-has-not-accepted-any-resources-check-your-cluster-ui-to-ensure-that | java, hadoop, apache-spark | 1,467,277,673 |
se_79662793 | stackoverflow | DATA_ENGINEERING | Spark submit error: Hive metastore AlreadyExistsException class not found – what's the correct way to load Hive jars? | Spark submit error: Hive metastore AlreadyExistsException class not found – what's the correct way to load Hive jars?
During the spark-submit job I am getting error:
spark-submit --master yarn --deploy-mode client --executor-memory 5g --executor-cores 4 /home/hadoop/spark_data/save_data_db.py
My job fi... | https://stackoverflow.com/questions/79662793/spark-submit-error-hive-metastore-alreadyexistsexception-class-not-found-what | java, scala, apache-spark, pyspark, hive | 1,749,687,141 |
se_79661339 | stackoverflow | DATA_ENGINEERING | Pyspark aggregations optimization | Pyspark aggregations optimization
I have a huge dataframe with 3B rows. I'm running the PySpark code below with the Spark config.
spark = SparkSession\
.builder\
.appName("App")\
.config("spark.executor.memory","10g")\
.config("spark.executor.cores","4")\
.config("spark.execu... | https://stackoverflow.com/questions/79661339/pyspark-aggregations-optimization | python, dataframe, apache-spark, pyspark, aggregation | 1,749,611,733 |
se_57965426 | stackoverflow | DATA_ENGINEERING | PySpark; DecimalType multiplication precision loss | PySpark; DecimalType multiplication precision loss
When doing multiplication with PySpark, it seems PySpark is losing precision.
For example, when multiple two decimals with precision 38,10, it returns 38,6 and rounds to three decimals which is the incorrect result.
from decimal import Decimal
from pyspark.sql.types... | https://stackoverflow.com/questions/57965426/pyspark-decimaltype-multiplication-precision-loss | python, apache-spark, pyspark | 1,568,675,751 |
se_79658875 | stackoverflow | DATA_ENGINEERING | Spark convert row to multiple rows | Spark convert row to multiple rows
Spark convert half of row data into next row
I have a csv file where each line has even number of words separated by comma. I want to read the csv file and put half data from each row to next row using spark.
Example
Input
a,b,c,d,e,f,g,h
1,2,3,4,5,6,7,8
Output
a,b,c,d
e,f,g,h
1,2,3... | https://stackoverflow.com/questions/79658875/spark-convert-row-to-multiple-rows | dataframe, azure, apache-spark, pyspark, azure-databricks | 1,749,472,095 |
se_79658682 | stackoverflow | DATA_ENGINEERING | How to Convert grouped names into distinct person entries with country preserved | How to Convert grouped names into distinct person entries with country preserved
I'm working with a PySpark Data Frame that looks something like this:
+--------------+-----------+
|customer_names|country |
+--------------+-----------+
|jan,marek |Poland |
|anna,kasia |Poland |
|john,emma |New Zea... | https://stackoverflow.com/questions/79658682/how-to-convert-grouped-names-into-distinct-person-entries-with-country-preserved | apache-spark, pyspark, azure-databricks | 1,749,463,286 |
se_79655820 | stackoverflow | DATA_ENGINEERING | Databricks explicitly insert null into struct column | Databricks explicitly insert null into struct column
I'm facing an issue when inserting records into struct field in Azure Databricks using SQL.
In my INSERT INTO statement I have a condition based on which I want to insert either null or a struct.
INSERT INTO my_table (target_column_name)
SELECT
CASE
WHEN condition ... | https://stackoverflow.com/questions/79655820/databricks-explicitly-insert-null-into-struct-column | sql, azure, apache-spark, struct, databricks | 1,749,207,596 |
se_79658301 | stackoverflow | DATA_ENGINEERING | PySpark with aggregations failing | PySpark with aggregations failing
I have a 106M dataframe with nested columns, that is, I have a few columns where the values are {[1,2,3,4,5], <timestamp>, 1, 2 ,3}. I'm trying to add a few more columns using when, then do an aggregation on the dataframe.
df_1 = df.withColumn("newCol", when((col("colA.field") == 1) &... | https://stackoverflow.com/questions/79658301/pyspark-with-aggregations-failing | python, dataframe, apache-spark, pyspark, aggregate-functions | 1,749,436,244 |
se_79653046 | stackoverflow | DATA_ENGINEERING | Spark (on Scala) replace gson version in Runtime | Spark (on Scala) replace gson version in Runtime
My sbt project has the following dependency configuration:
val scyllaConnector = "com.datastax.spark" %% "spark-cassandra-connector" % "3.2.0"
val sparkHadoopCloud = "org.apache.spark" %% "spark-hadoop-cloud" % "3.3.0"
val sparkSql = "org.apache.spark"... | https://stackoverflow.com/questions/79653046/spark-on-scala-replace-gson-version-in-runtime | scala, apache-spark, sbt, dependency-management | 1,749,049,651 |
se_77763167 | stackoverflow | DATA_ENGINEERING | "TypeError: 'JavaPackage' object is not callable" in pyspark | "TypeError: 'JavaPackage' object is not callable" in pyspark
Below are my version information:
python = 3.11.5
pyspark = 3.4.1
java -version
java version "21.0.1" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed ... | https://stackoverflow.com/questions/77763167/typeerror-javapackage-object-is-not-callable-in-pyspark | python, apache-spark, pyspark, jupyter-notebook, typeerror | 1,704,441,249 |
se_79643479 | stackoverflow | DATA_ENGINEERING | Consecutive Activity using Analytical Function | Consecutive Activity using Analytical Function
I have a table containing the fields: user_ip, datetime, year, month, day, hour, tag_id, country, device_type, brand. I need to check if given a IP was active for a continuous period of 4 or more hours and flag as true / false.
A single IP can have multiple records withi... | https://stackoverflow.com/questions/79643479/consecutive-activity-using-analytical-function | sql, postgresql, apache-spark, apache-spark-sql, duration | 1,748,504,042 |
se_78039795 | stackoverflow | DATA_ENGINEERING | Why v2 is not the default reader/writer for parquet | Why v2 is not the default reader/writer for parquet
even in spark 3.5 spark.sql.sources.useV1SourceList=avro,csv,json,kafka,orc,parquet,text is there a reason that though v2 should only have advantages over v1 it's still not being used by default | https://stackoverflow.com/questions/78039795/why-v2-is-not-the-default-reader-writer-for-parquet | apache-spark | 1,708,594,417 |
se_58967542 | stackoverflow | DATA_ENGINEERING | Why does this simple spark application create so many jobs? | Why does this simple spark application create so many jobs?
I am trying to understand how jobs, stages, partitions and tasks interact in Spark. So I wrote the following simple script:
import org.apache.spark.sql.Row
case class DataRow(customer: String, ppg_desc: String, yyyymm: String, qty: Integer)
val data = Seq(
... | https://stackoverflow.com/questions/58967542/why-does-this-simple-spark-application-create-so-many-jobs | apache-spark | 1,574,312,103 |
se_78053081 | stackoverflow | DATA_ENGINEERING | Trying to use Delta Tables results in "java.lang.NoClassDefFoundError: org/apache/spark/sql/catalyst/analysis/UnresolvedLeafNode" | Trying to use Delta Tables results in "java.lang.NoClassDefFoundError: org/apache/spark/sql/catalyst/analysis/UnresolvedLeafNode"
I am trying to use Delta-Tables in a standalone spark local environment.
1a. The delta-spark package was installed:
pip install -y io.delta:delta-spark_2.12:3.1.0
1b. I am on sp... | https://stackoverflow.com/questions/78053081/trying-to-use-delta-tables-results-in-java-lang-noclassdeffounderror-org-apach | apache-spark, delta-live-tables | 1,708,791,373 |
se_74868394 | stackoverflow | DATA_ENGINEERING | Generate random number for each row in between range | Generate random number for each row in between range
I am new to Spark; I am trying to generate a random number for each row in Spark between range 1 to 30, something like:
import scala.util.Random
df.withColumn("random_num", lit(Random.nextInt(30)))
Expected output:
col1 1
col 2
abc 1
bcd 3
xyz ... | https://stackoverflow.com/questions/74868394/generate-random-number-for-each-row-in-between-range | dataframe, scala, apache-spark, apache-spark-sql | 1,671,566,828 |
se_79654063 | stackoverflow | DATA_ENGINEERING | Error with nested arrays in vanilla spark vs Databricks | Error with nested arrays in vanilla spark vs Databricks
The folllowing code works fine on a Databricks spark cluster (runtime 16.4 spark version 3.5.2)
spark.sql("""
select
array(struct(array(struct(array(struct(2.0D as latitude, 1.0D as longitude)) as shape)) as segments)) as mapped_trace
""").select("mapped_trac... | https://stackoverflow.com/questions/79654063/error-with-nested-arrays-in-vanilla-spark-vs-databricks | apache-spark, databricks | 1,749,111,606 |
se_79650259 | stackoverflow | DATA_ENGINEERING | Securely passing access key to SparkOperator for Azure DataLake on K8s | Securely passing access key to SparkOperator for Azure DataLake on K8s
I'm having problems securely passing access key to a Spark Job using SparkOperator
I've got a KIND cluster running spark jobs using SparkOperator on an Azure Data Lake account using pyspark. Currently I'm programmatically sending manifests to the S... | https://stackoverflow.com/questions/79650259/securely-passing-access-key-to-sparkoperator-for-azure-datalake-on-k8s | azure, apache-spark, hadoop, pyspark, spark-operator | 1,748,894,241 |
se_79654268 | stackoverflow | DATA_ENGINEERING | Backfill (streaming) jobs | Backfill (streaming) jobs
I have Spark notebooks for ingesting data from queue(kafka etc) to the bronze layer tables(for instance lh_bronze.order_delta) in the lakehouse. These notebooks are ingesting cdc data.
for backfill(historical data) we need to ingest all sales history. however it is not feasible to send all hi... | https://stackoverflow.com/questions/79654268/backfill-streaming-jobs | apache-spark, streaming, spark-streaming, spark-structured-streaming | 1,749,119,368 |
se_40028919 | stackoverflow | DATA_ENGINEERING | How to run a script in PySpark | How to run a script in PySpark
I'm trying to run a script in the pyspark environment but so far I haven't been able to.
How can I run a script like python script.py but in pyspark? | https://stackoverflow.com/questions/40028919/how-to-run-a-script-in-pyspark | apache-spark, pyspark | 1,476,385,245 |
se_79652673 | stackoverflow | DATA_ENGINEERING | How to merge two dataframes based on matching rows using spark scala | How to merge two dataframes based on matching rows using spark scala
I have two dataframes like below, and I need to merge them based on matching rows.
Dataframe 1
ID
status
V1
Low
V2
Low
V3
Low
Dataframe 2
ID
status
V1
High
V2
High
V6
High
Expected dataframe like below
ID
status
V1
... | https://stackoverflow.com/questions/79652673/how-to-merge-two-dataframes-based-on-matching-rows-using-spark-scala | dataframe, scala, apache-spark, apache-spark-sql | 1,749,037,196 |
se_79652910 | stackoverflow | DATA_ENGINEERING | Overwrite is failing with "pyspark.errors.exceptions.captured.AnalysisException: Table does not support truncate in batch mode" | Overwrite is failing with "pyspark.errors.exceptions.captured.AnalysisException: Table does not support truncate in batch mode"
I upgraded PySpark from 3.5.5 to 3.5.6, and now all unit tests with an overwrite operation are failing with this error:
pyspark.errors.exceptions.captured.AnalysisException: Table d... | https://stackoverflow.com/questions/79652910/overwrite-is-failing-with-pyspark-errors-exceptions-captured-analysisexception | apache-spark, pyspark, apache-spark-sql | 1,749,045,041 |
se_79652504 | stackoverflow | DATA_ENGINEERING | Apache Spark pyspark interactive shell SyntaxError: Perhaps you forgot a comma? Env var SPARK_CONNECT_MODE unknown value or pyspark.util unavailable | Apache Spark pyspark interactive shell SyntaxError: Perhaps you forgot a comma? Env var SPARK_CONNECT_MODE unknown value or pyspark.util unavailable
I'm following the Quick Start of Apache Spark. I downloaded the Apache Spark 4.0.0 from https://spark.apache.org/releases/spark-release-4-0-0.html. I also tried to instal... | https://stackoverflow.com/questions/79652504/apache-spark-pyspark-interactive-shell-syntaxerror-perhaps-you-forgot-a-comma | apache-spark, pyspark | 1,749,030,155 |
se_65510115 | stackoverflow | DATA_ENGINEERING | java.util.NoSuchElementException: None.get Error in show() operation of Spark | java.util.NoSuchElementException: None.get Error in show() operation of Spark
I tried to retrieve data from Greenplum database and show it using Pyspark.This is the code that I have implemented.
import pyspark
from pyspark import SparkContext,SparkConf
from pyspark.sql import SparkSession
from pyspark.sql import SQLC... | https://stackoverflow.com/questions/65510115/java-util-nosuchelementexception-none-get-error-in-show-operation-of-spark | apache-spark, pyspark, apache-spark-sql, greenplum | 1,609,345,087 |
se_79493179 | stackoverflow | DATA_ENGINEERING | pyspark.errors.exceptions.base.PySparkTypeError: [CANNOT_MERGE_TYPE] Can not merge type `BooleanType` and `DoubleType` | pyspark.errors.exceptions.base.PySparkTypeError: [CANNOT_MERGE_TYPE] Can not merge type `BooleanType` and `DoubleType`
I have a API response, which I'm normalizing the Json response. While trying to convert from pandas to spark dataframe, it's failing with below error,
pyspark.errors.exceptions.base.PySparkTypeError: ... | https://stackoverflow.com/questions/79493179/pyspark-errors-exceptions-base-pysparktypeerror-cannot-merge-type-can-not-mer | json, pandas, apache-spark, pyspark | 1,741,371,784 |
se_79648776 | stackoverflow | DATA_ENGINEERING | Spark memoryOverheadFactor is set to 0.1 instead of 0.4 for non-JVM workloads | Spark memoryOverheadFactor is set to 0.1 instead of 0.4 for non-JVM workloads
I submit a Pyspark application on Kubernetes (EKS on EC2) and when I check the container memory request and limit, I can see that the memoryOverheadFactor is set to 0.1 by default instead of 0.4 (memory request and limit = memory + memory*me... | https://stackoverflow.com/questions/79648776/spark-memoryoverheadfactor-is-set-to-0-1-instead-of-0-4-for-non-jvm-workloads | apache-spark, kubernetes, pyspark, amazon-eks | 1,748,869,299 |
se_79647030 | stackoverflow | DATA_ENGINEERING | Check num partitions on a dataframe in spark connect | Check num partitions on a dataframe in spark connect
In normal pyspark, I can check the number of partitions on a dataframe using the rdd api. In spark connect, that api isn't available. Is there another way people have found to check the number of partitions on a spark connect dataframe?
I've tried the normal df.rdd.... | https://stackoverflow.com/questions/79647030/check-num-partitions-on-a-dataframe-in-spark-connect | apache-spark, pyspark | 1,748,730,096 |
se_27023766 | stackoverflow | DATA_ENGINEERING | Spark iterate HDFS directory | Spark iterate HDFS directory
I have a directory of directories on HDFS, and I want to iterate over the directories. Is there any easy way to do this with Spark using the SparkContext object? | https://stackoverflow.com/questions/27023766/spark-iterate-hdfs-directory | hadoop, hdfs, apache-spark | 1,416,420,078 |
se_68553107 | stackoverflow | DATA_ENGINEERING | Spark 2.3 (Scala) - Convert a timestamp column from UTC to timezone specified in another column | Spark 2.3 (Scala) - Convert a timestamp column from UTC to timezone specified in another column
I have a data frame with data like this:
+----------------------+------------+
| utc_timestamp | tz_locale |
+----------------------+------------+
|2021-07-16T10:00:00Z | US/Eastern |
|2021-07-1... | https://stackoverflow.com/questions/68553107/spark-2-3-scala-convert-a-timestamp-column-from-utc-to-timezone-specified-in | scala, apache-spark, apache-spark-sql, timestamp-with-timezone | 1,627,432,844 |
se_54018795 | stackoverflow | DATA_ENGINEERING | How to add List[String] values to a single column in Dataframe | How to add List[String] values to a single column in Dataframe
I have a dataframe, I have a list of values (possibly list string) and I want to create a new column in my dataframe and add those list values as column values to this new column. I tried
val x = List("def", "cook", "abc")
val c_df = null
x.foldLeft(c_df... | https://stackoverflow.com/questions/54018795/how-to-add-liststring-values-to-a-single-column-in-dataframe | scala, apache-spark | 1,546,504,583 |
se_79645852 | stackoverflow | DATA_ENGINEERING | StructType.add() behavior differs between PySpark and Scala Spark | StructType.add() behavior differs between PySpark and Scala Spark
I'm working with Spark schemas in both PySpark and Scala, and I've noticed that the behavior of StructType.add() is different between the two languages. This is causing some confusion.
Python (PySpark) example:
from pyspark.sql.types import StructType, ... | https://stackoverflow.com/questions/79645852/structtype-add-behavior-differs-between-pyspark-and-scala-spark | scala, apache-spark, pyspark, databricks | 1,748,625,435 |
se_79645559 | stackoverflow | DATA_ENGINEERING | Kubernetes Java Client (OpenAPI) fails to deserialize JSON response in Spark context | Kubernetes Java Client (OpenAPI) fails to deserialize JSON response in Spark context
Spark Application Running in Kubernetes Cluster.
The Spark context is initialized by the Google Spark Operator.
Spark dependencies are:
"org.apache.spark" %% "spark-hadoop-cloud" % "3.3.0"
"org.apache.spark" %% "spark-sql" ... | https://stackoverflow.com/questions/79645559/kubernetes-java-client-openapi-fails-to-deserialize-json-response-in-spark-con | apache-spark, kubernetes, dependencies, gson | 1,748,612,232 |
se_79645297 | stackoverflow | DATA_ENGINEERING | Not able to run Pipeline Model load functions unity catalog cluster | Not able to run Pipeline Model load functions unity catalog cluster
ISSUE -- Not able to run PipelineModel load functions unity catalog cluster
ERROR --[JVM_ATTRIBUTE_NOT_SUPPORTED] Attribute sparkContext is not supported in Spark Connect as it depends on the JVM. If you need to use this attribute, do not use Spark Co... | https://stackoverflow.com/questions/79645297/not-able-to-run-pipeline-model-load-functions-unity-catalog-cluster | apache-spark, pyspark | 1,748,600,643 |
se_79279823 | stackoverflow | DATA_ENGINEERING | AdminClient clientId=adminclient-1 Node 1 disconnected. Apache Kafka y Spark | AdminClient clientId=adminclient-1 Node 1 disconnected. Apache Kafka y Spark
I'm running a Docker Compose setup with Spark and Kafka, but I'm encountering connectivity issues when Spark tries to connect to Kafka. My docker-compose.yml file includes services for both Kafka and Spark, and everything seems to be set up c... | https://stackoverflow.com/questions/79279823/adminclient-clientid-adminclient-1-node-1-disconnected-apache-kafka-y-spark | docker, apache-spark, apache-kafka, docker-compose, containers | 1,734,133,788 |
se_79643300 | stackoverflow | DATA_ENGINEERING | Flaky test failure with ParallelTestExecution in scala due to LiveListenerBus being stopped | Flaky test failure with ParallelTestExecution in scala due to LiveListenerBus being stopped
To test spark in scala I use the following testing library: Link. In the library it is suggested to not use parallelExecution in Test := true due to issues with spark running on single JVM and multiple tests try to access same ... | https://stackoverflow.com/questions/79643300/flaky-test-failure-with-paralleltestexecution-in-scala-due-to-livelistenerbus-be | scala, unit-testing, apache-spark, jvm | 1,748,493,863 |
se_39400101 | stackoverflow | DATA_ENGINEERING | How to load Impala table directly to Spark using JDBC? | How to load Impala table directly to Spark using JDBC?
I am trying to write a spark job with Python that would open a jdbc connection with Impala and load a VIEW directly from Impala into a Dataframe. This question is pretty close but in scala: Calling JDBC to impala/hive from within a spark job and creating a table
... | https://stackoverflow.com/questions/39400101/how-to-load-impala-table-directly-to-spark-using-jdbc | jdbc, apache-spark, pyspark, kerberos, impala | 1,473,368,326 |
se_59915130 | stackoverflow | DATA_ENGINEERING | Spark collect limited sorted list | Spark collect limited sorted list
I am trying to use spark to create a limited sorted list for data frame however I am not able to think of a fast and a low memory approach.
My data frame consists of three columns two keys ids and a distance column and I want to get list of top n=50 ids close to each of the ids. I tr... | https://stackoverflow.com/questions/59915130/spark-collect-limited-sorted-list | scala, apache-spark, memory, aggregation, collect | 1,580,006,534 |
se_79640162 | stackoverflow | DATA_ENGINEERING | Consecutive User Details in Simple Approach | Consecutive User Details in Simple Approach
I have a table containing the fields: ip, datetime, year, month, day, country, region, seen_time. A single IP can have multiple records within the same hour. I need to identify IPs that were continuously active for at least 4 hours.
The desired output should include: ip, dat... | https://stackoverflow.com/questions/79640162/consecutive-user-details-in-simple-approach | sql, apache-spark, pyspark, apache-spark-sql | 1,748,337,441 |
se_79088745 | stackoverflow | DATA_ENGINEERING | Spark append outputmode doesn't close previous tumbling window? | Spark append outputmode doesn't close previous tumbling window?
I have one text file that looks like this:
a.txt
-----
John,100
I have the following spark app:
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark.sql.types import IntegerType, StructField, StringType, StructType... | https://stackoverflow.com/questions/79088745/spark-append-outputmode-doesnt-close-previous-tumbling-window | apache-spark, pyspark | 1,728,975,547 |
se_60765884 | stackoverflow | DATA_ENGINEERING | What does `[4]` in `spark-submit --master local[4]` mean? | What does `[4]` in `spark-submit --master local[4]` mean?
https://spark.apache.org/docs/latest/quick-start.html#self-contained-applications says
# Use spark-submit to run your application
$ YOUR_SPARK_HOME/bin/spark-submit \
--class "SimpleApp" \
--master local[4] \
target/scala-2.12/simple-project_2.12-1.0.jar
... | https://stackoverflow.com/questions/60765884/what-does-4-in-spark-submit-master-local4-mean | apache-spark | 1,584,656,365 |
se_79627268 | stackoverflow | DATA_ENGINEERING | Spark Streaming job gets stuck in the "Stream Initializing" | Spark Streaming job gets stuck in the "Stream Initializing"
I am having an issue with my Spark Streaming Job in databricks. It is stuck at "Stream Initializing" stage.
Need your help here to understand what is happening inside the "Stream Initializing" stage of Spark Streaming job which is taking so long. He... | https://stackoverflow.com/questions/79627268/spark-streaming-job-gets-stuck-in-the-stream-initializing | azure, apache-spark, databricks | 1,747,557,250 |
se_51949296 | stackoverflow | DATA_ENGINEERING | aes_encrypt doesn't exist in Spark | aes_encrypt doesn't exist in Spark
I need to encrypt some columns in Hive tables. Normally I used for that aes_encrypt UDF function in Hive. However, seems like it doesn't exists in Spark.
Is there any existing alternative in Spark or I just need to write my own UDF? | https://stackoverflow.com/questions/51949296/aes-encrypt-doesnt-exist-in-spark | apache-spark, hive, apache-spark-sql | 1,534,856,467 |
se_59145296 | stackoverflow | DATA_ENGINEERING | Convert UTC timestamp to local time based on time zone in PySpark | Convert UTC timestamp to local time based on time zone in PySpark
I have a PySpark DataFrame, df, with some columns as shown below. The hour column is in UTC time and I want to create a new column that has the local time based on the time_zone column. How can I do that in PySpark?
df
+-------------------------+-... | https://stackoverflow.com/questions/59145296/convert-utc-timestamp-to-local-time-based-on-time-zone-in-pyspark | apache-spark, pyspark, apache-spark-sql | 1,575,313,977 |
se_79632289 | stackoverflow | DATA_ENGINEERING | DDL Syntax for ArrayType considering containsNull | DDL Syntax for ArrayType considering containsNull
What does a Spark SQL table creation script look like that creates a table with an array column whose values must not be NULL (containsNull=False)?
In other words:
What is the SQL DDL equivalent of StructType([StructField("array_col", ArrayType(StringType(), False))])
... | https://stackoverflow.com/questions/79632289/ddl-syntax-for-arraytype-considering-containsnull | apache-spark, pyspark, azure-databricks | 1,747,840,605 |
se_79635424 | stackoverflow | DATA_ENGINEERING | How to run more tasks than cores in a worker? | How to run more tasks than cores in a worker?
I'm running a code in Azure Databricks, it's a Python code to read from a Delta Lake and write to a SQL Server database. I can use 4 workers (each one 4 cores, 32GB), and I put a repartition of 16 to create 16 tasks.
df = df.repartition(16)
While doing it, I see 16 tasks ... | https://stackoverflow.com/questions/79635424/how-to-run-more-tasks-than-cores-in-a-worker | apache-spark, pyspark, databricks, azure-databricks | 1,747,999,706 |
se_50575490 | stackoverflow | DATA_ENGINEERING | Spark 2.x - How to generate simple Explain/Execution Plan | Spark 2.x - How to generate simple Explain/Execution Plan
I am hoping to generate an explain/execution plan in Spark 2.2 with some actions on a dataframe. The goal here is to ensure that partition pruning is occurring as expected before I kick off the job and consume cluster resources. I tried a Spark documentation ... | https://stackoverflow.com/questions/50575490/spark-2-x-how-to-generate-simple-explain-execution-plan | scala, apache-spark, scala-2.11, apache-spark-2.2 | 1,527,560,579 |
se_55993313 | stackoverflow | DATA_ENGINEERING | Not serialazable exception while running Linear regression scala 2.12 | Not serialazable exception while running Linear regression scala 2.12
While running the following spark mllib on local mode with scala 2.12.3 , encountered the following error lambda not serialazable
Any inputs would be much appreciated ?
(Moving onto scala 2.11 is not an option for me) Can you please let me know wh... | https://stackoverflow.com/questions/55993313/not-serialazable-exception-while-running-linear-regression-scala-2-12 | scala, apache-spark, apache-spark-mllib, scala-2.12 | 1,557,068,363 |
se_78077484 | stackoverflow | DATA_ENGINEERING | Spark2 to Spark3 Upgrade -> DataFrame foreachPartition method does not work | Spark2 to Spark3 Upgrade -> DataFrame foreachPartition method does not work
This code works in Spark 2.4 with Scala 2.11.7. It is not working in Spark 3.4.2 with Scala 2.12.15.
I have tried Running change the foreachPartition(parti => { })
to
.foreachPartition((parti: Iterator[Row]) => {
it didn't worked. I am stru... | https://stackoverflow.com/questions/78077484/spark2-to-spark3-upgrade-dataframe-foreachpartition-method-does-not-work | scala, apache-spark, scala-2.12, apache-spark-3.0 | 1,709,153,135 |
se_79210262 | stackoverflow | DATA_ENGINEERING | Spark struct to case class conversion issues with getAs[T] | Spark struct to case class conversion issues with getAs[T]
I often use the map function on spark Dataset rows to do transformations in Scala on typed objects. My usual pattern is to convert intermediate results created from data frame transformations (withColumn, groupBy, etc.) and create a typed Dataset of the interm... | https://stackoverflow.com/questions/79210262/spark-struct-to-case-class-conversion-issues-with-getast | dataframe, scala, apache-spark, dataset, scala-2.12 | 1,732,177,528 |
se_79635232 | stackoverflow | DATA_ENGINEERING | Continuous shuffle with Spark Structured Streaming | Continuous shuffle with Spark Structured Streaming
I am trying to develop a custom source for Spark Structured Streaming, using microbatches. The idea is to:
Consume a queue (SQS) that contains notifications with file links (S3);
As notifications arrive, gradually shuffle the file links based on a certain substring, ... | https://stackoverflow.com/questions/79635232/continuous-shuffle-with-spark-structured-streaming | apache-spark, spark-structured-streaming | 1,747,992,408 |
se_79629190 | stackoverflow | DATA_ENGINEERING | See table sizes in unity catalog | See table sizes in unity catalog
I am migrating tables from the hive_metastore to Unity Catalog for my Databricks workspaces.
I was wondering if there is a way to find out the number of rows or number of files for tables registered in Unity Catalog.
I have a lot of tables, and I would like to run a query that lists th... | https://stackoverflow.com/questions/79629190/see-table-sizes-in-unity-catalog | azure, apache-spark, pyspark, azure-databricks, databricks-unity-catalog | 1,747,674,227 |
se_79632620 | stackoverflow | DATA_ENGINEERING | Extract multiple strings from a column in a new column as a list in pyspark dataframe | Extract multiple strings from a column in a new column as a list in pyspark dataframe
Have a pyspark dataframe with a single column with below values (Only 2 records for example)-
+------------------------------------------------------------------------------------------------------+
|data ... | https://stackoverflow.com/questions/79632620/extract-multiple-strings-from-a-column-in-a-new-column-as-a-list-in-pyspark-data | python, json, apache-spark, pyspark | 1,747,854,587 |
se_78942881 | stackoverflow | DATA_ENGINEERING | Reading / Fixing a corrupt parquet file | Reading / Fixing a corrupt parquet file
I have a parquet file, that was being written on by a continuous loop as follows:
def process_data(self):
#... other code ...
with pq.ParquetWriter(self.destination_file, schema) as writer:
with tqdm(total=total_rows, desc="Processing nodes") as ... | https://stackoverflow.com/questions/78942881/reading-fixing-a-corrupt-parquet-file | apache-spark, pyspark, parquet, pyarrow | 1,725,343,703 |
se_79629340 | stackoverflow | DATA_ENGINEERING | Poor performance with PySpark write to parquet | Poor performance with PySpark write to parquet
I can make PySpark "work" no problem, but know very little and am very confused by documentation on performance. I have some source data partitioned by date, read it directory by directory (one parquet file in each of about 1-2gb) for a specified number of days, append t... | https://stackoverflow.com/questions/79629340/poor-performance-with-pyspark-write-to-parquet | apache-spark, pyspark, apache-spark-sql, azure-synapse | 1,747,681,899 |
se_79631304 | stackoverflow | DATA_ENGINEERING | Why are Spark and Yarn logs not available for a decommissioned node in HDInsight | Why are Spark and Yarn logs not available for a decommissioned node in HDInsight
I like HDInsight. It is a efficient and productive tool for hosting Spark jobs. However I noticed that Spark and Yarn logs are not always available for decommissioned nodes.
In scenarios where a cluster scales up and down during the work... | https://stackoverflow.com/questions/79631304/why-are-spark-and-yarn-logs-not-available-for-a-decommissioned-node-in-hdinsight | azure, apache-spark, azure-hdinsight | 1,747,783,923 |
se_79628867 | stackoverflow | DATA_ENGINEERING | Difference between checkpoints and change streams | Difference between checkpoints and change streams
I am trying to understand the difference between the two most common strategies of incremental data load.
What is the difference between a streaming checkpoint vs a change stream in Databricks Delta Lake?
Thanks. | https://stackoverflow.com/questions/79628867/difference-between-checkpoints-and-change-streams | apache-spark, pyspark, delta-lake, incremental-load | 1,747,662,215 |
se_79626127 | stackoverflow | DATA_ENGINEERING | Spark S3 "Zero Rename" Committer: FileAlreadyExistsException in Append Mode | Spark S3 "Zero Rename" Committer: FileAlreadyExistsException in Append Mode
I implemented the 'zero rename' committer as described in the Spark documentation. The specific configuration I used is available via the following link.
spark.hadoop.fs.s3a.committer.name directory
spark.sql.sources.commitProtocolCl... | https://stackoverflow.com/questions/79626127/spark-s3-zero-rename-committer-filealreadyexistsexception-in-append-mode | scala, apache-spark, amazon-s3, hadoop | 1,747,450,641 |
se_78798843 | stackoverflow | DATA_ENGINEERING | Why Spark independent Actions in Spark App / Notebook do not run in parallel standardly | Why Spark independent Actions in Spark App / Notebook do not run in parallel standardly
In the past I was aware of the fact that that Actions in a Notebook or Spark App would run sequentially. Also, completely independent Actions. That is what I thought until someone stated on SO - cannot find that anymore - that ind... | https://stackoverflow.com/questions/78798843/why-spark-independent-actions-in-spark-app-notebook-do-not-run-in-parallel-sta | apache-spark, databricks | 1,722,007,149 |
se_75787001 | stackoverflow | DATA_ENGINEERING | java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest with Apache Spark in SpringBoot with ApplicationRunner | java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest with Apache Spark in SpringBoot with ApplicationRunner
I am trying to run Apache Spark 3.3.2 with Spring Boot 2.6.6 with ApplicationRunner Java 17 Mac OS; I have set this in the application.properties: spring.main.web-application-type=none
Spring Ap... | https://stackoverflow.com/questions/75787001/java-lang-noclassdeffounderror-javax-servlet-http-httpservletrequest-with-apach | java, spring, spring-boot, apache-spark | 1,679,292,272 |
se_79612981 | stackoverflow | DATA_ENGINEERING | What is the equivalent of apache spark's collectAsList method in apache beam? | What is the equivalent of apache spark's collectAsList method in apache beam?
As per this link, it is not easy to convert a PCollection to List.
Additional link
Whereas in apache spark, collectAsList() helps convert all elements of dataset to list.
Why spark allows it with collectAsList method but beam does not? I... | https://stackoverflow.com/questions/79612981/what-is-the-equivalent-of-apache-sparks-collectaslist-method-in-apache-beam | apache-spark, apache-beam | 1,746,729,494 |
se_76618374 | stackoverflow | DATA_ENGINEERING | Spark 3.4.1, Jakarta Servlet 6.0.0 Compatibility Issue | Spark 3.4.1, Jakarta Servlet 6.0.0 Compatibility Issue
I am attempting to create a Spark session in a Spring application. Since Spark uses Jersey servlet. On adding the following dependency, I get the following error:
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId... | https://stackoverflow.com/questions/76618374/spark-3-4-1-jakarta-servlet-6-0-0-compatibility-issue | spring-boot, apache-spark, jakarta-migration | 1,688,545,052 |
se_76994437 | stackoverflow | DATA_ENGINEERING | MongoDB-PySpark: StringType has no matching BsonValue | MongoDB-PySpark: StringType has no matching BsonValue
I'm trying to write data to Mongodb, and I'm having the following error:
StringType has no matching BsonValue. Error: For input string: "457133333333672364913"
while saving the dataframe to mongodb using pyspark.
To save the dataframe I'm using:
(df
.write
.... | https://stackoverflow.com/questions/76994437/mongodb-pyspark-stringtype-has-no-matching-bsonvalue | python, mongodb, apache-spark, pyspark | 1,693,239,099 |
se_78473063 | stackoverflow | DATA_ENGINEERING | java.lang.IllegalArgumentException: Cannot initialize HadoopCatalog because warehousePath must not be null or empty | java.lang.IllegalArgumentException: Cannot initialize HadoopCatalog because warehousePath must not be null or empty
I want to write iceberg format with directory based catalog in hadoop.
But I get java.lang.IllegalArgumentException: Cannot initialize HadoopCatalog because warehousePath must not be null error.
I follow... | https://stackoverflow.com/questions/78473063/java-lang-illegalargumentexception-cannot-initialize-hadoopcatalog-because-ware | apache-spark, apache-iceberg | 1,715,611,456 |
se_79628134 | stackoverflow | DATA_ENGINEERING | Left join in pyspark works like inner join | Left join in pyspark works like inner join
Here is my code:
joined = deals_parsed.alias("deals").join(
transactions_parsed.alias("transactions"),
expr("""
deals.symbol = transactions.symbol AND
deals.timestamp >= transactions.timestamp AND
deals.timestamp <= transactions.timestamp + interval 1 seco... | https://stackoverflow.com/questions/79628134/left-join-in-pyspark-works-like-inner-join | python, apache-spark, pyspark | 1,747,633,385 |
se_79615366 | stackoverflow | DATA_ENGINEERING | Why am I getting [DATA_SOURCE_NOT_FOUND] for Iceberg on Azure Databricks despite correct JAR and config? | Why am I getting [DATA_SOURCE_NOT_FOUND] for Iceberg on Azure Databricks despite correct JAR and config?
Trying to get azure databricks running with iceberg. I understand that in shared computes, we need admin privilege to "whitelist" the iceberg jar files.
So running this in personal computes with a runtime of
16.3 ... | https://stackoverflow.com/questions/79615366/why-am-i-getting-data-source-not-found-for-iceberg-on-azure-databricks-despite | python, apache-spark, databricks, azure-databricks, apache-iceberg | 1,746,871,480 |
se_79626652 | stackoverflow | DATA_ENGINEERING | sizeInBytes in ShuffleQueryStage node in Spark Query plan | sizeInBytes in ShuffleQueryStage node in Spark Query plan
What is sizeInBytes in ShuffleQueryStage node in a Spark execution plan?
I have a stage to read from ext. source with Shuffle Write = 1.8 TiB
AQE ShuffleQueryStage sizeInBytes shows 7.4 TiB
And the next stage (where join happens) shows Spill(memory) = 7.3 TiB a... | https://stackoverflow.com/questions/79626652/sizeinbytes-in-shufflequerystage-node-in-spark-query-plan | apache-spark, pyspark, apache-spark-sql | 1,747,492,511 |
se_78101252 | stackoverflow | DATA_ENGINEERING | Is there a way to specify a schema for Spark DataFrame, while allowing new fields to be added? | Is there a way to specify a schema for Spark DataFrame, while allowing new fields to be added?
I have data coming in JSON format. Sometimes some required columns can be missing in the data. I am using a schema to provide the structure of JSON. This fixes missing fields in the nested structure (it adds them with NULL v... | https://stackoverflow.com/questions/78101252/is-there-a-way-to-specify-a-schema-for-spark-dataframe-while-allowing-new-field | apache-spark, pyspark, schema, jsonschema | 1,709,555,571 |
se_43979730 | stackoverflow | DATA_ENGINEERING | Does Spark support the WITH clause like SQL? | Does Spark support the WITH clause like SQL?
I have table employee_1 in Spark with attributes id and name(with data), and another table, employee_2, with the same attributes. I want to load the data by increasing the id values with +1.
My WITH clause is shown below:
WITH EXP AS (SELECT ALIASNAME.ID+1 ID, ALIASNAME.NA... | https://stackoverflow.com/questions/43979730/does-spark-support-the-with-clause-like-sql | apache-spark, hadoop, pyspark, apache-spark-sql, apache-spark-3.0 | 1,494,851,676 |
se_21185092 | stackoverflow | DATA_ENGINEERING | Apache Spark: map vs mapPartitions? | Apache Spark: map vs mapPartitions?
What's the difference between an RDD's map and mapPartitions method? And does flatMap behave like map or like mapPartitions? Thanks.
(edit)
i.e. what is the difference (either semantically or in terms of execution) between
def map[A, B](rdd: RDD[A], fn: (A => B))
... | https://stackoverflow.com/questions/21185092/apache-spark-map-vs-mappartitions | java, scala, performance, apache-spark, rdd | 1,389,958,872 |
se_53336781 | stackoverflow | DATA_ENGINEERING | Adding a new column in the first ordinal position in a pyspark dataframe | Adding a new column in the first ordinal position in a pyspark dataframe
I have a pyspark data frame like:
+--------+-------+-------+
| col1 | col2 | col3 |
+--------+-------+-------+
| 25 | 01 | 2 |
| 23 | 12 | 5 |
| 11 | 22 | 8 |
+--------+-------+-------+
and I want to crea... | https://stackoverflow.com/questions/53336781/adding-a-new-column-in-the-first-ordinal-position-in-a-pyspark-dataframe | python, apache-spark, pyspark, apache-spark-sql | 1,542,366,976 |
se_69934634 | stackoverflow | DATA_ENGINEERING | XGBoost4j-spark prediction on sparse vector from local model | XGBoost4j-spark prediction on sparse vector from local model
I am running on Databricks. I am trying to use an xgboost model that was trained locally in R for distributed predictions using xgboost4j-spark in scala. The data is in a Dataframe with a features column of sparse vectors from org.apache.spark.ml.linalg.Vect... | https://stackoverflow.com/questions/69934634/xgboost4j-spark-prediction-on-sparse-vector-from-local-model | scala, apache-spark, xgboost | 1,636,663,013 |
se_79594420 | stackoverflow | DATA_ENGINEERING | Spark log files getting truncated in yarn cluster mode | Spark log files getting truncated in yarn cluster mode
In spark running in yarn cluster mode, the log files - stderr and stdout, are getting truncated within a minute. Not sure which process or config is doing so.What could be the cause of truncation?
Tried using custom log4j.properties with log rotation of files bas... | https://stackoverflow.com/questions/79594420/spark-log-files-getting-truncated-in-yarn-cluster-mode | apache-spark, hadoop-yarn | 1,745,702,306 |
se_79474442 | stackoverflow | DATA_ENGINEERING | GoogleHadoopOutputStream: hflush(): No-op due to rate limit: Increase in class A operation for gcs bucket | GoogleHadoopOutputStream: hflush(): No-op due to rate limit: Increase in class A operation for gcs bucket
We are running our spark ingestion jobs which process multiple files in batches.
We read csv or tsv files in batches and create a dataframe and do some transformations before loading it into big query table.
Jobs ... | https://stackoverflow.com/questions/79474442/googlehadoopoutputstream-hflush-no-op-due-to-rate-limit-increase-in-class-a | apache-spark, hadoop, google-cloud-storage, hadoop-yarn, google-cloud-dataproc | 1,740,713,675 |
se_79624150 | stackoverflow | DATA_ENGINEERING | How to properly recalculate Spark DataFrame statistics after checkpoint? | How to properly recalculate Spark DataFrame statistics after checkpoint?
Here is minimal example using default data in DataBricks (Spark 3.4):
import org.apache.spark.sql.functions.col
import org.apache.spark.sql.{Row, SparkSession}
import org.apache.spark.sql.types._
sc.setCheckpointDir("dbfs:/tmp/rdd-checkpoints")
... | https://stackoverflow.com/questions/79624150/how-to-properly-recalculate-spark-dataframe-statistics-after-checkpoint | scala, apache-spark, pyspark, apache-spark-sql, rdd | 1,747,341,817 |
se_79623557 | stackoverflow | DATA_ENGINEERING | pySpark within AWS Lambda container | pySpark within AWS Lambda container
I want to create a lambda function using pyspark to ingest a small amount of data into a datalake in order to avoid the (costly) overhead of glue jobs. I created a custom docker image. Even though the image works locally, I fail to execute it within aws.
I made sure, all environment... | https://stackoverflow.com/questions/79623557/pyspark-within-aws-lambda-container | apache-spark, pyspark, aws-lambda | 1,747,318,694 |
se_37566321 | stackoverflow | DATA_ENGINEERING | Spark random forest binary classifier metrics | Spark random forest binary classifier metrics
How can we get model metrics when training a random forest binary classifier model in Spark Mllib (F score, AUROC, AUPRC etc.)?
The issue is that BinaryClassificationMetrics takes probabilities while the predict method of a RandomForest classifier returns discrete values ... | https://stackoverflow.com/questions/37566321/spark-random-forest-binary-classifier-metrics | scala, apache-spark, apache-spark-mllib | 1,464,777,593 |
se_70620074 | stackoverflow | DATA_ENGINEERING | Serving multiple ML models using MLflow in a single VM | Serving multiple ML models using MLflow in a single VM
I have setup an MLflow service in a VM and I am able to serve the model using the mlflow serve command. How can I host multiple models in a single VM?
I am using the below command to serve a model using MLflow in a VM.
Command:
/mlflow models serve -m models:/$Mod... | https://stackoverflow.com/questions/70620074/serving-multiple-ml-models-using-mlflow-in-a-single-vm | apache-spark, machine-learning, databricks, mlflow | 1,641,552,500 |
se_77079396 | stackoverflow | DATA_ENGINEERING | Change the spark's context web ui url in kubernetes for a url accessible from outside the cluster | Change the spark's context web ui url in kubernetes for a url accessible from outside the cluster
Hell everyone, I have a problem with Apache Spark (version 3.3.1) on k8s.
In short:
When I run the statement
print(sc.uiWebUrl)
within a pod, I would get a URL that is accessible from outside the k8s cluster.
Somethi... | https://stackoverflow.com/questions/77079396/change-the-sparks-context-web-ui-url-in-kubernetes-for-a-url-accessible-from-ou | apache-spark, kubernetes, pyspark, spark-ui | 1,694,414,543 |
se_70460695 | stackoverflow | DATA_ENGINEERING | Example for CREATE TABLE on TRINO using HUDI | Example for CREATE TABLE on TRINO using HUDI
I am using Spark Structured Streaming (3.1.1) to read data from Kafka and use HUDI (0.8.0) as the storage system on S3 partitioning the data by date. (no problems with this section)
I am looking to use Trino (355) to be able to query that data. As a pre-curser, I've already... | https://stackoverflow.com/questions/70460695/example-for-create-table-on-trino-using-hudi | apache-spark, create-table, trino, apache-hudi | 1,640,254,767 |
se_68838344 | stackoverflow | DATA_ENGINEERING | Spark ignores timezone of a timestamp | Spark ignores timezone of a timestamp
I have tried to load to a spark data frame but seems like it ignores the timezone of a timestamp and uses spark timezone instead. Here is a code to run it.
from pyspark.sql import SparkSession, Row
from datetime import datetime
import pytz
import os
spark = SparkSession.builder.ge... | https://stackoverflow.com/questions/68838344/spark-ignores-timezone-of-a-timestamp | apache-spark, pyspark | 1,629,315,242 |
se_79620319 | stackoverflow | DATA_ENGINEERING | How Do I Use a Managed Identity to Read/Write against Azure EventHub from a Synapse Spark Job using Scala | How Do I Use a Managed Identity to Read/Write against Azure EventHub from a Synapse Spark Job using Scala
I'm writing a function for a spark job in Scala (v2.12.17) to write events to an Azure Event Hub using a managed identity (this part is critical). I want it to run on an Azure Synapse Spark pool (spark v3.4). I'... | https://stackoverflow.com/questions/79620319/how-do-i-use-a-managed-identity-to-read-write-against-azure-eventhub-from-a-syna | scala, apache-spark, azure-synapse, azure-eventhub, azure-managed-identity | 1,747,164,283 |
se_38660907 | stackoverflow | DATA_ENGINEERING | How to get the number of workers(executors) in PySpark? | How to get the number of workers(executors) in PySpark?
I need to use this parameter, so how can I get the number of workers?
Like in Scala, I can call sc.getExecutorMemoryStatus to get the available number of workers. But in PySpark, it seems there's no API exposed to get this number. | https://stackoverflow.com/questions/38660907/how-to-get-the-number-of-workersexecutors-in-pyspark | scala, apache-spark, pyspark | 1,469,801,234 |
se_32233575 | stackoverflow | DATA_ENGINEERING | Read all files in a nested folder in Spark | Read all files in a nested folder in Spark
If we have a folder folder having all .txt files, we can read them all using sc.textFile("folder/*.txt"). But what if I have a folder folder containing even more folders named datewise, like, 03, 04, ..., which further contain some .log files. How do I read these in Spark?
I... | https://stackoverflow.com/questions/32233575/read-all-files-in-a-nested-folder-in-spark | apache-spark | 1,440,612,072 |
se_79618848 | stackoverflow | DATA_ENGINEERING | ERROR: Spark User did not initialize spark context | ERROR: Spark User did not initialize spark context
I'm getting this error from spark running with hadoop and pyspark
ApplicationMaster: Waiting for spark context initialization...
25/05/12 23:56:11 INFO ApplicationMaster: Final app status: FAILED,
exitCode: 13 25/05/12 23:56:11 ERROR ApplicationMaster: Uncaught
excep... | https://stackoverflow.com/questions/79618848/error-spark-user-did-not-initialize-spark-context | python, apache-spark, hadoop, pyspark | 1,747,102,569 |
se_79614679 | stackoverflow | DATA_ENGINEERING | PySpark Error Converting Irregular Date String to Timestamp Format | PySpark Error Converting Irregular Date String to Timestamp Format
I'm trying to convert irregular datetime string in my PySpark Dataframe to proper timestamp. The column value looks like this:
+------------------------------+
|date_added |
+------------------------------+
|Fri Aug 25 13:55:02 -0700... | https://stackoverflow.com/questions/79614679/pyspark-error-converting-irregular-date-string-to-timestamp-format | apache-spark, datetime, pyspark, spark3, to-timestamp | 1,746,814,917 |
se_72724816 | stackoverflow | DATA_ENGINEERING | Running unit tests with Spark 3.3.0 on Java 17 fails with IllegalAccessError: class StorageUtils cannot access class sun.nio.ch.DirectBuffer | Running unit tests with Spark 3.3.0 on Java 17 fails with IllegalAccessError: class StorageUtils cannot access class sun.nio.ch.DirectBuffer
According to the release notes, and specifically the ticket Build and Run Spark on Java 17 (SPARK-33772), Spark now supports running on Java 17.
However, using Java 17 (Temurin-1... | https://stackoverflow.com/questions/72724816/running-unit-tests-with-spark-3-3-0-on-java-17-fails-with-illegalaccesserror-cl | java, apache-spark, java-17 | 1,655,960,961 |
se_72230174 | stackoverflow | DATA_ENGINEERING | Java 17 solution for Spark - java.lang.NoClassDefFoundError: Could not initialize class org.apache.spark.storage.StorageUtils | Java 17 solution for Spark - java.lang.NoClassDefFoundError: Could not initialize class org.apache.spark.storage.StorageUtils
There are some solutions here
Windows Spark Error java.lang.NoClassDefFoundError: Could not initialize class org.apache.spark.storage.StorageUtils
The mentioned error probably corresponds to th... | https://stackoverflow.com/questions/72230174/java-17-solution-for-spark-java-lang-noclassdeffounderror-could-not-initializ | java, apache-spark, java-17 | 1,652,447,592 |
se_79579181 | stackoverflow | DATA_ENGINEERING | Exponential run time behavior in simple pyspark operation | Exponential run time behavior in simple pyspark operation
My task is simple, i have a binary file that needs to be split into 8byte chunks where first 4bytes contain data (to be decoded in later step) the 2nd 4byte contain an int (time offset in ms).
Some of these 8byte blocks are repeated - i want them to be removed.... | https://stackoverflow.com/questions/79579181/exponential-run-time-behavior-in-simple-pyspark-operation | python, apache-spark, pyspark, time-complexity | 1,744,890,499 |
se_79402153 | stackoverflow | DATA_ENGINEERING | Connect spark session on Jupyter | Connect spark session on Jupyter
docker-compose.yml
services:
namenode:
image: bde2020/hadoop-namenode:2.0.0-hadoop3.2.1-java8
container_name: namenode
restart: always
ports:
- 9870:9870
- 9000:9000
environment:
- CLUSTER_NAME=hadoop_cluster
- CORE_CONF_fs_defaultFS=hdfs:/... | https://stackoverflow.com/questions/79402153/connect-spark-session-on-jupyter | apache-spark, hadoop, pyspark, jupyter | 1,738,312,433 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.