@Override protected List<Partition> getJdoResult( GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException { // If we have some sort of expression tree, try JDOQL filter pushdown. List<Partition> result = null; if (exprTree != null) { result = getPartitionsViaOrmFilter(ctx.getTable(), exprTree, maxParts, false); } if (result == null) { // We couldn't do JDOQL filter pushdown. Get names via normal means. List<String> partNames = new ArrayList<>(); hasUnknownPartitions.set(getPartitionNamesPrunedByExprNoTxn( ctx.getTable(), expr, defaultPartitionName, maxParts, partNames)); result = getPartitionsViaOrmFilter(catName, dbName, tblName, partNames); } return result; } }.run(true));
@Override protected Integer getJdoResult( GetHelper<Integer> ctx) throws MetaException, NoSuchObjectException { Integer numPartitions = null; if (exprTree != null) { try { numPartitions = getNumPartitionsViaOrmFilter(ctx.getTable(), exprTree, true); } catch (MetaException e) { numPartitions = null; } } // if numPartitions could not be obtained from ORM filters, then get number partitions names, and count them if (numPartitions == null) { List<String> filteredPartNames = new ArrayList<>(); getPartitionNamesPrunedByExprNoTxn(ctx.getTable(), tempExpr, "", (short) -1, filteredPartNames); numPartitions = filteredPartNames.size(); } return numPartitions; } }.run(true);
@Override protected List<Partition> getSqlResult(GetHelper<List<Partition>> ctx) throws MetaException { // If we have some sort of expression tree, try SQL filter pushdown. List<Partition> result = null; if (exprTree != null) { SqlFilterForPushdown filter = new SqlFilterForPushdown(); if (directSql.generateSqlFilterForPushdown(ctx.getTable(), exprTree, defaultPartitionName, filter)) { return directSql.getPartitionsViaSqlFilter(filter, null); } } // We couldn't do SQL filter pushdown. Get names via normal means. List<String> partNames = new LinkedList<>(); hasUnknownPartitions.set(getPartitionNamesPrunedByExprNoTxn( ctx.getTable(), expr, defaultPartitionName, maxParts, partNames)); return directSql.getPartitionsViaSqlFilter(catName, dbName, tblName, partNames); }
@Override protected List<Partition> getJdoResult( GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException { // If we have some sort of expression tree, try JDOQL filter pushdown. List<Partition> result = null; if (exprTree != null) { result = getPartitionsViaOrmFilter(ctx.getTable(), exprTree, maxParts, false); } if (result == null) { // We couldn't do JDOQL filter pushdown. Get names via normal means. List<String> partNames = new ArrayList<String>(); hasUnknownPartitions.set(getPartitionNamesPrunedByExprNoTxn( ctx.getTable(), expr, defaultPartitionName, maxParts, partNames)); result = getPartitionsViaOrmFilter(dbName, tblName, partNames); } return result; } }.run(true));
@Override protected boolean canUseDirectSql(GetHelper<List<Partition>> ctx) throws MetaException { return directSql.generateSqlFilterForPushdown(ctx.getTable(), tree, filter); }
@Override protected boolean canUseDirectSql(GetHelper<Integer> ctx) throws MetaException { return directSql.generateSqlFilterForPushdown(ctx.getTable(), exprTree, filter); }
@Override protected boolean canUseDirectSql(GetHelper<Integer> ctx) throws MetaException { return directSql.generateSqlFilterForPushdown(ctx.getTable(), exprTree, filter); }
@Override protected List<Partition> getJdoResult( GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException { return getPartitionsViaOrmFilter(ctx.getTable(), tree, maxParts, true); } }.run(true);
@Override protected Integer getJdoResult( GetHelper<Integer> ctx) throws MetaException, NoSuchObjectException { return getNumPartitionsViaOrmFilter(ctx.getTable(), exprTree, true); } }.run(true);
@Override protected List<Partition> getJdoResult( GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException { return getPartitionsViaOrmFilter(ctx.getTable(), tree, maxParts, true); } }.run(true);
@Override protected List<Partition> getSqlResult(GetHelper<List<Partition>> ctx) throws MetaException { List<Partition> parts = directSql.getPartitionsViaSqlFilter( ctx.getTable(), tree, (maxParts < 0) ? null : (int)maxParts); if (parts == null) { // Cannot push down SQL filter. The message has been logged internally. // This is not an error so don't roll back, just go to JDO. ctx.disableDirectSql(); } return parts; } @Override
@Override protected List<Partition> getSqlResult(GetHelper<List<Partition>> ctx) throws MetaException { List<Partition> parts = directSql.getPartitionsViaSqlFilter( ctx.getTable(), tree, (maxParts < 0) ? null : (int)maxParts); if (parts == null) { // Cannot push down SQL filter. The message has been logged internally. // This is not an error so don't roll back, just go to JDO. ctx.disableDirectSql(); } return parts; } @Override
@Override protected List<Partition> getJdoResult( GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException { return getPartitionsViaOrmFilter(ctx.getTable(), tree, maxParts, true); } }.run(true);
@Override protected boolean canUseDirectSql(GetHelper<List<Partition>> ctx) throws MetaException { return directSql.generateSqlFilterForPushdown(ctx.getTable(), tree, filter); }
@Override protected boolean canUseDirectSql(GetHelper<Integer> ctx) throws MetaException { return directSql.generateSqlFilterForPushdown(ctx.getTable(), exprTree, filter); }
@Override protected List<Partition> getJdoResult( GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException { return getPartitionsViaOrmFilter(ctx.getTable(), tree, maxParts, true); } }.run(true);
@Override protected boolean canUseDirectSql(GetHelper<List<Partition>> ctx) throws MetaException { if (filterSpec.isSetFilterMode() && filterSpec.getFilterMode().equals(PartitionFilterMode.BY_EXPR)) { // if the filter mode is BY_EXPR initialize the filter and generate the expression tree // if there are more than one filter string we AND them together initExpressionTree(); return directSql.generateSqlFilterForPushdown(ctx.getTable(), tree, filter); } // BY_VALUES and BY_NAMES are always supported return true; }
@Override protected List<Partition> getSqlResult(GetHelper<List<Partition>> ctx) throws MetaException { return directSql .getPartitionsUsingProjectionAndFilterSpec(ctx.getTable(), ctx.partitionFields, includeParamKeyPattern, excludeParamKeyPattern, filterSpec, filter); }
@Override protected boolean canUseDirectSql(GetHelper<Integer> ctx) throws MetaException { return directSql.generateSqlFilterForPushdown(ctx.getTable(), exprTree, filter); }
@Override protected Integer getJdoResult( GetHelper<Integer> ctx) throws MetaException, NoSuchObjectException { return getNumPartitionsViaOrmFilter(ctx.getTable(), exprTree, true); } }.run(true);