com.facebook.presto.spi.type.TypeSignature Java Examples

The following examples show how to use com.facebook.presto.spi.type.TypeSignature. 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: HivePartition.java    From airpal with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public HivePartition(@JsonProperty("name") String name,
                     @JsonProperty("type") String type,
                     @JsonProperty("values") List<Object> values) {
    super(name, type, new ClientTypeSignature(TypeSignature.parseTypeSignature(type)));
    this.values = values;
}
 
Example #2
Source File: HiveColumn.java    From airpal with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public HiveColumn(@JsonProperty("name") String name,
                  @JsonProperty("type") String type,
                  @JsonProperty("isPartition") boolean isPartition,
                  @JsonProperty("isNullable") boolean isNullable) {
    super(name, type, new ClientTypeSignature(TypeSignature.parseTypeSignature(type)));
    this.isPartition = isPartition;
    this.isNullable = isNullable;
}
 
Example #3
Source File: ColumnCache.java    From airpal with Apache License 2.0 5 votes vote down vote up
private List<HiveColumn> queryColumns(String query)
{
    final ImmutableList.Builder<HiveColumn> cache = ImmutableList.builder();
    QueryRunner queryRunner = queryRunnerFactory.create();
    QueryClient queryClient = new QueryClient(queryRunner, io.dropwizard.util.Duration.seconds(60), query);

    try {
        queryClient.executeWith(new Function<StatementClient, Void>() {
            @Nullable
            @Override
            public Void apply(StatementClient client)
            {
                QueryResults results = client.current();
                if (results.getData() != null) {
                    for (List<Object> row : results.getData()) {
                        Column column = new Column((String) row.get(0), (String) row.get(1), new ClientTypeSignature(TypeSignature.parseTypeSignature((String)row.get(1))));
                        boolean isNullable = (Boolean) row.get(2);
                        boolean isPartition = (Boolean) row.get(3);

                        cache.add(HiveColumn.fromColumn(column, isNullable, isPartition));
                    }
                }

                return null;
            }
        });
    }
    catch (QueryClient.QueryTimeOutException e) {
        log.error("Caught timeout loading columns", e);
    }

    return cache.build();
}
 
Example #4
Source File: UnknownType.java    From paraflow with Apache License 2.0 4 votes vote down vote up
private UnknownType()
{
    super(new TypeSignature(NAME), void.class, 0);
}
 
Example #5
Source File: BloomFilterType.java    From presto-bloomfilter with Apache License 2.0 4 votes vote down vote up
@JsonCreator
public BloomFilterType()
{
    super(new TypeSignature(BloomFilterType.TYPE), Slice.class);
}