Examples of TableFieldSchema


Examples of com.google.api.services.bigquery.model.TableFieldSchema

  public void testSchemaForInnerClass() {
    BigQuerySchemaMarshallerTester<ClassForInnerClassTest> tester =
        new BigQuerySchemaMarshallerTester<ClassForInnerClassTest>(
            new BigQueryMarshallerByType<>(ClassForInnerClassTest.class));

    tester.testSchema(new TableSchema().setFields(Lists.newArrayList(new TableFieldSchema()
        .setName("id").setType("integer").setMode(BigQueryFieldMode.REQUIRED.getValue()),
        new TableFieldSchema().setName("name").setType("string"))));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

        ClassExtendingAbstract>(
        new BigQueryMarshallerByType<ClassExtendingAbstract>(ClassExtendingAbstract.class));
    tester.testGeneratedJson("{\"id\":5,\"name\":\"nameField\",\"value\":6}",
        new ClassExtendingAbstract(5, "nameField", 6));

    tester.testSchema(new TableSchema().setFields(Lists.newArrayList(new TableFieldSchema()
        .setName("id").setType("integer").setMode(BigQueryFieldMode.REQUIRED.getValue()),
        new TableFieldSchema().setName("name").setType("string"), new TableFieldSchema()
            .setName("value").setType("integer").setMode(BigQueryFieldMode.REQUIRED.getValue()))));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

            ClassWithUnsupportedType>(ClassWithUnsupportedType.class, marshallers));
    tester.testGeneratedJson("{\"ip\":\"00000001-0002-0003-0004-000000000005\",\"id\":5}",
        new ClassWithUnsupportedType(UUID.fromString("1-2-3-4-5"), 5));

    tester.testSchema(new TableSchema().setFields(Lists.newArrayList(
        new TableFieldSchema().setName("ip").setType("string"), new TableFieldSchema().setName("id")
            .setType("integer").setMode(BigQueryFieldMode.REQUIRED.getValue()))));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(1406054209);
    tester.testGeneratedJson("{\"id\":1,\"date\":1406054.209,\"cal\":1406054.209}",
        new ClassWithDate(1, new Date(1406054209), cal));

    tester.testSchema(new TableSchema().setFields(Lists.newArrayList(new TableFieldSchema()
        .setName("id").setMode(BigQueryFieldMode.REQUIRED.getValue()).setType("integer"),
        new TableFieldSchema().setName("date").setType("timestamp"),
        new TableFieldSchema().setName("cal").setType("timestamp"))));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

    cal.setTimeInMillis(1406054209);
    tester.testGeneratedJson(
        "{\"bigInt\":342438484894389432894389432894289489234,\"bigDec\":2385923859023849203489023849023841241234.12398}", new ClassWithBigNumbers(new BigInteger("342438484894389432894389432894289489234"), new BigDecimal("2385923859023849203489023849023841241234.12398")));

    tester.testSchema(new TableSchema().setFields(Lists.newArrayList(
        new TableFieldSchema().setName("bigInt").setType("string"),
        new TableFieldSchema().setName("bigDec").setType("string"))));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

        List<TableFieldSchema> subfields = null;
        if (fieldType.equals("record")) {
          subfields = exporter.getFieldFields(i);
        }
       
        TableFieldSchema tfs = new TableFieldSchema();
        tfs.setName(fieldName);
        tfs.setType(fieldType);
        tfs.setMode(fieldMode);
       
        if (subfields != null) {
          tfs.setFields(subfields);
        }
        schema.getFields().add(tfs);
      }
    }
    return schema;
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

    }
    return toRet;
  }

  private TableFieldSchema getFieldSchema(Field field, Class<?> type) {
    TableFieldSchema toReturn = parseFieldAnnotations(field);
    if (isSimpleBigQueryType(type)) {
      return toReturn.setType(getBigQueryType(type));
    }
    toReturn.setType(BigQueryConstants.RECORD_TYPE);
    return toReturn.setFields(getSchema(type));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

   * Generates {@link TableFieldSchema} for fields which are of repeated type like collection or
   * array. It recursively generates schema for the parameter type of the collection or array.
   */
  private TableFieldSchema getSchemaOfRepeatedFields(Field field) {
    Class<?> parameterType = BigQueryFieldUtil.getParameterTypeOfRepeatedField(field);
    TableFieldSchema tf = parseFieldAnnotations(field);
    tf.setMode(BigQueryFieldMode.REPEATED.getValue());
    if (BigqueryFieldMarshallers.getMarshaller(parameterType) != null) {
      return tf.setType(BigQueryDataTypeUtil.getBigQueryType(
          BigqueryFieldMarshallers.getMarshaller(parameterType).getSchemaType()));
    }
    tf.setType(BigQueryConstants.RECORD_TYPE);
    return tf.setFields(getSchema(parameterType));
  }
View Full Code Here

Examples of com.google.api.services.bigquery.model.TableFieldSchema

  /**
   * Parses the annotations on field and returns a populated {@link TableFieldSchema}.
   */
  private TableFieldSchema parseFieldAnnotations(Field field) {
    TableFieldSchema tf = new TableFieldSchema();
    String name = getFieldName(field);
    String desc = getFieldDescription(field);
    String fieldMode = getFieldMode(field);

    return tf.setName(name).setDescription(desc).setMode(fieldMode);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.