You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/04 05:01:59 UTC
[GitHub] [spark] dengziming opened a new pull request, #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
dengziming opened a new pull request, #38899:
URL: https://github.com/apache/spark/pull/38899
### What changes were proposed in this pull request?
1. Implement `DataFrame.hint` for scala API
2. Implement `DataFrame.hint` for python API
### Why are the changes needed?
API coverage
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
UT
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1340555077
thanks, merging to master!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1336533561
Can one of the admins verify this patch?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dengziming commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
dengziming commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1039377343
##########
connector/connect/src/test/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverterSuite.scala:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.connect.planner
+
+import org.scalatest.funsuite.AnyFunSuite
+
+import org.apache.spark.sql.connect.planner.LiteralValueProtoConverter.{toCatalystValue, toConnectProtoValue}
+
+
+class LiteralValueProtoConverterSuite extends AnyFunSuite {
+
+ test("Round-trip") {
Review Comment:
Good suggestions.
##########
connector/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectPlannerSuite.scala:
##########
@@ -571,4 +572,28 @@ class SparkConnectPlannerSuite extends SparkFunSuite with SparkConnectPlanTest {
Dataset.ofRows(spark, transform(proto.Relation.newBuilder.setProject(project).build()))
assert(df.schema.fields.toSeq.map(_.name) == Seq("id"))
}
+
+ test("Test Hint") {
Review Comment:
I added a illegal hint name, it seems that spark will ignore it.
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -233,19 +235,9 @@ class SparkConnectPlanner(session: SparkSession) {
}
private def transformReplace(rel: proto.NAReplace): LogicalPlan = {
- def convert(value: proto.Expression.Literal): Any = {
- value.getLiteralTypeCase match {
- case proto.Expression.Literal.LiteralTypeCase.NULL => null
- case proto.Expression.Literal.LiteralTypeCase.BOOLEAN => value.getBoolean
- case proto.Expression.Literal.LiteralTypeCase.DOUBLE => value.getDouble
- case proto.Expression.Literal.LiteralTypeCase.STRING => value.getString
- case other => throw InvalidPlanInput(s"Unsupported value type: $other")
- }
- }
-
val replacement = mutable.Map.empty[Any, Any]
rel.getReplacementsList.asScala.foreach { replace =>
- replacement.update(convert(replace.getOldValue), convert(replace.getNewValue))
+ replacement.update(toCatalystValue(replace.getOldValue), toCatalystValue(replace.getNewValue))
Review Comment:
I moved the method `transformLiteral` to a util object to reuse its code.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1338610351
@dengziming mind rebasing this please? Otherwise, should be good to go.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1041759325
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverter.scala:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.connect.planner
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.connect.proto
+import org.apache.spark.sql.catalyst.{expressions, InternalRow}
+import org.apache.spark.sql.catalyst.expressions.{CreateArray, CreateMap, CreateStruct}
+import org.apache.spark.sql.types._
+import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
+
+object LiteralValueProtoConverter {
+
+ /**
+ * Transforms the protocol buffers literals into the appropriate Catalyst literal expression.
+ *
+ * @return
+ * Expression
Review Comment:
hmmm we actually enforce scalafmt for Spark Connect code. So if this pass scalafmt that is fine.
Only Spark Connect enforce that so if you are seeing this is different from other modules, that is expected.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1040849638
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/dsl/package.scala:
##########
@@ -694,6 +685,18 @@ package object dsl {
.build()
}
+ def hint(name: String, parameters: Any*): Relation = {
+ Relation
+ .newBuilder()
+ .setHint(
+ Hint
Review Comment:
hmm, the proto message `Hint` was added before this PR?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dengziming commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
dengziming commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1041709267
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverter.scala:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.connect.planner
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.connect.proto
+import org.apache.spark.sql.catalyst.{expressions, InternalRow}
+import org.apache.spark.sql.catalyst.expressions.{CreateArray, CreateMap, CreateStruct}
+import org.apache.spark.sql.types._
+import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
+
+object LiteralValueProtoConverter {
+
+ /**
+ * Transforms the protocol buffers literals into the appropriate Catalyst literal expression.
+ *
+ * @return
+ * Expression
Review Comment:
Thank your for your suggestions, in fact, this is formatted by the scalafmt plugin, you can use `./dev/lint-scala` to format the code before submit a PR.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1336387783
cc @amaliujia FYI
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] beliefer commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1041674643
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverter.scala:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.connect.planner
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.connect.proto
+import org.apache.spark.sql.catalyst.{expressions, InternalRow}
+import org.apache.spark.sql.catalyst.expressions.{CreateArray, CreateMap, CreateStruct}
+import org.apache.spark.sql.types._
+import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
+
+object LiteralValueProtoConverter {
+
+ /**
+ * Transforms the protocol buffers literals into the appropriate Catalyst literal expression.
+ *
+ * @return
+ * Expression
Review Comment:
```suggestion
* @return Expression
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] beliefer commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1041753682
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverter.scala:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.connect.planner
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.connect.proto
+import org.apache.spark.sql.catalyst.{expressions, InternalRow}
+import org.apache.spark.sql.catalyst.expressions.{CreateArray, CreateMap, CreateStruct}
+import org.apache.spark.sql.types._
+import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
+
+object LiteralValueProtoConverter {
+
+ /**
+ * Transforms the protocol buffers literals into the appropriate Catalyst literal expression.
+ *
+ * @return
+ * Expression
Review Comment:
Yeah. But it seems strange. cc @amaliujia
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1039041717
##########
connector/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectPlannerSuite.scala:
##########
@@ -571,4 +572,28 @@ class SparkConnectPlannerSuite extends SparkFunSuite with SparkConnectPlanTest {
Dataset.ofRows(spark, transform(proto.Relation.newBuilder.setProject(project).build()))
assert(df.schema.fields.toSeq.map(_.name) == Seq("id"))
}
+
+ test("Test Hint") {
Review Comment:
Maybe also add a test case to have a random hint name? I expect Catalyst will throw something.
##########
connector/connect/src/test/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverterSuite.scala:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.connect.planner
+
+import org.scalatest.funsuite.AnyFunSuite
+
+import org.apache.spark.sql.connect.planner.LiteralValueProtoConverter.{toCatalystValue, toConnectProtoValue}
+
+
+class LiteralValueProtoConverterSuite extends AnyFunSuite {
+
+ test("Round-trip") {
Review Comment:
Nit: better replace this test name by `test proto value and catalyst value conversion`, optionally you can add the SPARK-xxxx at the beginning of the test name.
##########
python/pyspark/sql/connect/plan.py:
##########
@@ -32,6 +32,21 @@ class InputValidationError(Exception):
pass
+def convert_value(v: Any) -> proto.Expression.Literal:
Review Comment:
we have this: https://github.com/apache/spark/blob/master/python/pyspark/sql/connect/column.py#L178
is it feasible to extract the common part and re-use?
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -233,19 +235,9 @@ class SparkConnectPlanner(session: SparkSession) {
}
private def transformReplace(rel: proto.NAReplace): LogicalPlan = {
- def convert(value: proto.Expression.Literal): Any = {
- value.getLiteralTypeCase match {
- case proto.Expression.Literal.LiteralTypeCase.NULL => null
- case proto.Expression.Literal.LiteralTypeCase.BOOLEAN => value.getBoolean
- case proto.Expression.Literal.LiteralTypeCase.DOUBLE => value.getDouble
- case proto.Expression.Literal.LiteralTypeCase.STRING => value.getString
- case other => throw InvalidPlanInput(s"Unsupported value type: $other")
- }
- }
-
val replacement = mutable.Map.empty[Any, Any]
rel.getReplacementsList.asScala.foreach { replace =>
- replacement.update(convert(replace.getOldValue), convert(replace.getNewValue))
+ replacement.update(toCatalystValue(replace.getOldValue), toCatalystValue(replace.getNewValue))
Review Comment:
In fact there is a `private def transformLiteral(lit: proto.Expression.Literal):` that covers all literal value conversion.
Either re-use that one or merge that one with the `toCatalystValue`?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan closed pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
URL: https://github.com/apache/spark/pull/38899
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dengziming commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
dengziming commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1040852710
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/dsl/package.scala:
##########
@@ -694,6 +685,18 @@ package object dsl {
.build()
}
+ def hint(name: String, parameters: Any*): Relation = {
+ Relation
+ .newBuilder()
+ .setHint(
+ Hint
Review Comment:
Yes, it was already added in #38857
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
amaliujia commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1338112177
@cloud-fan can you take a look?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
amaliujia commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1336537633
@dengziming there are several techniques that can help you:
when you working on Scala, you can run `./dev/lint-scala` locally which does scala side lint check. One of the check of that is the format over the Connect Scala module, which in fact you can run this command to auto-format the connect Scala code: `./build/mvn -Pscala-2.12 scalafmt:format -Dscalafmt.skip=fase -Dscalafmt.validateOnly=false -Dscalafmt.changedOnly=false -pl connector/connect`
When you working on Python side, after you build the Scala side jars, you can run `./python/run-tests --module pyspark-connect` to test your code (you may consider use https://docs.conda.io/en/latest/miniconda.html to manage the python envs and in the conda env you can `pip install -r dev/requirement.txt --upgrade`).
Similar, you can run `./dev/lint-python` to do the lint check. And there will be some prompted suggestions if you fail a check.
Please feel free to ask questions that help you develop easier.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dengziming commented on pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
dengziming commented on PR #38899:
URL: https://github.com/apache/spark/pull/38899#issuecomment-1338823235
Hello @HyukjinKwon , I saw the related changes has been reverted, so I also reverted my change.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #38899: [SPARK-41349][CONNECT] Implement DataFrame.hint
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #38899:
URL: https://github.com/apache/spark/pull/38899#discussion_r1041759325
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/LiteralValueProtoConverter.scala:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.connect.planner
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.connect.proto
+import org.apache.spark.sql.catalyst.{expressions, InternalRow}
+import org.apache.spark.sql.catalyst.expressions.{CreateArray, CreateMap, CreateStruct}
+import org.apache.spark.sql.types._
+import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
+
+object LiteralValueProtoConverter {
+
+ /**
+ * Transforms the protocol buffers literals into the appropriate Catalyst literal expression.
+ *
+ * @return
+ * Expression
Review Comment:
hmmm we actually enable scalafmt for Spark Connect code. So if this pass scalafmt that is fine.
Only Spark Connect enforce that so if you are seeing this is different from other modules, that is expected.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org