Java Code Examples for com.google.cloud.bigquery.LegacySQLTypeName#RECORD
The following examples show how to use
com.google.cloud.bigquery.LegacySQLTypeName#RECORD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BigQueryUtils.java From nifi with Apache License 2.0 | 6 votes |
public static Field mapToField(Map fMap) { String typeStr = fMap.get("type").toString(); String nameStr = fMap.get("name").toString(); String modeStr = fMap.get("mode").toString(); LegacySQLTypeName type = null; if (typeStr.equals("BOOLEAN")) { type = LegacySQLTypeName.BOOLEAN; } else if (typeStr.equals("STRING")) { type = LegacySQLTypeName.STRING; } else if (typeStr.equals("BYTES")) { type = LegacySQLTypeName.BYTES; } else if (typeStr.equals("INTEGER")) { type = LegacySQLTypeName.INTEGER; } else if (typeStr.equals("FLOAT")) { type = LegacySQLTypeName.FLOAT; } else if (typeStr.equals("TIMESTAMP") || typeStr.equals("DATE") || typeStr.equals("TIME") || typeStr.equals("DATETIME")) { type = LegacySQLTypeName.TIMESTAMP; } else if (typeStr.equals("RECORD")) { type = LegacySQLTypeName.RECORD; } return Field.newBuilder(nameStr, type).setMode(Field.Mode.valueOf(modeStr)).build(); }
Example 2
Source File: PubsubMessageToObjectNode.java From gcp-ingestion with Mozilla Public License 2.0 | 5 votes |
/** * Return true if this field is a repeated struct of key and maybe value, indicating a JSON map. */ private static boolean isMapType(Field field) { return field.getType() == LegacySQLTypeName.RECORD && field.getMode() == Field.Mode.REPEATED && ((field.getSubFields().size() == 2 // && field.getSubFields().get(0).getName().equals("key") // && field.getSubFields().get(1).getName().equals("value")) || (field.getSubFields().size() == 1 && field.getSubFields().get(0).getName().equals("key"))); }
Example 3
Source File: PubsubMessageToObjectNode.java From gcp-ingestion with Mozilla Public License 2.0 | 5 votes |
/** * Return true if this field is a nested list. */ private static boolean isNestedListType(Field field, JsonNode value) { return field.getType() == LegacySQLTypeName.RECORD && field.getMode() == Field.Mode.REPEATED && field.getSubFields().size() == 1 // && field.getSubFields().get(0).getName().equals("list") // && field.getSubFields().get(0).getMode() == Field.Mode.REPEATED // && value.isArray(); }