Search in sources :

Example 1 with PartitionParamParserEval

use of com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval in project metacat by Netflix.

the class HiveConnectorFastPartitionService method getDateCreatedSqlCriteria.

private String getDateCreatedSqlCriteria(final String filterExpression) {
    final StringBuilder result = new StringBuilder();
    Collection<String> values = Lists.newArrayList();
    if (!Strings.isNullOrEmpty(filterExpression)) {
        try {
            values = (Collection<String>) new PartitionParser(new StringReader(filterExpression)).filter().jjtAccept(new PartitionParamParserEval(), null);
        } catch (Throwable ignored) {
        //
        }
    }
    for (String value : values) {
        if (result.length() != 0) {
            result.append(" and ");
        }
        result.append(value.replace("dateCreated", "p.CREATE_TIME"));
    }
    return result.toString();
}
Also used : PartitionParser(com.netflix.metacat.common.server.partition.parser.PartitionParser) PartitionParamParserEval(com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval) StringReader(java.io.StringReader)

Example 2 with PartitionParamParserEval

use of com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval in project metacat by Netflix.

the class DirectSqlGetPartition method getDateCreatedSqlCriteria.

private String getDateCreatedSqlCriteria(final String filterExpression) {
    final StringBuilder result = new StringBuilder();
    Collection<String> values = Lists.newArrayList();
    if (!Strings.isNullOrEmpty(filterExpression)) {
        try {
            values = (Collection<String>) new PartitionParser(new StringReader(filterExpression)).filter().jjtAccept(new PartitionParamParserEval(), null);
        } catch (Throwable ignored) {
        // 
        }
    }
    for (String value : values) {
        if (result.length() != 0) {
            result.append(" and ");
        }
        result.append(value.replace("dateCreated", "p.CREATE_TIME"));
    }
    return result.toString();
}
Also used : PartitionParser(com.netflix.metacat.common.server.partition.parser.PartitionParser) PartitionParamParserEval(com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval) StringReader(java.io.StringReader)

Example 3 with PartitionParamParserEval

use of com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval in project metacat by Netflix.

the class S3ConnectorPartitionService method getDateCreatedSqlCriteria.

private String getDateCreatedSqlCriteria(final String filterExpression) {
    final StringBuilder result = new StringBuilder();
    Collection<String> values = com.google.common.collect.Lists.newArrayList();
    if (!Strings.isNullOrEmpty(filterExpression)) {
        try {
            values = (Collection<String>) new PartitionParser(new StringReader(filterExpression)).filter().jjtAccept(new PartitionParamParserEval(), null);
        } catch (Throwable ignored) {
        // 
        }
    }
    for (String value : values) {
        if (result.length() != 0) {
            result.append(" and ");
        }
        result.append(value.replace("dateCreated", "to_seconds(p.date_created)"));
    }
    return result.toString();
}
Also used : PartitionParser(com.netflix.metacat.common.server.partition.parser.PartitionParser) PartitionParamParserEval(com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval) StringReader(java.io.StringReader)

Aggregations

PartitionParser (com.netflix.metacat.common.server.partition.parser.PartitionParser)3 PartitionParamParserEval (com.netflix.metacat.common.server.partition.visitor.PartitionParamParserEval)3 StringReader (java.io.StringReader)3