예제 #1
0
 private void normalizeSorts(SchemaContext pc) {
   if (!EngineConstant.ORDERBY.has(this) && !EngineConstant.GROUPBY.has(this)) return;
   Map<RewriteKey, ExpressionNode> projMap = ExpressionUtils.buildRewriteMap(getProjection());
   if (EngineConstant.ORDERBY.has(this))
     normalizeSorts(pc, projMap, EngineConstant.ORDERBY.getEdge(this));
   if (EngineConstant.GROUPBY.has(this))
     normalizeSorts(pc, projMap, EngineConstant.GROUPBY.getEdge(this));
 }
예제 #2
0
 @Override
 public void normalize(SchemaContext pc) {
   // we've already resolved everything.  now we:
   // [1] expand all wildcards and table wildcards (except for count(*))
   //     this is easy for the projection - walk down the list and look for naked wildcards or
   //     table wildcards
   List<ExpressionNode> proj = getProjection();
   proj = expandWildcards(pc, proj);
   if (projectionMetadata == null || projectionMetadata.getWidth() != proj.size())
     projectionMetadata = buildProjectionMetadata(pc, proj);
   // [2] assign aliases for everything that does not already use an alias
   //     for the projection, this is easy - just walk down the list and anything that is
   //     not a DerivedColumn must need an alias
   proj = assignProjectionAliases(pc, proj, getAliases());
   setProjection(proj);
   // for order by, group by, etc. now that the projection aliases are set, use them in any clauses
   normalizeSorts(pc);
 }