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_48955389 | stackoverflow | DATA_ENGINEERING | Write dataframe to multiple tabs in a excel sheet using Spark | Write dataframe to multiple tabs in a excel sheet using Spark
I have been using Spark-excel (https://github.com/crealytics/spark-excel) to write the output to a single sheet of an Excel sheet. However, I am unable to write the output to different sheets (tabs).
Can anyone suggest any alternative?
Thanks,
Sai | https://stackoverflow.com/questions/48955389/write-dataframe-to-multiple-tabs-in-a-excel-sheet-using-spark | scala, apache-spark, apache-spark-sql, spark-excel | 1,519,415,895 |
se_79411422 | stackoverflow | DATA_ENGINEERING | Cannot connect to Confluent Kafka service from Azure Databricks - Time out waiting for node assignment. Call: describeTopics | Cannot connect to Confluent Kafka service from Azure Databricks - Time out waiting for node assignment. Call: describeTopics
I am facing an issue with Azure Databricks and Kafka integration. I would like to set up a readStream, but receiving the following error:
java.util.concurrent.ExecutionException: kafkashaded.org... | https://stackoverflow.com/questions/79411422/cannot-connect-to-confluent-kafka-service-from-azure-databricks-time-out-waiti | azure, apache-spark, apache-kafka, databricks | 1,738,666,565 |
se_79560382 | stackoverflow | DATA_ENGINEERING | How to access Nested Variant Type data using Pyspark | How to access Nested Variant Type data using Pyspark
I have been experimenting with the new Variant Datatype in Spark on Databricks (See here). I am trying to understand how to access the nested data in a variant column. From the documentation linked it seems you should be able to access the nested data using normal J... | https://stackoverflow.com/questions/79560382/how-to-access-nested-variant-type-data-using-pyspark | json, dataframe, apache-spark, pyspark, databricks | 1,744,043,359 |
se_79769352 | stackoverflow | DATA_ENGINEERING | EventHub based structured streaming spark pipeline | EventHub based structured streaming spark pipeline
I have little experience with event hubs. I am planning to build end to end data pipeline setup using event hub and apache structured streaming spark. I want to make my spark code fail proof. Eventhub has 1hour of time to live. After that messages are deleted from eve... | https://stackoverflow.com/questions/79769352/eventhub-based-structured-streaming-spark-pipeline | apache-spark, azure-eventhub | 1,758,274,561 |
se_79768932 | stackoverflow | DATA_ENGINEERING | Is there a way to eagerly access the datatype of a Column object in (Py)Spark? | Is there a way to eagerly access the datatype of a Column object in (Py)Spark?
Given an arbitrary pyspark.sql.column.Column object (or, similarly, a pyspark.sql.connect.column.Column object), is there a way to get a datatype back -- either as a DDL string or pyspark.sql.types.DataType subclass?
Note, no dataframe is a... | https://stackoverflow.com/questions/79768932/is-there-a-way-to-eagerly-access-the-datatype-of-a-column-object-in-pyspark | apache-spark, pyspark, databricks | 1,758,230,338 |
se_60768611 | stackoverflow | DATA_ENGINEERING | Can't deploy the simple Scala Spark application with SBT on Spark official site | Can't deploy the simple Scala Spark application with SBT on Spark official site
I run a simple Scala Spark application with SBT in https://spark.apache.org/docs/latest/quick-start.html#self-contained-applications, but some exceptions happen. I have been searching around, but am not sure still. I am wondering what ... | https://stackoverflow.com/questions/60768611/cant-deploy-the-simple-scala-spark-application-with-sbt-on-spark-official-site | scala, apache-spark | 1,584,678,916 |
se_65132280 | stackoverflow | DATA_ENGINEERING | Write parquet from another parquet with a new schema using pyspark | Write parquet from another parquet with a new schema using pyspark
I am using pyspark dataframes, I want to read a parquet file and write it with a different schema from the original file
The original schema is (It have 9.000 variables, I am just putting the first 5 for the example):
[('id', 'string'),
('date', 'stri... | https://stackoverflow.com/questions/65132280/write-parquet-from-another-parquet-with-a-new-schema-using-pyspark | apache-spark, pyspark, apache-spark-sql, schema, parquet | 1,607,021,583 |
se_79766224 | stackoverflow | DATA_ENGINEERING | DATAPROC - com.google.cloud.spark.bigquery.BigQueryRelationProvider not a subtype | DATAPROC - com.google.cloud.spark.bigquery.BigQueryRelationProvider not a subtype
I'm new to Dataproc and am having trouble running a job that accesses a PostgreSQL database (Compute Engine VM) to write data to BigQuery.
I created a cluster with the following configuration:
gcloud dataproc clusters create NAME-CLUSTER... | https://stackoverflow.com/questions/79766224/dataproc-com-google-cloud-spark-bigquery-bigqueryrelationprovider-not-a-subtyp | apache-spark, google-cloud-platform, pyspark, google-bigquery, dataproc | 1,758,025,171 |
se_79768285 | stackoverflow | DATA_ENGINEERING | Is there a known issue with Spark version 3 behaving differently and inconsistent to Spark version 2 when rounding decimal points? | Is there a known issue with Spark version 3 behaving differently and inconsistent to Spark version 2 when rounding decimal points?
My project is having a problem with decimal rounding errors in Spark v3 compared to Spark v2, where rounding to second decimal place works fine in Spark v2 but Spark v3 rounds the values u... | https://stackoverflow.com/questions/79768285/is-there-a-known-issue-with-spark-version-3-behaving-differently-and-inconsisten | apache-spark, rounding, rounding-error | 1,758,190,326 |
se_79767186 | stackoverflow | DATA_ENGINEERING | How to merge small parquet files in Hudi into larger files | How to merge small parquet files in Hudi into larger files
I use Spark+ Hudi to write data into S3. I was writing data in bulk_insert mode, which cause there be many small paruqet files in Hudi table.
Then I try to schedule clustering on the Hudi table:
hudi_options = {
'hoodie.table.name':... | https://stackoverflow.com/questions/79767186/how-to-merge-small-parquet-files-in-hudi-into-larger-files | apache-spark, pyspark, bigdata, apache-hudi, data-lake | 1,758,105,324 |
se_79766427 | stackoverflow | DATA_ENGINEERING | Kubernetes: driver-py: not found and Missing application resource error | Kubernetes: driver-py: not found and Missing application resource error
I'm trying to run my pyspark file in a k8s environment using a custom image.
It used to work fine with our company provided image but it has spark v2.4.4 so I wanted an upgrade.
First I got this error:
/opt/entrypoint.sh: line 128: exec: driver-py... | https://stackoverflow.com/questions/79766427/kubernetes-driver-py-not-found-and-missing-application-resource-error | python, docker, apache-spark, kubernetes, pyspark | 1,758,037,279 |
se_79766002 | stackoverflow | DATA_ENGINEERING | Job overrun / OOM after changing the partition | Job overrun / OOM after changing the partition
I have a PySpark job that ingests data into a Delta table originally partitioned by year, month, day and hour. The job takes 2hr to complete. The job runs daily ingesting previous days full data. Recently I switched the partitioning to a single field, event_date (a date t... | https://stackoverflow.com/questions/79766002/job-overrun-oom-after-changing-the-partition | apache-spark, pyspark | 1,758,013,166 |
se_75411769 | stackoverflow | DATA_ENGINEERING | Convert Interval type to string in pyspark | Convert Interval type to string in pyspark
I want to write a Spark dataframe to file, but I don't like the format of my column containing an interval:
INTERVAL '0 01:02:10.237' DAY TO SECOND
I would rather have:
01:02:10.237
How can I format/cast the column to return my preferred format as a string.
The column is ... | https://stackoverflow.com/questions/75411769/convert-interval-type-to-string-in-pyspark | apache-spark, pyspark | 1,676,035,644 |
se_40800920 | stackoverflow | DATA_ENGINEERING | How do I Convert Array[Row] to DataFrame | How do I Convert Array[Row] to DataFrame
How do I convert this one row to a dataframe?
val oneRowDF = myDF.first // gives Array[Row]
Thanks | https://stackoverflow.com/questions/40800920/how-do-i-convert-arrayrow-to-dataframe | scala, apache-spark, dataframe | 1,480,063,865 |
se_57699926 | stackoverflow | DATA_ENGINEERING | how to fix Illegal Parquet type: INT64 (TIMESTAMP_MICROS) error | how to fix Illegal Parquet type: INT64 (TIMESTAMP_MICROS) error
I use a sqlContext.read.parquet function in PySpark to read the parquet files everyday. The data has a timestamp column. They changed the timestamp field from 2019-08-26T00:00:13.600+0000 to 2019-08-26T00:00:13.600Z. It reads fine in Databricks, but it gi... | https://stackoverflow.com/questions/57699926/how-to-fix-illegal-parquet-type-int64-timestamp-micros-error | apache-spark, pyspark, apache-spark-sql, parquet | 1,567,025,678 |
se_79762408 | stackoverflow | DATA_ENGINEERING | How to set a new header in pyspark dataframe? | How to set a new header in pyspark dataframe?
I'm loading a csv into a dataframe of type:
Column A
Column B
Cell 1
Cell 2
Cell 3
Cell 4
The header row is "nonsense", the actual header is in row 1, but I want to change the header names based on a schema mapping. e.g changing "FirstName" to "first_name".
I c... | https://stackoverflow.com/questions/79762408/how-to-set-a-new-header-in-pyspark-dataframe | dataframe, apache-spark, pyspark | 1,757,628,898 |
se_79762263 | stackoverflow | DATA_ENGINEERING | Query Variant Data Type with Pyspark (Spark 4.0) | Query Variant Data Type with Pyspark (Spark 4.0)
I use Spark 4.0 and have the following code
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark.sql.types import StringType
json_data = [
('{"auswahl":{"a":{"b":10032,"c":201844}',)
]
df_raw = spark.createDataFrame(json_data, [... | https://stackoverflow.com/questions/79762263/query-variant-data-type-with-pyspark-spark-4-0 | apache-spark, variant | 1,757,614,412 |
se_73840095 | stackoverflow | DATA_ENGINEERING | Spark Datasets available in Python? | Spark Datasets available in Python?
Here, it is stated:
..you can create Datasets within a Scala or Python..
while here, the following is stated:
Python does not have the support for the Dataset API
Are datasets available in python? | https://stackoverflow.com/questions/73840095/spark-datasets-available-in-python | apache-spark, pyspark | 1,664,048,300 |
se_30905515 | stackoverflow | DATA_ENGINEERING | Pyspark StructType is not defined | Pyspark StructType is not defined
I'm trying to struct a schema for db testing, and StructType apparently isn't working for some reason. I'm following a tut, and it doesn't import any extra module.
<type 'exceptions.NameError'>, NameError("name 'StructType' is not defined",), <traceback object at 0x2b555f0>)
I'm on... | https://stackoverflow.com/questions/30905515/pyspark-structtype-is-not-defined | python, apache-spark, pyspark | 1,434,594,404 |
se_44502095 | stackoverflow | DATA_ENGINEERING | Summing multiple columns in Spark | Summing multiple columns in Spark
How can I sum multiple columns in Spark? For example, in SparkR the following code works to get the sum of one column, but if I try to get the sum of both columns in df, I get an error.
# Create SparkDataFrame
df <- createDataFrame(faithful)
# Use agg to sum total waiting times
hea... | https://stackoverflow.com/questions/44502095/summing-multiple-columns-in-spark | apache-spark, pyspark, sparkr | 1,497,278,116 |
se_79756507 | stackoverflow | DATA_ENGINEERING | PySpark ArrayType usage in transformWithStateInPandas state causes java.lang.IllegalArgumentException | PySpark ArrayType usage in transformWithStateInPandas state causes java.lang.IllegalArgumentException
I have the following python code that uses PySpark to mock a fraud detection system for credit cards:
from pyspark.sql import SparkSession
from pyspark.sql.functions import from_json, col, unix_timestamp
from pyspark.... | https://stackoverflow.com/questions/79756507/pyspark-arraytype-usage-in-transformwithstateinpandas-state-causes-java-lang-ill | python, apache-spark, pyspark, pyarrow | 1,757,057,781 |
se_73157370 | stackoverflow | DATA_ENGINEERING | PySpark to Azure SQL Database connection issue | PySpark to Azure SQL Database connection issue
I'm trying to connect to Azure SQL Database from Azure Synapse workspace Notebook using PySpark. Also I would like to use Active Directory integrated authentication. So what I've tried:
jdbc_df = spark.read \
.format("com.microsoft.sqlserver.jdbc.spark") \
... | https://stackoverflow.com/questions/73157370/pyspark-to-azure-sql-database-connection-issue | python, apache-spark, pyspark, azure-active-directory, azure-sql-database | 1,659,031,679 |
se_79759430 | stackoverflow | DATA_ENGINEERING | Exception in thread "main" java.io.FileNotFoundException but I have my file correctly in my S3 bucket | Exception in thread "main" java.io.FileNotFoundException but I have my file correctly in my S3 bucket
I'm trying to create a cluster on EMR on EC2 Clusters to process my jobs I have created a spark cluster with default VPC
I have checked my IAM and I've allowed "s3:CreateBucket", "s3:DeleteObject", "s3:List... | https://stackoverflow.com/questions/79759430/exception-in-thread-main-java-io-filenotfoundexception-but-i-have-my-file-corr | amazon-web-services, apache-spark, amazon-s3, amazon-ec2 | 1,757,381,879 |
se_79758065 | stackoverflow | DATA_ENGINEERING | Problem reading the _last_checkpoint file from the _delta_log directory of a delta lake table on s3 | Problem reading the _last_checkpoint file from the _delta_log directory of a delta lake table on s3
I am trying to read the _delta_log folder of a delta lake table via spark to export some custom metrics. I have configured how to get some metrics from history and description but I have problem reading the _last_checkp... | https://stackoverflow.com/questions/79758065/problem-reading-the-last-checkpoint-file-from-the-delta-log-directory-of-a-del | apache-spark, apache-spark-sql, metadata, delta-lake | 1,757,242,213 |
se_34859468 | stackoverflow | DATA_ENGINEERING | Scala class lazy val variables strange behaviour with Spark | Scala class lazy val variables strange behaviour with Spark
I noticed a strange behaviour while using Spark for a project using scala 2.10, I am reading a properties file and writes all the content inside a Map (loadConfig) and I also created a simple method that returns the value of a given key.
The problem is, when ... | https://stackoverflow.com/questions/34859468/scala-class-lazy-val-variables-strange-behaviour-with-spark | scala, apache-spark | 1,453,134,338 |
se_60757507 | stackoverflow | DATA_ENGINEERING | ` _corrupt_record: string (nullable = true)` with a simple Spark Scala application | ` _corrupt_record: string (nullable = true)` with a simple Spark Scala application
I am trying to run a simple/dumb Spark Scala application example in Spark: The Definitive Guide. It reads a JSON file and do some work on it. But running it reports _corrupt_record: string (nullable = true). The JSON file has a JSON ob... | https://stackoverflow.com/questions/60757507/corrupt-record-string-nullable-true-with-a-simple-spark-scala-applicati | scala, apache-spark | 1,584,621,718 |
se_74068380 | stackoverflow | DATA_ENGINEERING | Pandas on spark very slow | Pandas on spark very slow
I'm trying to learn pyspark, and for the most part I've been using the pyspark.sql methods of working with datasets. However, I was interested in the pandas on spark api as I've used pandas extensively before, but I keep facing issues with run times especially with basic stuff that I'm used t... | https://stackoverflow.com/questions/74068380/pandas-on-spark-very-slow | apache-spark, pyspark, pyspark-pandas | 1,665,746,063 |
se_79467447 | stackoverflow | DATA_ENGINEERING | How to run spark-connect server on Windows? | How to run spark-connect server on Windows?
As the title says.
I see the Quick Guide and Spark Connect Overview say to run sbin/start-connect-server.sh to start the server. There are no equivalent bat or cmd files available for Windows for anything in sbin. I see someone translated to create spark-sbin-windows but it'... | https://stackoverflow.com/questions/79467447/how-to-run-spark-connect-server-on-windows | windows, apache-spark, spark-connect | 1,740,505,347 |
se_78751048 | stackoverflow | DATA_ENGINEERING | Scala Spark Dataframe creation from Seq of tuples doesn't work in Scala 3, but does in Scala 2 | Scala Spark Dataframe creation from Seq of tuples doesn't work in Scala 3, but does in Scala 2
When trying to test something locally with Scala Spark, I noticed the following problem and was wondering what causes it, and whether there exists a workaround.
Consider the following build configuration and code:
// bui... | https://stackoverflow.com/questions/78751048/scala-spark-dataframe-creation-from-seq-of-tuples-doesnt-work-in-scala-3-but-d | scala, apache-spark, scala-3, scala-reflect | 1,721,062,119 |
se_79749646 | stackoverflow | DATA_ENGINEERING | Create unique index for each group PySpark | Create unique index for each group PySpark
I am working with a relatively large dataframe (close to 1 billion rows) in PySpark. This dataframe is in "long" format, and I would like to have a unique index for each group defined by a groupBy over multiple columns. An example dataframe:
+--------------+-------+---------+... | https://stackoverflow.com/questions/79749646/create-unique-index-for-each-group-pyspark | python, apache-spark, pyspark | 1,756,418,295 |
se_66685116 | stackoverflow | DATA_ENGINEERING | Apache Spark: Calling setCallSite(description) when a stage really starts, not during the analysis phase | Apache Spark: Calling setCallSite(description) when a stage really starts, not during the analysis phase
setJobDescription(description) allows to put a name to a job (the action) we are doing.
Often, for a Spark session, a single call is enough for me : a collect(), a show(), and I'm done.
But for stages, it's differe... | https://stackoverflow.com/questions/66685116/apache-spark-calling-setcallsitedescription-when-a-stage-really-starts-not-d | java, apache-spark | 1,616,044,143 |
se_39655880 | stackoverflow | DATA_ENGINEERING | How to divide a numerical columns in ranges and assign labels for each range in apache spark? | How to divide a numerical columns in ranges and assign labels for each range in apache spark?
I have the following sparkdataframe:
id weekly_sale
1 40000
2 120000
3 135000
4 211000
5 215000
6 331000
7 337000
I need to see in which of the following intervals items in weekly_sale column fall:
un... | https://stackoverflow.com/questions/39655880/how-to-divide-a-numerical-columns-in-ranges-and-assign-labels-for-each-range-in | apache-spark, dataframe, pyspark, apache-spark-sql, hivecontext | 1,474,618,356 |
se_79747926 | stackoverflow | DATA_ENGINEERING | Conversion of a pyspark DataFrame with a Variant column to pandas fails with an error | Conversion of a pyspark DataFrame with a Variant column to pandas fails with an error
When I try to convert a pyspark DataFrame with a VariantType column to a pandas DataFrame, the conversion fails with an error 'NoneType' object is not iterable. Am I doing it incorrectly?
Sample code:
from pyspark.sql import SparkSes... | https://stackoverflow.com/questions/79747926/conversion-of-a-pyspark-dataframe-with-a-variant-column-to-pandas-fails-with-an | pandas, apache-spark, pyspark, apache-spark-sql, variant | 1,756,294,369 |
se_79747115 | stackoverflow | DATA_ENGINEERING | Cannot extend Spark UnaryExpression in Java | Cannot extend Spark UnaryExpression in Java
I am trying to write a custom decoder function in Java targeting Spark 4.0:
public class MyDataToCatalyst extends UnaryExpression implements NonSQLExpression, ExpectsInputTypes, Serializable {
//...
}
However, I cannot get this to compile, because the class definition ... | https://stackoverflow.com/questions/79747115/cannot-extend-spark-unaryexpression-in-java | java, apache-spark, apache-spark-sql | 1,756,227,577 |
se_79745085 | stackoverflow | DATA_ENGINEERING | AWS Glue/Spark performance issue | AWS Glue/Spark performance issue
I am new to AWS Glue and I am facing performance issues with the following code:
spark.conf.set("spark.sql.mapKeyDedupPolicy", "LAST_WIN")
# Define S3 path with wildcard to match all .ind files
s3_ind_path = f"s3a://{source_bucket}/{source_prefix}/*.ind"
# Read all .ind files as whol... | https://stackoverflow.com/questions/79745085/aws-glue-spark-performance-issue | python, amazon-web-services, apache-spark, apache-spark-sql, aws-glue | 1,756,059,761 |
se_79746281 | stackoverflow | DATA_ENGINEERING | How to package a PySpark + Delta Lake script into an EXE with PyInstaller | How to package a PySpark + Delta Lake script into an EXE with PyInstaller
I’m trying to convert my PySpark script into an executable(.exe) file using PyInstaller.
The script runs fine in Python, but after converting to an EXE and executing it, I get the following error:
'JavaPackage' object is not callable
Traceback... | https://stackoverflow.com/questions/79746281/how-to-package-a-pyspark-delta-lake-script-into-an-exe-with-pyinstaller | python, apache-spark, hadoop, pyspark, delta-lake | 1,756,166,190 |
se_54785519 | stackoverflow | DATA_ENGINEERING | Using airflow to run spark streaming jobs? | Using airflow to run spark streaming jobs?
We have in our hadoop cluster Spark Batch jobs and and Spark streaming jobs.
We would like to schedule and manage them both on the same platform.
We came across airflow, Which fits our need for a
"platform to author, schedule, and monitor workflows".
I just want to be ... | https://stackoverflow.com/questions/54785519/using-airflow-to-run-spark-streaming-jobs | apache-spark, streaming, airflow | 1,550,662,839 |
se_79724076 | stackoverflow | DATA_ENGINEERING | Apache Spark (3.5-4.0) Does df.count() load the data? | Apache Spark (3.5-4.0) Does df.count() load the data?
Over the past few months, I have been getting inconsistent benchmark results, and I want to confirm if my suspicion is correct. If I perform a series of transformations to create a Spark (3.5+/4) DataFrame (df), and then follow these with two operations—(1) df.cach... | https://stackoverflow.com/questions/79724076/apache-spark-3-5-4-0-does-df-count-load-the-data | dataframe, apache-spark, action | 1,754,230,018 |
se_52283751 | stackoverflow | DATA_ENGINEERING | Calculating percentage of total count for groupBy using pyspark | Calculating percentage of total count for groupBy using pyspark
I have the following code in pyspark, resulting in a table showing me the different values for a column and their counts. I want to have another column showing what percentage of the total count does each row represent. How do I do that?
difrgns = (
d... | https://stackoverflow.com/questions/52283751/calculating-percentage-of-total-count-for-groupby-using-pyspark | apache-spark, pyspark, apache-spark-sql | 1,536,697,637 |
se_76744682 | stackoverflow | DATA_ENGINEERING | Spark DataSource V2 API | Spark DataSource V2 API
I have been trying to create a Custom Spark Data source using V2 API.
As per Jira, it is in master and available for use. But when tried to use it in my project, compilation failed citing that no such package path exists in v3.3.1.
package closed.source.gs
import org.apache.spark.sql.sources.v... | https://stackoverflow.com/questions/76744682/spark-datasource-v2-api | apache-spark, apache-spark-sql, apache-spark-connector | 1,690,041,210 |
se_76348141 | stackoverflow | DATA_ENGINEERING | PySpark create DataFrame giving 'TypeError: 'JavaPackage' object is not callable' | PySpark create DataFrame giving 'TypeError: 'JavaPackage' object is not callable'
I am trying to understand Kafka + Pyspark better, and starting off with a test message that I would like to append to a spark dataframe. I can stream data from kafka and read data from CSVs, but I cannot use the createDat... | https://stackoverflow.com/questions/76348141/pyspark-create-dataframe-giving-typeerror-javapackage-object-is-not-callable | python, dataframe, apache-spark, pyspark, apache-spark-sql | 1,685,208,275 |
se_65713299 | stackoverflow | DATA_ENGINEERING | "'JavaPackage' object is not callable" error executing explain() in Pyspark 3.0.1 via Zeppelin | "'JavaPackage' object is not callable" error executing explain() in Pyspark 3.0.1 via Zeppelin
I am running Pyspark 3.0.1 for Hadoop 2.7 in a Zeppelin notebook. In general all is well, however when I execute df.explain() on a DataFrame I get this error:
Fail to execute line 3: df.explain()
Traceback... | https://stackoverflow.com/questions/65713299/javapackage-object-is-not-callable-error-executing-explain-in-pyspark-3-0 | apache-spark, pyspark | 1,610,597,264 |
se_79631246 | stackoverflow | DATA_ENGINEERING | How to create an apache iceberg table with geometry column? | How to create an apache iceberg table with geometry column?
from pyspark.sql import SparkSession
from sedona.spark import SedonaContext
from pyspark.sql.functions import expr
spark = (
SparkSession.builder
.appName("SedonaIcebergApp")
.master("local[*]")
.config(
"spark.jars.packages",... | https://stackoverflow.com/questions/79631246/how-to-create-an-apache-iceberg-table-with-geometry-column | apache-spark, geometry, parquet, apache-iceberg, apache-sedona | 1,747,779,765 |
se_28956222 | stackoverflow | DATA_ENGINEERING | twitterStream not found | twitterStream not found
I'm trying to compile my first scala program and I'm using twitterStream to get tweets, here is a snippet of my code:
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.apache.spark.streaming._
import org.apache.spark.streaming.twitter._
import org.apache.spark.streami... | https://stackoverflow.com/questions/28956222/twitterstream-not-found | scala, twitter, apache-spark, spark-streaming | 1,425,962,008 |
se_31610971 | stackoverflow | DATA_ENGINEERING | Spark - repartition() vs coalesce() | Spark - repartition() vs coalesce()
According to Learning Spark
Keep in mind that repartitioning your data is a fairly expensive operation.
Spark also has an optimized version of repartition() called coalesce() that allows avoiding data movement, but only if you are decreasing the number of RDD partitions.
One... | https://stackoverflow.com/questions/31610971/spark-repartition-vs-coalesce | apache-spark, distributed-computing, rdd | 1,437,742,159 |
se_79737759 | stackoverflow | DATA_ENGINEERING | Unable to run trino for iceberg table: Invalid value 'hadoop' for type CatalogType | Unable to run trino for iceberg table: Invalid value 'hadoop' for type CatalogType
I have generated iceberg table with spark java program. Now I want to access it via trino.
My docker compose is:
version: '3.8'
services:
trino:
image: trinodb/trino:latest
container_name: trino
ports:
- "80... | https://stackoverflow.com/questions/79737759/unable-to-run-trino-for-iceberg-table-invalid-value-hadoop-for-type-catalogty | apache-spark, trino, apache-iceberg | 1,755,425,289 |
se_40153728 | stackoverflow | DATA_ENGINEERING | Multiple SparkSessions in single JVM | Multiple SparkSessions in single JVM
I have a query regarding creating multiple spark sessions in one JVM. I have read that creating multiple contexts is not recommended in earlier versions of Spark. Is it true with the SparkSession in Spark 2.0 as well.
I am thinking of making a call to a web service or a servlet fro... | https://stackoverflow.com/questions/40153728/multiple-sparksessions-in-single-jvm | apache-spark | 1,476,964,536 |
se_51629287 | stackoverflow | DATA_ENGINEERING | How Apache Spark SQL can batch insert data to MySQL? | How Apache Spark SQL can batch insert data to MySQL?
Recently I need to insert ~100,000,000 data rows into MySQL by using Apache Spark SQL, however the speed is quite low, it takes ~1 hour. Can someone have an efficent way to insert them?
MySQL configuration =>
properties.setProperty("user", "user")
properties.setProp... | https://stackoverflow.com/questions/51629287/how-apache-spark-sql-can-batch-insert-data-to-mysql | mysql, apache-spark, apache-spark-sql | 1,533,114,154 |
se_79738518 | stackoverflow | DATA_ENGINEERING | PySpark program stuck at adding broadcast piece | PySpark program stuck at adding broadcast piece
I'm trying to write a PySpark program that filters for records in a very large dataframe (1-2B records) that matches some conditions on another smaller reference dataframe. This is done using a left join between the 2 dataframes, and then writing the results to a parquet... | https://stackoverflow.com/questions/79738518/pyspark-program-stuck-at-adding-broadcast-piece | python, apache-spark, pyspark | 1,755,509,549 |
se_79735159 | stackoverflow | DATA_ENGINEERING | Which version of source delta table table currently being processed by spark structured streaming? | Which version of source delta table table currently being processed by spark structured streaming?
I want to know/monitor which version of the delta table is currently being processed, especially when the stream is started with a startingVersion.
My understanding is when that option is chosen, the stream reads changes... | https://stackoverflow.com/questions/79735159/which-version-of-source-delta-table-table-currently-being-processed-by-spark-str | apache-spark, pyspark, databricks, spark-structured-streaming, delta-lake | 1,755,161,150 |
se_79734860 | stackoverflow | DATA_ENGINEERING | INSERT into Iceberg table fails: Spark 3.4 on Kubernetes (Spark Operator) + Iceberg REST (Lakekeeper) + Minio | INSERT into Iceberg table fails: Spark 3.4 on Kubernetes (Spark Operator) + Iceberg REST (Lakekeeper) + Minio
Hey I have a problem with inserting into an Iceberg table hosted on Minio via a Spark executor, here's more context:
Platform: Spark 3.4.0 on Kubernetes via Spark Operator 1.1.28
Catalog: Lakekeeper (Iceberg R... | https://stackoverflow.com/questions/79734860/insert-into-iceberg-table-fails-spark-3-4-on-kubernetes-spark-operator-iceb | apache-spark, pyspark, minio, jupyterhub | 1,755,132,479 |
se_79733698 | stackoverflow | DATA_ENGINEERING | Spark Scala: JSON Array Column Not Persisting to BigQuery Table | Spark Scala: JSON Array Column Not Persisting to BigQuery Table
I'm hoping to get some help with an issue I'm having moving data from a JSON file to a BigQuery table using Spark.
The problem, in a nutshell:
Goal: Load a JSON file into a Spark DataFrame and persist it to a BigQuery table.
Problem: The skills column (an... | https://stackoverflow.com/questions/79733698/spark-scala-json-array-column-not-persisting-to-bigquery-table | json, apache-spark, google-bigquery | 1,755,037,714 |
se_57231728 | stackoverflow | DATA_ENGINEERING | Implementing Trie (or similar data structure) on spark | Implementing Trie (or similar data structure) on spark
I'm working as an intern, I've been tasked with implementing a fast searching algorithm for phone numbers on their spark cluster, using tries (prefix tree), and performing operations such as inner join on several such tries
I managed to create get it working for ... | https://stackoverflow.com/questions/57231728/implementing-trie-or-similar-data-structure-on-spark | python, python-2.7, apache-spark, pyspark | 1,564,227,318 |
se_72071665 | stackoverflow | DATA_ENGINEERING | Starting a pyspark session take a lot of time | Starting a pyspark session take a lot of time
Hello I am new with pyspark, and I'm stuck with this line of code:
spark = SparkSession.builder.appName('HelloWorld').getOrCreate()
The launching of the spark session won't end up, i've waited for more than 100 min and nothing, it's still compiling.
Can anyone explain to ... | https://stackoverflow.com/questions/72071665/starting-a-pyspark-session-take-a-lot-of-time | python, apache-spark, pyspark | 1,651,347,912 |
se_30093676 | stackoverflow | DATA_ENGINEERING | Apache Spark does not delete temporary directories | Apache Spark does not delete temporary directories
After a spark program completes, there are 3 temporary directories remain in the temp directory.
The directory names are like this: spark-2e389487-40cc-4a82-a5c7-353c0feefbb7
The directories are empty.
And when the Spark program runs on Windows, a snappy DLL file al... | https://stackoverflow.com/questions/30093676/apache-spark-does-not-delete-temporary-directories | apache-spark | 1,430,980,834 |
se_79729323 | stackoverflow | DATA_ENGINEERING | A User Defined Aggregated Function fails to shape a Map<K, C> field, where C is an object coming from many rows | A User Defined Aggregated Function fails to shape a Map<K, C> field, where C is an object coming from many rows
Edit: Progressing into this problem analysis, the management of the dataset nested values with tools that Spark offers since 3.1.x seems required.
→ It's my manner of filling nested objects hold by obj... | https://stackoverflow.com/questions/79729323/a-user-defined-aggregated-function-fails-to-shape-a-mapk-c-field-where-c-is | java, apache-spark, aggregate-functions | 1,754,628,441 |
se_51628958 | stackoverflow | DATA_ENGINEERING | Spark save(write) parquet only one file | Spark save(write) parquet only one file
if i write
dataFrame.write.format("parquet").mode("append").save("temp.parquet")
in temp.parquet folder
i got the same file numbers as the row numbers
i think i'm not fully understand about parquet but is it natural? | https://stackoverflow.com/questions/51628958/spark-savewrite-parquet-only-one-file | scala, apache-spark, parquet | 1,533,113,095 |
se_71872923 | stackoverflow | DATA_ENGINEERING | Databricks- ConcurrentAppendException: | Databricks- ConcurrentAppendException:
I'm running like 20 notebooks concurrently and they all update the same Delta table (however, different rows). I'm getting the below exception if any two notebooks try to update the table at the same time).
Does setting 'delta.isolationLevel' = 'Serializable' for the Delta table ... | https://stackoverflow.com/questions/71872923/databricks-concurrentappendexception | azure, apache-spark, databricks, delta-lake | 1,649,944,906 |
se_79730129 | stackoverflow | DATA_ENGINEERING | Apache Spark Error: Cannot cast STRING into a StructType(StructField(subFieldA,StringType,true)) (value: BsonString{value='{}'}) | Apache Spark Error: Cannot cast STRING into a StructType(StructField(subFieldA,StringType,true)) (value: BsonString{value='{}'})
I’m reading documents from DocDB (MongoDB) into Spark using the mongo-spark-connector.
One of the fields, fieldA, is a nested object. If fieldA is missing in a document, I replace it... | https://stackoverflow.com/questions/79730129/apache-spark-error-cannot-cast-string-into-a-structtypestructfieldsubfielda-s | mongodb, scala, apache-spark, aws-documentdb | 1,754,677,863 |
se_79695600 | stackoverflow | DATA_ENGINEERING | Limited in defining Spark time Window | Limited in defining Spark time Window
I have a code of pyspark streaming. Which is in following:
parsed_df = df.selectExpr("CAST(value AS STRING) as message", "timestamp") \
.select(
from_json(col("message"), json_schema).alias("data"),
col("timestamp")
) \
.select("data.*", "timestamp")
complex_windowe... | https://stackoverflow.com/questions/79695600/limited-in-defining-spark-time-window | apache-spark, pyspark, spark-streaming | 1,752,063,423 |
se_79730415 | stackoverflow | DATA_ENGINEERING | How to read data from MongoDB collection using SparkSession into a Spark DataFrameReader? | How to read data from MongoDB collection using SparkSession into a Spark DataFrameReader?
Spark reading data from MongoDB(ver 7.0) and DocumentDB(ver 4.0) and loading into the spark DataFrameReader is failing when DataFrameReader.isEmpty() method is called . SparkSession and DataFrameReader get initiailized well. Call... | https://stackoverflow.com/questions/79730415/how-to-read-data-from-mongodb-collection-using-sparksession-into-a-spark-datafra | mongodb, apache-spark, apache-spark-sql, aws-documentdb-mongoapi | 1,754,712,964 |
se_36909002 | stackoverflow | DATA_ENGINEERING | AuthorizationException: User not allowed to impersonate User | AuthorizationException: User not allowed to impersonate User
I wrote a spark job which registers a temp table
and when I expose it via beeline (JDBC client)
$ ./bin/beeline
beeline> !connect jdbc:hive2://IP:10003 -n ram -p xxxx
0: jdbc:hive2://IP> show tables;
+---------------------------------------------+----------... | https://stackoverflow.com/questions/36909002/authorizationexception-user-not-allowed-to-impersonate-user | apache-spark, hive, apache-spark-sql, beeline | 1,461,831,398 |
se_79727509 | stackoverflow | DATA_ENGINEERING | Difference between spark.sql.files.maxPartitionBytes and spark.files.maxPartitionBytes | Difference between spark.sql.files.maxPartitionBytes and spark.files.maxPartitionBytes
I see that Spark 2.0.0 introduced a property spark.sql.files.maxPartitionBytes and it's subsequent sub-release (2.1.0) introduced spark.files.maxPartitionBytes
The Spark configuration link says in case of former -
The maximum numbe... | https://stackoverflow.com/questions/79727509/difference-between-spark-sql-files-maxpartitionbytes-and-spark-files-maxpartitio | apache-spark | 1,754,494,092 |
se_79726402 | stackoverflow | DATA_ENGINEERING | Scala Spark decompress lz4 csv | Scala Spark decompress lz4 csv
Is there any way to decompress csv lz4 files by Spark?
I tried following approaches:
First:
sparkSession.read
.option("delimiter", ",")
.option("compression", "lz4")
.csv("data.csv.lz4")
It returns:
++
||
++
++
Second:
val rez = sparkSession.read
.format("text")
.load("/d... | https://stackoverflow.com/questions/79726402/scala-spark-decompress-lz4-csv | scala, apache-spark, compression, lz4 | 1,754,411,917 |
se_61074343 | stackoverflow | DATA_ENGINEERING | What do these metrics mean in Spark Structured Streaming? | What do these metrics mean in Spark Structured Streaming?
spark.streams.addListener(new StreamingQueryListener() {
......
override def onQueryProgress(queryProgress: QueryProgressEvent): Unit = {
println("Query made progress: " + queryProgress.progress)
}
......
})
When StreamingQueryListener ... | https://stackoverflow.com/questions/61074343/what-do-these-metrics-mean-in-spark-structured-streaming | apache-spark, spark-structured-streaming | 1,586,242,389 |
se_79726486 | stackoverflow | DATA_ENGINEERING | enforcing nullability on json schema | enforcing nullability on json schema
I want to read in an ndjson file and apply a pre-defined schema to it (not allow spark to infer the schema). In general terms, this works fine. But we are unable to define certain elements as required.
Here's a really simplistic ndjson file:
{"name": "foo", "id": 1}
{"name": "bar"}... | https://stackoverflow.com/questions/79726486/enforcing-nullability-on-json-schema | json, apache-spark, pyspark, apache-spark-sql, ndjson | 1,754,416,777 |
se_76090572 | stackoverflow | DATA_ENGINEERING | Pyspark Py4JJavaError on .getOrCreate() creating Spark session | Pyspark Py4JJavaError on .getOrCreate() creating Spark session
I am trying to create a spark session, but get an error. My code:
spark = (SparkSession
.builder
.config("spark.jars.packages", pydeequ.deequ_maven_coord)
.config("spark.jars.excludes", pydeequ.f2j_maven_coord)
.getOrCreate())
Beforehand I have imported S... | https://stackoverflow.com/questions/76090572/pyspark-py4jjavaerror-on-getorcreate-creating-spark-session | python, apache-spark, session, pyspark | 1,682,329,320 |
se_53743795 | stackoverflow | DATA_ENGINEERING | How to check if a string column in pyspark dataframe is all numeric | How to check if a string column in pyspark dataframe is all numeric
I have a PySpark Dataframe with a column of strings. How can I check which rows in it are Numeric. I could not find any function in PySpark's official documentation.
values = [('25q36',),('75647',),('13864',),('8758K',),('07645',)]
df = sqlContext.cre... | https://stackoverflow.com/questions/53743795/how-to-check-if-a-string-column-in-pyspark-dataframe-is-all-numeric | python, apache-spark, pyspark, apache-spark-sql, numeric | 1,544,620,201 |
se_79716944 | stackoverflow | DATA_ENGINEERING | Multiple writestream to same delta table error | Multiple writestream to same delta table error
I am trying to run 2 spark structured streaming jobs in databricks. Each job is running on it's own job cluster and streaming data from different AWS Kinesis data stream but both the jobs are writing data to same delta table. Both the jobs have different checkpoint locati... | https://stackoverflow.com/questions/79716944/multiple-writestream-to-same-delta-table-error | apache-spark, pyspark, databricks, spark-structured-streaming, delta | 1,753,683,168 |
se_53558622 | stackoverflow | DATA_ENGINEERING | Spark Dataframe write operation clears the cached Dataframe | Spark Dataframe write operation clears the cached Dataframe
Spark is clearing the cached RDD after a write action is invoked on a dataframe arrived from this cache after some transformations. So any further action that could have used the cache has to recompute the RDD. However if the action is replaced by any other a... | https://stackoverflow.com/questions/53558622/spark-dataframe-write-operation-clears-the-cached-dataframe | apache-spark | 1,543,584,957 |
se_69830601 | stackoverflow | DATA_ENGINEERING | Reading of netcdf files in Spark 3 through Scala | Reading of netcdf files in Spark 3 through Scala
I have used SciSpark for reading numerous netcdf files in Spark 2.x. However, I am unable to compile it for Spark 3.x (due to various types of errors such as cannot be applied to (Array[Int]), found : Array[Long] with required: Array[Int], cannot be applied to (AnyVal... | https://stackoverflow.com/questions/69830601/reading-of-netcdf-files-in-spark-3-through-scala | scala, apache-spark | 1,635,967,088 |
se_79696666 | stackoverflow | DATA_ENGINEERING | Parquet schema for Map type changes after spark2 to 3 migration | Parquet schema for Map type changes after spark2 to 3 migration
We are migrating from spark 2 to 3 in our workflows and one issue we notice is that the parquet files are having schema mismatch for MapType. Here's a simple example to illustrate the case
SparkSession sparkSession = SparkSession
.... | https://stackoverflow.com/questions/79696666/parquet-schema-for-map-type-changes-after-spark2-to-3-migration | java, apache-spark, parquet | 1,752,132,900 |
se_79693262 | stackoverflow | DATA_ENGINEERING | Facing bigquery write failure after upgrading spark and dataproc. "Schema mismatch : corresponding field path to Parquet column has 0 repeated field"s | Facing bigquery write failure after upgrading spark and dataproc. "Schema mismatch : corresponding field path to Parquet column has 0 repeated field"s
We are currently undergoing migration from spark 2.4 to spark 3.5 (and dataproc 1 to 2), and our workflows are failing with the following error
Caused by: com... | https://stackoverflow.com/questions/79693262/facing-bigquery-write-failure-after-upgrading-spark-and-dataproc-schema-mismat | apache-spark, google-bigquery, google-cloud-dataproc | 1,751,911,505 |
se_79722887 | stackoverflow | DATA_ENGINEERING | Azure Synapse SQL Merge is not updating records, instead of that it inserts matching records using spark.sql | Azure Synapse SQL Merge is not updating records, instead of that it inserts matching records using spark.sql
I have the below code where the Id is a 36 character GUID. The code gets executed but when a matching record is found , instead of updating it inserts the entire records again. What could be the root cause for ... | https://stackoverflow.com/questions/79722887/azure-synapse-sql-merge-is-not-updating-records-instead-of-that-it-inserts-matc | apache-spark, pyspark, apache-spark-sql, azure-synapse, delta-lake | 1,754,075,563 |
se_79721713 | stackoverflow | DATA_ENGINEERING | How to read empty string as well as NULL values from a csv file in pyspark? | How to read empty string as well as NULL values from a csv file in pyspark?
Read spark csv with empty values without converting to null doesn't answer this one because:
That one's scala and this is pyspark.
Scala solution .option("nullValue", null) translates to pyspark's nullValue=None, which produces wrong result... | https://stackoverflow.com/questions/79721713/how-to-read-empty-string-as-well-as-null-values-from-a-csv-file-in-pyspark | python, csv, apache-spark, pyspark | 1,753,987,310 |
se_79721756 | stackoverflow | DATA_ENGINEERING | How to use emptyValue option in pyspark while reading a csv file? | How to use emptyValue option in pyspark while reading a csv file?
According to docs of csv options:
Property Name
Default
Meaning
emptyValue
(for reading), "" (for writing)
Sets the string representation of an empty value.
But it doesn't seem to work:
with open("/dbfs/tmp/c.csv", "w") as f:
f.write('''... | https://stackoverflow.com/questions/79721756/how-to-use-emptyvalue-option-in-pyspark-while-reading-a-csv-file | csv, apache-spark, pyspark | 1,753,990,180 |
se_43024766 | stackoverflow | DATA_ENGINEERING | What are SparkSession Config Options | What are SparkSession Config Options
I am trying to use SparkSession to convert JSON data of a file to RDD with Spark Notebook. I already have the JSON file.
val spark = SparkSession
.builder()
.appName("jsonReaderApp")
.config("config.key.here", configValueHere)
.enableHiveSupport()
.getOrCreate()
va... | https://stackoverflow.com/questions/43024766/what-are-sparksession-config-options | json, apache-spark, spark-notebook | 1,490,499,964 |
se_58368528 | stackoverflow | DATA_ENGINEERING | Py4JJavaError: An error occurred while calling None.org.apache.spark.api.java.JavaSparkContext | Py4JJavaError: An error occurred while calling None.org.apache.spark.api.java.JavaSparkContext
Anyon know Why I keeo getting this error in Jupyter Notebooks??? I've been trying to load my Tensorflow model into Apache Spark vis SparlFlowbut I can't seem to figure out how to get past this error. Any help would be much a... | https://stackoverflow.com/questions/58368528/py4jjavaerror-an-error-occurred-while-calling-none-org-apache-spark-api-java-ja | python, apache-spark, tensorflow, pyspark, jupyter-notebook | 1,571,008,607 |
se_63835453 | stackoverflow | DATA_ENGINEERING | Is there a null-safe comparison operator for pyspark? | Is there a null-safe comparison operator for pyspark?
When trying to create boolean column that is True if two other column are equal and False otherwise, I noticed that Null == Null = False in spark.
df.withColumn('newCol', F.when(F.col('x')==F.col('y'), True).otherwise(False))
This: https://spark.apache.org/docs/3... | https://stackoverflow.com/questions/63835453/is-there-a-null-safe-comparison-operator-for-pyspark | python, apache-spark, pyspark | 1,599,761,550 |
se_79720010 | stackoverflow | DATA_ENGINEERING | How to summarize Spark executor computing time | How to summarize Spark executor computing time
I have a spark job running with 260K tasks. I can check individual task executor computing time from Spark UI.
For the purpose of calculate resource usage of the whole job, how to summarize all computing time? | https://stackoverflow.com/questions/79720010/how-to-summarize-spark-executor-computing-time | apache-spark, time, executor | 1,753,880,737 |
se_79709861 | stackoverflow | DATA_ENGINEERING | PySpark groupBy().applyInPandas() fails with INVALID_PANDAS_UDF despite correct signature and schema for GROUPED_MAP | PySpark groupBy().applyInPandas() fails with INVALID_PANDAS_UDF despite correct signature and schema for GROUPED_MAP
NOTE: This question has many related questions on StackOverFlow but I was unable to get my answer from any of them.
I'm attempting to parallelize Prophet time series model training across multiple time ... | https://stackoverflow.com/questions/79709861/pyspark-groupby-applyinpandas-fails-with-invalid-pandas-udf-despite-correct | python-3.x, apache-spark, pyspark, group-by, pandas-udf | 1,753,157,108 |
se_78989898 | stackoverflow | DATA_ENGINEERING | Access AWS data catalog Iceberg and Non-iceberg tables from local spark session | Access AWS data catalog Iceberg and Non-iceberg tables from local spark session
I want to read data from AWS data catalog tables(Iceberg and Non-Iceberg) from pyspark code in local environment.
I have configured the SparkSession accordingly. While I am able to access the Iceberg tables from local, the non-Iceberg tabl... | https://stackoverflow.com/questions/78989898/access-aws-data-catalog-iceberg-and-non-iceberg-tables-from-local-spark-session | apache-spark, pyspark, aws-glue | 1,726,485,241 |
se_65804715 | stackoverflow | DATA_ENGINEERING | How to get L2 norm of an array type column in PySpark? | How to get L2 norm of an array type column in PySpark?
I have a PySpark dataframe.
df1 = spark.createDataFrame([
("u1", [0, 1, 2]),
("u1", [1, 2, 3]),
("u2", [2, 3, 4]),
],
['user_id', 'features'])
print(df1.printSchema())
df1.show(truncate=False)
Output-
root
|-- user_id: string (nullable = tr... | https://stackoverflow.com/questions/65804715/how-to-get-l2-norm-of-an-array-type-column-in-pyspark | dataframe, apache-spark, pyspark, apache-spark-sql | 1,611,126,886 |
se_57083814 | stackoverflow | DATA_ENGINEERING | How to apply the describe function after grouping a PySpark DataFrame? | How to apply the describe function after grouping a PySpark DataFrame?
I want to find the cleanest way to apply the describe function to a grouped DataFrame (this question can also grow to apply any DF function to a grouped DF)
I tested grouped aggregate pandas UDF with no luck. There's always a way of doing it by pa... | https://stackoverflow.com/questions/57083814/how-to-apply-the-describe-function-after-grouping-a-pyspark-dataframe | python, apache-spark, pyspark, apache-spark-sql | 1,563,396,207 |
se_79714758 | stackoverflow | DATA_ENGINEERING | Read files from storage account in Spark - Without using keys - Azure | Read files from storage account in Spark - Without using keys - Azure
I am doing local development. Wish to run spark job locally on my desktop, and access files in storage account from my spark job.
I don't have an option to use SAS tokens or access-keys for my storage account. Is there a way out. | https://stackoverflow.com/questions/79714758/read-files-from-storage-account-in-spark-without-using-keys-azure | java, azure, scala, apache-spark | 1,753,448,110 |
se_45827664 | stackoverflow | DATA_ENGINEERING | Read from Kafka and write to hdfs in parquet | Read from Kafka and write to hdfs in parquet
I am new to the BigData eco system and kind of getting started.
I have read several articles about reading a kafka topic using spark streaming but would like to know if it is possible to read from kafka using a spark job instead of streaming ?
If yes, could you guys help m... | https://stackoverflow.com/questions/45827664/read-from-kafka-and-write-to-hdfs-in-parquet | hadoop, apache-spark, apache-kafka, hdfs, parquet | 1,503,439,289 |
se_72949764 | stackoverflow | DATA_ENGINEERING | Hadoop Azure: Issue when authenticating storage account using MSI in App Service Plan (Azure Functions) | Hadoop Azure: Issue when authenticating storage account using MSI in App Service Plan (Azure Functions)
This is similar to what has been discussed here: https://www.mail-archive.com/user@hadoop.apache.org/msg24204.html
The MSI endpoint that the hadoop-azure client expects (I think) is applicable only for VM's and not ... | https://stackoverflow.com/questions/72949764/hadoop-azure-issue-when-authenticating-storage-account-using-msi-in-app-service | java, apache-spark, hadoop, azure-functions, azure-container-apps | 1,657,617,022 |
se_38224132 | stackoverflow | DATA_ENGINEERING | Use SparkContext hadoop configuration within RDD methods/closures, like foreachPartition | Use SparkContext hadoop configuration within RDD methods/closures, like foreachPartition
I am using Spark to read a bunch of files, elaborating on them and then saving all of them as a Sequence file. What I wanted, was to have 1 sequence file per partition, so I did this:
SparkConf sparkConf = new SparkConf().setApp... | https://stackoverflow.com/questions/38224132/use-sparkcontext-hadoop-configuration-within-rdd-methods-closures-like-foreachp | java, hadoop, apache-spark, rdd | 1,467,808,421 |
se_76050130 | stackoverflow | DATA_ENGINEERING | Copy the schema from one dataframe to another | Copy the schema from one dataframe to another
I have a Spark data frame (df1) with a particular schema, and I have another dataframe with the same columns, but different schema. I know how to do it column by column, but since I have a large set of columns, it would be quite lengthy. To keep the schema consistent acros... | https://stackoverflow.com/questions/76050130/copy-the-schema-from-one-dataframe-to-another | python, apache-spark, pyspark, schema, pyspark-schema | 1,681,867,939 |
se_79711978 | stackoverflow | DATA_ENGINEERING | bigtable spark connector not reading cell timestamp with the data | bigtable spark connector not reading cell timestamp with the data
I am using bigtable spark connector to read bigtable data in scala code. I want to read the cell timestamp with the data as well. But nowhere I can find how to do it. Can someone help me on this?
I tried HBASE API client in scala. But not sure if it is ... | https://stackoverflow.com/questions/79711978/bigtable-spark-connector-not-reading-cell-timestamp-with-the-data | scala, apache-spark, google-cloud-bigtable | 1,753,277,436 |
se_30187184 | stackoverflow | DATA_ENGINEERING | Can you increase the spark shell output character limit | Can you increase the spark shell output character limit
When running code in the spark shell, it is often convenient to have small outputs/a sample printed in the shell directly rather than putting the output in a file.
By default, the shell will truncate such output after a (fairly small) given number of characters.... | https://stackoverflow.com/questions/30187184/can-you-increase-the-spark-shell-output-character-limit | apache-spark | 1,431,423,994 |
se_78278211 | stackoverflow | DATA_ENGINEERING | Improving write performance on SQL Server | Improving write performance on SQL Server
I have a few million rows of data that needs to be transferred into another SQL Server DB and was testing the speed with a small number of rows.
Using the JDBC driver the best speed was 44 rows/s.
Then I switched to the SQL Spark connector which sped up the process significant... | https://stackoverflow.com/questions/78278211/improving-write-performance-on-sql-server | sql-server, apache-spark, pyspark, optimization | 1,712,299,920 |
se_78794320 | stackoverflow | DATA_ENGINEERING | How to cast to DateType value with only month and year | How to cast to DateType value with only month and year
Given a date value with a month and a year:
03.2020
I tried to cast it to DateType as following:
to_timestamp(col("Date"), "MM.yyyy").cast(DateType)
But this returned something that I didn't expect:
2017-03-01
The returned value contains an additional "01" (da... | https://stackoverflow.com/questions/78794320/how-to-cast-to-datetype-value-with-only-month-and-year | apache-spark, date | 1,721,922,507 |
se_75207883 | stackoverflow | DATA_ENGINEERING | How to check if a request located in JDBC_SESSION_INIT_STATEMENT is working? DataframeReader | How to check if a request located in JDBC_SESSION_INIT_STATEMENT is working? DataframeReader
I am trying to connect to sql server with spark-jdbc, using JDBC_SESSION_INIT_STATEMENT to create a temporary table and then download data from the temporary table in the main query.
I have the following code:
//df is org.apac... | https://stackoverflow.com/questions/75207883/how-to-check-if-a-request-located-in-jdbc-session-init-statement-is-working-dat | sql-server, apache-spark, spark-jdbc | 1,674,467,798 |
se_79710128 | stackoverflow | DATA_ENGINEERING | Unable to access ADLS Gen2 through Spark when manually running a notebook in Synapse Analytics Studio | Unable to access ADLS Gen2 through Spark when manually running a notebook in Synapse Analytics Studio
I'm trying to read a csv file from my ADLS Gen2 container through Spark using a linked service but when I run my notebook (interactively) I'm getting java.nio.file.AccessDeniedException: Operation failed: "This reques... | https://stackoverflow.com/questions/79710128/unable-to-access-adls-gen2-through-spark-when-manually-running-a-notebook-in-syn | apache-spark, azure-synapse, azure-data-lake | 1,753,171,771 |
se_70794441 | stackoverflow | DATA_ENGINEERING | Is it possible to define recursive DataType in PySpark Dataframe? | Is it possible to define recursive DataType in PySpark Dataframe?
I want to create a schema like this example:
friendSchema = StructType([ \
StructField("firstname",StringType(),True), \
StructField("middlename",StringType(),True), \
StructField("friends",**friendSchema**,True)
I understand the data must ... | https://stackoverflow.com/questions/70794441/is-it-possible-to-define-recursive-datatype-in-pyspark-dataframe | apache-spark, pyspark, apache-spark-sql | 1,642,719,490 |
se_46973729 | stackoverflow | DATA_ENGINEERING | How to validate Spark SQL expression without executing it? | How to validate Spark SQL expression without executing it?
I want to validate if spark-sql query is syntactically correct or not without actually running the query on the cluster.
Actual use case is that I am trying to develop a user interface, which accepts user to enter a spark-sql query and I should be able to ver... | https://stackoverflow.com/questions/46973729/how-to-validate-spark-sql-expression-without-executing-it | apache-spark, apache-spark-sql | 1,509,102,767 |
se_38128233 | stackoverflow | DATA_ENGINEERING | Spark 2.0 read csv number of partitions (PySpark) | Spark 2.0 read csv number of partitions (PySpark)
I'm trying to port some code from Spark 1.6 to Spark 2.0 using new stuffs from Spark 2.0. First, I want to use the csv reader from Spark 2.0. BTW, I'm using pyspark.
With the "old" textFile function, I'm able to set the minimum number of partitions. Ex:
file= sc.te... | https://stackoverflow.com/questions/38128233/spark-2-0-read-csv-number-of-partitions-pyspark | csv, apache-spark, pyspark | 1,467,302,570 |
se_37332434 | stackoverflow | DATA_ENGINEERING | Concatenate two PySpark dataframes | Concatenate two PySpark dataframes
I'm trying to concatenate two PySpark dataframes with some columns that are only on one of them:
from pyspark.sql.functions import randn, rand
df_1 = sqlContext.range(0, 10)
+--+
|id|
+--+
| 0|
| 1|
| 2|
| 3|
| 4|
| 5|
| 6|
| 7|
| 8|
| 9|
+--+
df_2 = sqlContext.range(11, 20)
+--+... | https://stackoverflow.com/questions/37332434/concatenate-two-pyspark-dataframes | python, apache-spark, pyspark, apache-spark-sql | 1,463,686,172 |
se_79706722 | stackoverflow | DATA_ENGINEERING | Why does this PySpark job fail when performing the final checkpoint? | Why does this PySpark job fail when performing the final checkpoint?
This is tested on Spark 3.5.6:
from pyspark.sql import SparkSession
spark = (
SparkSession.builder
.appName("reproduce_union_checkpoint_example")
.config("spark.sql.caseSensitive","false")
.getOrCreate()
)
spark.sparkContext.setCheck... | https://stackoverflow.com/questions/79706722/why-does-this-pyspark-job-fail-when-performing-the-final-checkpoint | apache-spark, pyspark | 1,752,871,084 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.