View Javadoc

1   /*
2    * Copyright (c) 2011.  The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package org.apache.expreval.expr.literal;
22  
23  import org.apache.expreval.client.InternalErrorException;
24  import org.apache.expreval.expr.MultipleExpressionContext;
25  import org.apache.expreval.expr.node.GenericValue;
26  import org.apache.hadoop.hbase.client.Result;
27  import org.apache.hadoop.hbase.filter.Filter;
28  import org.apache.hadoop.hbase.hbql.client.HBqlException;
29  import org.apache.hadoop.hbase.hbql.impl.AggregateValue;
30  import org.apache.hadoop.hbase.hbql.impl.HConnectionImpl;
31  import org.apache.hadoop.hbase.hbql.impl.InvalidServerFilterException;
32  
33  public class DefaultKeyword implements GenericValue {
34  
35      public void setExpressionContext(final MultipleExpressionContext context) {
36  
37      }
38  
39      public Object getValue(final HConnectionImpl conn, final Object object) {
40          return null;
41      }
42  
43      public GenericValue getOptimizedValue() {
44          return null;
45      }
46  
47      public Class<? extends GenericValue> validateTypes(final GenericValue parentExpr,
48                                                         final boolean allowCollections) {
49          return DefaultKeyword.class;
50      }
51  
52      public boolean isAConstant() {
53          return true;
54      }
55  
56      public boolean isDefaultKeyword() {
57          return true;
58      }
59  
60      public boolean isAnAggregateValue() {
61          return false;
62      }
63  
64      public void initAggregateValue(final AggregateValue aggregateValue) throws HBqlException {
65          throw new InternalErrorException("Not applicable");
66      }
67  
68      public void applyResultToAggregateValue(final AggregateValue aggregateValue,
69                                              final Result result) throws HBqlException {
70          throw new InternalErrorException("Not applicable");
71      }
72  
73      public boolean hasAColumnReference() {
74          return false;
75      }
76  
77      public boolean isAColumnReference() {
78          return false;
79      }
80  
81      public String asString() {
82          return "DEFAULT";
83      }
84  
85      public void reset() {
86  
87      }
88  
89      public Filter getFilter() throws HBqlException {
90          throw new InvalidServerFilterException();
91      }
92  }