Skip to content

Commit

Permalink
Merge pull request #14 from vinted/feat/add-rows-type
Browse files Browse the repository at this point in the history
feat: create rows type
  • Loading branch information
gintarasm authored Jan 24, 2024
2 parents 6dab5c0 + de41769 commit 1eb5b22
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/com/vinted/flink/bigquery/typeutils/RowsType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.vinted.flink.bigquery.typeutils;

import com.google.cloud.bigquery.TableId;
import com.vinted.flink.bigquery.model.Rows;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.common.typeinfo.Types;

import java.util.Map;

public class RowsType {
public static <A> TypeInformation<Rows<A>> of(TypeInformation<A> typeInfo) {
return Types.POJO((Class<Rows<A>>)(Class<?>)Rows.class, Map.of(
"data", Types.LIST(typeInfo),
"offset", Types.LONG,
"stream", Types.STRING,
"table", TypeInformation.of(TableId.class)
));
}
}

0 comments on commit 1eb5b22

Please sign in to comment.