jiayuasu commented on a change in pull request #515:
URL: https://github.com/apache/incubator-sedona/pull/515#discussion_r598235864



##########
File path: 
sql/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/SpatialIndexExec.scala
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.sql.sedona_sql.strategy.join
+
+import scala.collection.JavaConverters._
+
+import org.apache.sedona.core.enums.IndexType
+import org.apache.spark.broadcast.Broadcast
+import org.apache.spark.internal.Logging
+import org.apache.spark.rdd.RDD
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Attribute, BindReferences, 
Expression, UnsafeRow}
+import org.apache.spark.sql.execution.{SparkPlan, UnaryExecNode}
+
+
+
+case class SpatialIndexExec(child: SparkPlan,
+                            shape: Expression,
+                            indexType: IndexType)
+  extends UnaryExecNode
+    with TraitJoinQueryBase
+    with Logging {
+
+  override def output: Seq[Attribute] = child.output
+  
+  override protected def doExecute(): RDD[InternalRow] = {
+    throw new UnsupportedOperationException(
+      "SpatialIndex does not support the execute() code path.")
+  }
+
+  override protected[sql] def doExecuteBroadcast[T](): Broadcast[T] = {
+    val boundShape = BindReferences.bindReference(shape, child.output)

Review comment:
       It looks like, in the broadcast join, the spatial index is built on the 
broadcasted RDD (namely A).
   
   Is it a better choice to build local spatial index on each partition of the 
distributed RDD (namely B)?
   
   Since I assume the broadcasted RDD A is usually very small (a couple hundred 
records) while each partition of B might be larger?




-- 
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.

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


Reply via email to