Skip to content

Commit

Permalink
add comment in StructField
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 committed Dec 3, 2023
1 parent 52c45c9 commit 689e773
Showing 1 changed file with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,26 @@ class RowSetSuite extends KyuubiFunSuite {
}

val schemaStructFields: Seq[StructField] = Seq(
("a", "boolean"),
("b", "tinyint"),
("c", "smallint"),
("d", "int"),
("e", "bigint"),
("f", "float"),
("g", "double"),
("h", "string"),
("i", "decimal"),
("j", "date"),
("k", "timestamp"),
("l", "binary"),
("m", "array<double>"),
("n", "map<int, double>"),
("o", "interval"),
("p", "date"),
("q", "timestamp")).map {
case (colName, typeName) => StructField(colName, CatalystSqlParser.parseDataType(typeName))
("a", "boolean", "boolVal"),
("b", "tinyint", "byteVal"),
("c", "smallint", "shortVal"),
("d", "int", "value"),
("e", "bigint", "longVal"),
("f", "float", "floatVal"),
("g", "double", "doubleVal"),
("h", "string", "stringVal"),
("i", "decimal", "decimalVal"),
("j", "date", "dateVal"),
("k", "timestamp", "timestampVal"),
("l", "binary", "binaryVal"),
("m", "array<double>", "arrVal"),
("n", "map<int, double>", "mapVal"),
("o", "interval", "interval"),
("p", "date", "localDate"),
("q", "timestamp", "instant")).map {
case (colName, typeName, comment) =>
StructField(colName, CatalystSqlParser.parseDataType(typeName))
.withComment(comment)
}

val schema: StructType = {
Expand Down Expand Up @@ -298,7 +300,7 @@ class RowSetSuite extends KyuubiFunSuite {

def singleColumn(field: StructField, index: Int, protocolVersion: TProtocolVersion): Unit = {
benchmarkToTRowSet(
field.dataType.typeName,
field.getComment().getOrElse(field.dataType.typeName),
allRows.map(row => Row(row.get(index))).asInstanceOf[Seq[Row]],
StructType(Seq(field)),
protocolVersion)
Expand Down

0 comments on commit 689e773

Please sign in to comment.