Skip to content

Commit

Permalink
Added a "random record" column to the all_types table
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaidioz committed Feb 25, 2025
1 parent a43bbde commit 93753d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/scala/com/rawlabs/das/mock/DASMock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ class DASMock(options: Map[String, String]) extends DASSdk with StrictLogging {
.build())
.build())
.build())
.addColumns(ColumnDefinition
.newBuilder()
.setName("random_record_col")
.setType(Type.newBuilder().setRecord(RecordType.newBuilder().build()).build())
.build())
.addColumns(
ColumnDefinition
.newBuilder()
Expand Down
15 changes: 15 additions & 0 deletions src/test/scala/com/rawlabs/das/mock/DASMockAllTypesTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ class DASMockAllTypesTable(maxRows: Int) extends DASTable {
.build())
record.build()
},
"random_record_col" -> {
// Generate a random record (with random number of attributes of random names)
val record = ValueRecord
.newBuilder()
(1 to (i % 5)).map { j =>
record.addAtts(
ValueRecordAttr
.newBuilder()
.setName(s"attr$j")
.setValue(
Value.newBuilder().setString(ValueString.newBuilder().setV(s"random value $j").build()).build())
.build())
}
Value.newBuilder().setRecord(record.build()).build()
},
"str_record_col" -> {
val record = Value
.newBuilder()
Expand Down

0 comments on commit 93753d6

Please sign in to comment.