Skip to content

Commit

Permalink
fix & regen golden files
Browse files Browse the repository at this point in the history
  • Loading branch information
itholic committed Aug 28, 2024
1 parent c51388a commit 139068b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ object functions {
data: Column,
messageClassName: String,
options: java.util.Map[String, String]): Column = {
from_protobuf(data, messageClassName, "", options)
Column.internalFnWithOptions(
"to_protobuf",
options.asScala.iterator,
data,
lit(messageClassName)
)
}

/**
Expand Down Expand Up @@ -309,6 +314,11 @@ object functions {
@Experimental
def to_protobuf(data: Column, messageClassName: String, options: java.util.Map[String, String])
: Column = {
to_protobuf(data, messageClassName, "", options)
Column.internalFnWithOptions(
"to_protobuf",
options.asScala.iterator,
data,
lit(messageClassName)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,19 @@ case class FromProtobuf(
descFilePath: Expression,
options: Expression) extends QuaternaryExpression with RuntimeReplaceable {

def this(data: Expression, messageName: Expression, descFilePath: Expression) = {
this(data, messageName, descFilePath, Literal(null))
def this(data: Expression, messageName: Expression, descFilePathOrOptions: Expression) = {
this(
data,
messageName,
descFilePathOrOptions.dataType match {
case _: StringType | BinaryType => descFilePathOrOptions
case _ => Literal(null)
},
descFilePathOrOptions.dataType match {
case _: MapType => descFilePathOrOptions
case _ => Literal(null)
}
)
}

def this(data: Expression, messageName: Expression) = {
Expand Down Expand Up @@ -210,8 +221,19 @@ case class ToProtobuf(
descFilePath: Expression,
options: Expression) extends QuaternaryExpression with RuntimeReplaceable {

def this(data: Expression, messageName: Expression, descFilePath: Expression) = {
this(data, messageName, descFilePath, Literal(null))
def this(data: Expression, messageName: Expression, descFilePathOrOptions: Expression) = {
this(
data,
messageName,
descFilePathOrOptions.dataType match {
case _: StringType | BinaryType => descFilePathOrOptions
case _ => Literal(null)
},
descFilePathOrOptions.dataType match {
case _: MapType => descFilePathOrOptions
case _ => Literal(null)
}
)
}

def this(data: Expression, messageName: Expression) = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [from_protobuf(bytes#0, StorageLevel, Some([B)) AS from_protobuf(bytes)#0]
Project [from_protobuf(bytes#0, StorageLevel, Some([B)) AS fromprotobuf(bytes, StorageLevel, X'0AFC010A0C636F6D6D6F6E2E70726F746F120D737061726B2E636F6E6E65637422B0010A0C53746F726167654C6576656C12190A087573655F6469736B18012001280852077573654469736B121D0A0A7573655F6D656D6F727918022001280852097573654D656D6F727912200A0C7573655F6F66665F68656170180320012808520A7573654F66664865617012220A0C646573657269616C697A6564180420012808520C646573657269616C697A656412200A0B7265706C69636174696F6E180520012805520B7265706C69636174696F6E42220A1E6F72672E6170616368652E737061726B2E636F6E6E6563742E70726F746F5001620670726F746F33', NULL)#0]
+- LocalRelation <empty>, [id#0L, bytes#0]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [from_protobuf(bytes#0, StorageLevel, Some([B), (recursive.fields.max.depth,2)) AS from_protobuf(bytes)#0]
Project [from_protobuf(bytes#0, StorageLevel, Some([B), (recursive.fields.max.depth,2)) AS fromprotobuf(bytes, StorageLevel, X'0AFC010A0C636F6D6D6F6E2E70726F746F120D737061726B2E636F6E6E65637422B0010A0C53746F726167654C6576656C12190A087573655F6469736B18012001280852077573654469736B121D0A0A7573655F6D656D6F727918022001280852097573654D656D6F727912200A0C7573655F6F66665F68656170180320012808520A7573654F66664865617012220A0C646573657269616C697A6564180420012808520C646573657269616C697A656412200A0B7265706C69636174696F6E180520012805520B7265706C69636174696F6E42220A1E6F72672E6170616368652E737061726B2E636F6E6E6563742E70726F746F5001620670726F746F33', map(recursive.fields.max.depth, 2))#0]
+- LocalRelation <empty>, [id#0L, bytes#0]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [to_protobuf(bytes#0, org.apache.spark.connect.proto.StorageLevel, None) AS to_protobuf(bytes)#0]
Project [to_protobuf(bytes#0, org.apache.spark.connect.proto.StorageLevel, None) AS toprotobuf(bytes, org.apache.spark.connect.proto.StorageLevel, NULL, NULL)#0]
+- LocalRelation <empty>, [id#0L, bytes#0]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [to_protobuf(bytes#0, StorageLevel, Some([B)) AS to_protobuf(bytes)#0]
Project [to_protobuf(bytes#0, StorageLevel, Some([B)) AS toprotobuf(bytes, StorageLevel, X'0AFC010A0C636F6D6D6F6E2E70726F746F120D737061726B2E636F6E6E65637422B0010A0C53746F726167654C6576656C12190A087573655F6469736B18012001280852077573654469736B121D0A0A7573655F6D656D6F727918022001280852097573654D656D6F727912200A0C7573655F6F66665F68656170180320012808520A7573654F66664865617012220A0C646573657269616C697A6564180420012808520C646573657269616C697A656412200A0B7265706C69636174696F6E180520012805520B7265706C69636174696F6E42220A1E6F72672E6170616368652E737061726B2E636F6E6E6563742E70726F746F5001620670726F746F33', NULL)#0]
+- LocalRelation <empty>, [id#0L, bytes#0]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [to_protobuf(bytes#0, StorageLevel, Some([B), (recursive.fields.max.depth,2)) AS to_protobuf(bytes)#0]
Project [to_protobuf(bytes#0, StorageLevel, Some([B), (recursive.fields.max.depth,2)) AS toprotobuf(bytes, StorageLevel, X'0AFC010A0C636F6D6D6F6E2E70726F746F120D737061726B2E636F6E6E65637422B0010A0C53746F726167654C6576656C12190A087573655F6469736B18012001280852077573654469736B121D0A0A7573655F6D656D6F727918022001280852097573654D656D6F727912200A0C7573655F6F66665F68656170180320012808520A7573654F66664865617012220A0C646573657269616C697A6564180420012808520C646573657269616C697A656412200A0B7265706C69636174696F6E180520012805520B7265706C69636174696F6E42220A1E6F72672E6170616368652E737061726B2E636F6E6E6563742E70726F746F5001620670726F746F33', map(recursive.fields.max.depth, 2))#0]
+- LocalRelation <empty>, [id#0L, bytes#0]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [to_protobuf(bytes#0, org.apache.spark.connect.proto.StorageLevel, None, (recursive.fields.max.depth,2)) AS to_protobuf(bytes)#0]
Project [to_protobuf(bytes#0, org.apache.spark.connect.proto.StorageLevel, None, (recursive.fields.max.depth,2)) AS toprotobuf(bytes, org.apache.spark.connect.proto.StorageLevel, NULL, map(recursive.fields.max.depth, 2))#0]
+- LocalRelation <empty>, [id#0L, bytes#0]

0 comments on commit 139068b

Please sign in to comment.