Skip to content

Commit

Permalink
Fix output schema issue and IT
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Dai <daichen@amazon.com>
  • Loading branch information
dai-chen committed Jun 13, 2023
1 parent cbc8a33 commit f3ef196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ class FlintSparkSkippingIndex(
}

private def getSchema: String = {
val indexFieldTypes = indexedColumns.map { indexCol =>
val columnName = indexCol.columnName
// Data type INT from catalog is not recognized by Spark DataType.fromJson()
val columnType = if (indexCol.columnType == "int") "integer" else indexCol.columnType
val sparkType = DataType.fromJson("\"" + columnType + "\"")
StructField(columnName, sparkType, nullable = false)
}
val indexFieldTypes =
indexedColumns.flatMap(_.outputSchema()).map { case (colName, colType) =>
// Data type INT from catalog is not recognized by Spark DataType.fromJson()
val columnType = if (colType == "int") "integer" else colType
val sparkType = DataType.fromJson("\"" + columnType + "\"")
StructField(colName, sparkType, nullable = false)
}

val allFieldTypes =
indexFieldTypes :+ StructField(FILE_PATH_COLUMN, StringType, nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ class FlintSparkSkippingIndexSuite
| "address": {
| "type": "keyword"
| },
| "age": {
| "MinMax_age_0": {
| "type": "integer"
| },
| "MinMax_age_1" : {
| "type": "integer"
| },
| "file_path": {
Expand Down

0 comments on commit f3ef196

Please sign in to comment.