30
30
import com .google .cloud .bigquery .TableDefinition ;
31
31
import com .google .cloud .bigquery .TableId ;
32
32
import com .google .cloud .bigquery .TableInfo ;
33
+ import java .util .Base64 ;
33
34
import java .util .HashMap ;
34
35
import java .util .List ;
35
36
import java .util .Map ;
@@ -53,10 +54,7 @@ public static void insertingDataTypes(String datasetName, String tableName) {
53
54
// Inserting data types
54
55
Field name = Field .of ("name" , StandardSQLTypeName .STRING );
55
56
Field age = Field .of ("age" , StandardSQLTypeName .INT64 );
56
- Field school =
57
- Field .newBuilder ("school" , StandardSQLTypeName .BYTES )
58
- .setMode (Field .Mode .REPEATED )
59
- .build ();
57
+ Field school = Field .of ("school" , StandardSQLTypeName .BYTES );
60
58
Field location = Field .of ("location" , StandardSQLTypeName .GEOGRAPHY );
61
59
Field measurements =
62
60
Field .newBuilder ("measurements" , StandardSQLTypeName .FLOAT64 )
@@ -86,7 +84,7 @@ public static void insertingDataTypes(String datasetName, String tableName) {
86
84
Map <String , Object > rowContent = new HashMap <>();
87
85
rowContent .put ("name" , "Tom" );
88
86
rowContent .put ("age" , 30 );
89
- rowContent .put ("school" , "Test University" .getBytes ());
87
+ rowContent .put ("school" , Base64 . getEncoder (). encodeToString ( "Test University" .getBytes () ));
90
88
rowContent .put ("location" , "POINT(1 2)" );
91
89
rowContent .put ("measurements" , new Float [] {50.05f , 100.5f });
92
90
rowContent .put ("datesTime" , datesTimeContent );
0 commit comments