SemyonSinchenko commented on code in PR #60612:
URL: https://github.com/apache/spark/pull/60612#discussion_r4611505924


##########
graph/src/main/scala/org/apache/spark/graph/GraphFrame.scala:
##########
@@ -0,0 +1,583 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.graph
+
+import org.apache.spark.annotation.Experimental
+import org.apache.spark.graph.GraphErrors.{EDGE_PROPERTIES, EDGES, 
VERTEX_PROPERTIES, VERTICES}
+import org.apache.spark.sql.{AnalysisException, Column, DataFrame}
+import org.apache.spark.sql.catalyst.analysis.{caseInsensitiveResolution, 
caseSensitiveResolution, Resolver}
+import org.apache.spark.sql.catalyst.util.QuotingUtils.quoteIdentifier
+import org.apache.spark.sql.functions.{array, col, countDistinct, explode, 
expr}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{ByteType, DataType, IntegerType, LongType, 
ShortType, StringType}
+import org.apache.spark.storage.StorageLevel
+
+/**
+ * :: Experimental :: A representation of a graph by two DataFrames: one for 
vertices and one for
+ * edges.
+ *
+ * A graph is a pair \( G = (V, E) \), where \( V \) is the set of vertices 
and \( E \) is the
+ * list of edges. Each edge is a pair of vertices, so \( E \) is defined over 
\( V \times V \).
+ * `GraphFrame` stores \( V \) in the `vertices` DataFrame and \( E \) in the 
`edges` DataFrame.
+ *
+ * The `GraphFrame` model assumes that the graph is valid: vertex IDs are 
unique and not NULL, and
+ * every edge goes from an existing vertex ID to an existing vertex ID. This 
is never checked
+ * implicitly: an invalid graph silently produces incorrect results instead of 
an exception. Call
+ * `validate()` to check that a graph is valid. `validate()` runs several 
Spark jobs, so it is not
+ * free.
+ *
+ * Required vertex columns:
+ *   - "id", the vertex ID. See `GraphFrame.ID`
+ *
+ * Required edge columns:
+ *   - "src", the source vertex ID. See `GraphFrame.SRC`
+ *   - "dst", the destination vertex ID. See `GraphFrame.DST`
+ *
+ * Optional edge columns:
+ *   - "weight", the edge weight. See `GraphFrame.WEIGHT`
+ *
+ * All other columns are vertex or edge properties. Avoid using the reserved 
column names for
+ * properties: this is not checked, but such columns may conflict with columns 
produced by graph
+ * operations.
+ *
+ * The "id", "src" and "dst" columns must have the same data type, which is 
one of:
+ *   - `ByteType` (BYTE, TINYINT)
+ *   - `ShortType` (SHORT, SMALLINT)
+ *   - `IntegerType` (INT, INTEGER)
+ *   - `LongType` (LONG, BIGINT)
+ *   - `StringType` (STRING), with the default UTF8_BINARY collation only
+ *
+ * No other data type can be used for vertex IDs. `StringType` IDs are fully 
supported, but prefer
+ * `LongType` when possible: it uses significantly less memory and makes most 
algorithms from the
+ * standard library faster. Some algorithms support only integral IDs and 
convert `StringType` IDs
+ * implicitly, which can significantly affect performance.
+ *
+ * `GraphFrame` is a directed graph by construction. To represent an 
undirected graph, store every
+ * edge in both directions: (src, dst) and (dst, src). The method 
`asUndirected()` does this for
+ * an existing `GraphFrame`. Keep in mind that not all algorithms support both 
directed and
+ * undirected graphs; this is controlled at the algorithm level by a 
corresponding argument.
+ *
+ * @groupname structure Basic graph structure information
+ * @groupname conversions Conversion operations
+ * @groupname subgraph Subgraph selection
+ * @groupname transformations Graph transformations
+ * @groupname utils Graph utilities
+ *
+ * @since 5.0.0

Review Comment:
   Changed to 4.5.0



##########
graph/pom.xml:
##########
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.spark</groupId>
+    <artifactId>spark-parent_2.13</artifactId>
+    <version>5.0.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>spark-graph_2.13</artifactId>
+  <properties>
+    <sbt.project.name>graph</sbt.project.name>
+  </properties>
+  <packaging>jar</packaging>
+  <name>Spark Project Graph</name>
+  <url>https://spark.apache.org/</url>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.spark</groupId>
+      <artifactId>spark-core_${scala.binary.version}</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.spark</groupId>
+      <artifactId>spark-core_${scala.binary.version}</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.spark</groupId>
+      <artifactId>spark-sql_${scala.binary.version}</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.spark</groupId>
+      <artifactId>spark-catalyst_${scala.binary.version}</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.spark</groupId>
+      <artifactId>spark-sql_${scala.binary.version}</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.spark</groupId>
+      <artifactId>spark-sql-api_${scala.binary.version}</artifactId>

Review Comment:
   Removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to