[jira] [Commented] (SPARK-17908) Column names Corrupted in pysaprk dataframe groupBy
[ https://issues.apache.org/jira/browse/SPARK-17908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572478#comment-15572478 ] Harish commented on SPARK-17908: Yes. You are code structure is same as mine.. But i have 70M records with 1000 columns. It works with simple joins as above. But when you try to modify the DF multiple times this will happen, as i was getting this error from 1.6.0 but i didn't raise because i cant prove this with working use case. But it happens frequently with my code so i tried with rename Here my steps: df = df.select('key1', 'key2', 'key3', 'val','total') -70Million records df =df.withColumn('key2', 'ABC') df1= df.groupBy('key1', 'key2', 'key3').agg(func.count(func.col('val')).alias('total')) df1 = df1.columnRenamed('key2', 'key2') df3 =df.join(df1, ['key1', 'key2', 'key3'])\ .withcolumn('newcol', func.col('val')/func.col('total')) I just wanted to see if any one else observed this behavior, I will try to find the code sample to proof this issue. If not in another 1-2 days i will mark it not reproducible. > Column names Corrupted in pysaprk dataframe groupBy > --- > > Key: SPARK-17908 > URL: https://issues.apache.org/jira/browse/SPARK-17908 > Project: Spark > Issue Type: Bug > Components: PySpark >Affects Versions: 1.6.0, 1.6.1, 1.6.2, 2.0.0, 2.0.1 >Reporter: Harish >Priority: Minor > > I have DF say df > df1= df.groupBy('key1', 'key2', > 'key3').agg(func.count(func.col('val')).alias('total')) > df3 =df.join(df1, ['key1', 'key2', 'key3'])\ > .withcolumn('newcol', func.col('val')/func.col('total')) > I am getting key2 is not present in df1, which is not truw becuase df1.show > () is having the data with the key2. > Then i added this code before join-- df1 = df1.columnRenamed('key2', 'key2') > renamed with same name. Then it works. > Stack trace will say column missing, but it is npt. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17908) Column names Corrupted in pysaprk dataframe groupBy
[ https://issues.apache.org/jira/browse/SPARK-17908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572421#comment-15572421 ] Sean Owen commented on SPARK-17908: --- You must be doing something different than what you show, because what you show doesn't even quite compile. Here I adapted your example from the Python example in the docs and ran it succesfully on 2.0.1: {code} import pyspark.sql.functions as func from pyspark.sql.types import * sc = spark.sparkContext lines = sc.textFile("examples/src/main/resources/people.txt") parts = lines.map(lambda l: l.split(",")) people = parts.map(lambda p: (p[0], p[1].strip())) schemaString = "name age" fields = [StructField(field_name, StringType(), True) for field_name in schemaString.split()] schema = StructType(fields) df = spark.createDataFrame(people, schema) df1 = df.groupBy('name', 'age').agg(func.count(func.col('age')).alias('total')) df3 = df.join(df1, ['name', 'age']).withColumn('newcol', func.col('age')/func.col('total')) {code} > Column names Corrupted in pysaprk dataframe groupBy > --- > > Key: SPARK-17908 > URL: https://issues.apache.org/jira/browse/SPARK-17908 > Project: Spark > Issue Type: Bug > Components: PySpark >Affects Versions: 1.6.0, 1.6.1, 1.6.2, 2.0.0, 2.0.1 >Reporter: Harish >Priority: Minor > > I have DF say df > df1= df.groupBy('key1', 'key2', > 'key3').agg(func.count(func.col('val')).alias('total')) > df3 =df.join(df1, ['key1', 'key2', 'key3'])\ > .withcolumn('newcol', func.col('val')/func.col('total')) > I am getting key2 is not present in df1, which is not truw becuase df1.show > () is having the data with the key2. > Then i added this code before join-- df1 = df1.columnRenamed('key2', 'key2') > renamed with same name. Then it works. > Stack trace will say column missing, but it is npt. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17908) Column names Corrupted in pysaprk dataframe groupBy
[ https://issues.apache.org/jira/browse/SPARK-17908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572373#comment-15572373 ] Harish commented on SPARK-17908: Sorry.. I didnt put the actual column names of my code in stack trace, i have modified the first line of stack trace for the column names. > Column names Corrupted in pysaprk dataframe groupBy > --- > > Key: SPARK-17908 > URL: https://issues.apache.org/jira/browse/SPARK-17908 > Project: Spark > Issue Type: Bug > Components: PySpark >Affects Versions: 1.6.0, 1.6.1, 1.6.2, 2.0.0, 2.0.1 >Reporter: Harish >Priority: Minor > > I have DF say df > df1= df.groupBy('key1', 'key2', > 'key3').agg(func.count(func.col('val')).alias('total')) > df3 =df.join(df1, ['key1', 'key2', 'key3'])\ > .withcolumn('newcol', func.col('val')/func.col('total')) > I am getting key2 is not present in df1, which is not truw becuase df1.show > () is having the data with the key2. > Then i added this code before join-- df1 = df1.columnRenamed('key2', 'key2') > renamed with same name. Then it works. > Stack trace will say column missing, but it is npt. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17908) Column names Corrupted in pysaprk dataframe groupBy
[ https://issues.apache.org/jira/browse/SPARK-17908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572330#comment-15572330 ] Sean Owen commented on SPARK-17908: --- Yes what's your code? This says one DF has just 'columns' as column. > Column names Corrupted in pysaprk dataframe groupBy > --- > > Key: SPARK-17908 > URL: https://issues.apache.org/jira/browse/SPARK-17908 > Project: Spark > Issue Type: Bug > Components: PySpark >Affects Versions: 1.6.0, 1.6.1, 1.6.2, 2.0.0, 2.0.1 >Reporter: Harish >Priority: Minor > > I have DF say df > df1= df.groupBy('key1', 'key2', > 'key3').agg(func.count(func.col('val')).alias('total')) > df3 =df.join(df1, ['key1', 'key2', 'key3'])\ > .withcolumn('newcol', func.col('val')/func.col('total')) > I am getting key2 is not present in df1, which is not truw becuase df1.show > () is having the data with the key2. > Then i added this code before join-- df1 = df1.columnRenamed('key2', 'key2') > renamed with same name. Then it works. > Stack trace will say column missing, but it is npt. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17908) Column names Corrupted in pysaprk dataframe groupBy
[ https://issues.apache.org/jira/browse/SPARK-17908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572278#comment-15572278 ] Harish commented on SPARK-17908: Traceback (most recent call last): File "/home/hpcuser/iri/spark-2.0.1-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco File "/home/hpcuser/iri/spark-2.0.1-bin-hadoop2.7/python/lib/py4j-0.10.3-src.zip/py4j/protocol.py", line 319, in get_return_value py4j.protocol.Py4JJavaError: An error occurred while calling o376.select. : org.apache.spark.sql.AnalysisException: cannot resolve '`key2`' given input columns: [columns]; at org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42) at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:77) at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:74) at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:301) at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:301) at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:69) at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:300) at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionUp$1(QueryPlan.scala:191) at org.apache.spark.sql.catalyst.plans.QueryPlan.org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2(QueryPlan.scala:201) at org.apache.spark.sql.catalyst.plans.QueryPlan$$anonfun$org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2$1.apply(QueryPlan.scala:205) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) at scala.collection.TraversableLike$class.map(TraversableLike.scala:234) at scala.collection.AbstractTraversable.map(Traversable.scala:104) at org.apache.spark.sql.catalyst.plans.QueryPlan.org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2(QueryPlan.scala:205) at org.apache.spark.sql.catalyst.plans.QueryPlan$$anonfun$5.apply(QueryPlan.scala:210) at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:179) at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionsUp(QueryPlan.scala:210) at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1.apply(CheckAnalysis.scala:74) at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1.apply(CheckAnalysis.scala:67) at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126) at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$class.checkAnalysis(CheckAnalysis.scala:67) at org.apache.spark.sql.catalyst.analysis.Analyzer.checkAnalysis(Analyzer.scala:58) at org.apache.spark.sql.execution.QueryExecution.assertAnalyzed(QueryExecution.scala:49) at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:64) at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$withPlan(Dataset.scala:2603) at org.apache.spark.sql.Dataset.select(Dataset.scala:969) at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:237) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:280) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:214) at java.lang.Thread.run(Thread.java:745) > Column names Corrupted in pysaprk dataframe groupBy > --- > > Key: SPARK-17908 > URL: https://issues.apache.org/jira/browse/SPARK-17908 > Project: Spark > Issue Type: Bug > Components: PySpark >Affects Versions: 1.6.0, 1.6.1, 1.6.2, 2.0.0, 2.0.1 >Reporter: Harish >Priority: Minor > > I have DF say df > df1= df.groupBy('key1', 'key2', > 'key3').agg(func.count(func.col('val')).alias('total')) > df3 =df.join(df1, ['key1', 'key2', 'key3'])\ >
[jira] [Commented] (SPARK-17908) Column names Corrupted in pysaprk dataframe groupBy
[ https://issues.apache.org/jira/browse/SPARK-17908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572189#comment-15572189 ] Sean Owen commented on SPARK-17908: --- Can you provide the error and a self-contained reproduction? I can't reproduce that on similar code but there's probably something different in what you're actually doing. > Column names Corrupted in pysaprk dataframe groupBy > --- > > Key: SPARK-17908 > URL: https://issues.apache.org/jira/browse/SPARK-17908 > Project: Spark > Issue Type: Bug > Components: PySpark >Affects Versions: 1.6.0, 1.6.1, 1.6.2, 2.0.0, 2.0.1 >Reporter: Harish >Priority: Minor > > I have DF say df > df1= df.groupBy('key1', 'key2', > 'key3').agg(func.count(func.col('val')).alias('total')) > df3 =df.join(df1, ['key1', 'key2', 'key3'])\ > .withcolumn('newcol', func.col('val')/func.col('total')) > I am getting key2 is not present in df1, which is not truw becuase df1.show > () is having the data with the key2. > Then i added this code before join-- df1 = df1.columnRenamed('key2', 'key2') > renamed with same name. Then it works. > Stack trace will say column missing, but it is npt. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org