carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [2/4] carbondata git commit: [CARBONDATA-2690][CarbonStore] implement RESTful API: create table, load data and select
Date Fri, 06 Jul 2018 07:35:19 GMT
http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.java
new file mode 100644
index 0000000..e32ff07
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.java
@@ -0,0 +1,228 @@
+// Generated from /home/david/Documents/code/carbondata/store/horizon/src/main/anltr/Expression.g4 by ANTLR 4.7
+package org.apache.carbondata.horizon.antlr.gen;
+import org.antlr.v4.runtime.Lexer;
+import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.misc.*;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
+public class ExpressionLexer extends Lexer {
+	static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }
+
+	protected static final DFA[] _decisionToDFA;
+	protected static final PredictionContextCache _sharedContextCache =
+		new PredictionContextCache();
+	public static final int
+		T__0=1, T__1=2, T__2=3, T__3=4, AND=5, BETWEEN=6, FALSE=7, IN=8, IS=9, 
+		NOT=10, NULL=11, OR=12, TRUE=13, EQ=14, NEQ=15, LT=16, LTE=17, GT=18, 
+		GTE=19, MINUS=20, STRING=21, BIGINT_LITERAL=22, SMALLINT_LITERAL=23, TINYINT_LITERAL=24, 
+		INTEGER_VALUE=25, DECIMAL_VALUE=26, DOUBLE_LITERAL=27, BIGDECIMAL_LITERAL=28, 
+		IDENTIFIER=29, BACKQUOTED_IDENTIFIER=30, WS=31, UNRECOGNIZED=32;
+	public static String[] channelNames = {
+		"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
+	};
+
+	public static String[] modeNames = {
+		"DEFAULT_MODE"
+	};
+
+	public static final String[] ruleNames = {
+		"T__0", "T__1", "T__2", "T__3", "AND", "BETWEEN", "FALSE", "IN", "IS", 
+		"NOT", "NULL", "OR", "TRUE", "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "MINUS", 
+		"STRING", "BIGINT_LITERAL", "SMALLINT_LITERAL", "TINYINT_LITERAL", "INTEGER_VALUE", 
+		"DECIMAL_VALUE", "DOUBLE_LITERAL", "BIGDECIMAL_LITERAL", "IDENTIFIER", 
+		"BACKQUOTED_IDENTIFIER", "DECIMAL_DIGITS", "EXPONENT", "DIGIT", "LETTER", 
+		"WS", "UNRECOGNIZED"
+	};
+
+	private static final String[] _LITERAL_NAMES = {
+		null, "'('", "')'", "','", "'.'", "'AND'", "'BETWEEN'", "'FALSE'", "'IN'", 
+		"'IS'", "'NOT'", "'NULL'", "'OR'", "'TRUE'", "'='", null, "'<'", "'<='", 
+		"'>'", "'>='", "'-'"
+	};
+	private static final String[] _SYMBOLIC_NAMES = {
+		null, null, null, null, null, "AND", "BETWEEN", "FALSE", "IN", "IS", "NOT", 
+		"NULL", "OR", "TRUE", "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "MINUS", 
+		"STRING", "BIGINT_LITERAL", "SMALLINT_LITERAL", "TINYINT_LITERAL", "INTEGER_VALUE", 
+		"DECIMAL_VALUE", "DOUBLE_LITERAL", "BIGDECIMAL_LITERAL", "IDENTIFIER", 
+		"BACKQUOTED_IDENTIFIER", "WS", "UNRECOGNIZED"
+	};
+	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+	/**
+	 * @deprecated Use {@link #VOCABULARY} instead.
+	 */
+	@Deprecated
+	public static final String[] tokenNames;
+	static {
+		tokenNames = new String[_SYMBOLIC_NAMES.length];
+		for (int i = 0; i < tokenNames.length; i++) {
+			tokenNames[i] = VOCABULARY.getLiteralName(i);
+			if (tokenNames[i] == null) {
+				tokenNames[i] = VOCABULARY.getSymbolicName(i);
+			}
+
+			if (tokenNames[i] == null) {
+				tokenNames[i] = "<INVALID>";
+			}
+		}
+	}
+
+	@Override
+	@Deprecated
+	public String[] getTokenNames() {
+		return tokenNames;
+	}
+
+	@Override
+
+	public Vocabulary getVocabulary() {
+		return VOCABULARY;
+	}
+
+
+	public ExpressionLexer(CharStream input) {
+		super(input);
+		_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+	}
+
+	@Override
+	public String getGrammarFileName() { return "Expression.g4"; }
+
+	@Override
+	public String[] getRuleNames() { return ruleNames; }
+
+	@Override
+	public String getSerializedATN() { return _serializedATN; }
+
+	@Override
+	public String[] getChannelNames() { return channelNames; }
+
+	@Override
+	public String[] getModeNames() { return modeNames; }
+
+	@Override
+	public ATN getATN() { return _ATN; }
+
+	public static final String _serializedATN =
+		"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\"\u012f\b\1\4\2\t"+
+		"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
+		"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
+		"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
+		"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
+		"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6"+
+		"\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3"+
+		"\t\3\t\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r"+
+		"\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\20\5\20\u0083\n\20"+
+		"\3\21\3\21\3\22\3\22\3\22\3\23\3\23\3\24\3\24\3\24\3\25\3\25\3\26\3\26"+
+		"\3\26\3\26\7\26\u0095\n\26\f\26\16\26\u0098\13\26\3\26\3\26\3\26\3\26"+
+		"\3\26\7\26\u009f\n\26\f\26\16\26\u00a2\13\26\3\26\5\26\u00a5\n\26\3\27"+
+		"\6\27\u00a8\n\27\r\27\16\27\u00a9\3\27\3\27\3\30\6\30\u00af\n\30\r\30"+
+		"\16\30\u00b0\3\30\3\30\3\31\6\31\u00b6\n\31\r\31\16\31\u00b7\3\31\3\31"+
+		"\3\32\6\32\u00bd\n\32\r\32\16\32\u00be\3\33\6\33\u00c2\n\33\r\33\16\33"+
+		"\u00c3\3\33\3\33\3\33\3\33\5\33\u00ca\n\33\5\33\u00cc\n\33\3\34\6\34\u00cf"+
+		"\n\34\r\34\16\34\u00d0\3\34\5\34\u00d4\n\34\3\34\3\34\3\34\3\34\5\34\u00da"+
+		"\n\34\3\34\3\34\5\34\u00de\n\34\3\35\6\35\u00e1\n\35\r\35\16\35\u00e2"+
+		"\3\35\5\35\u00e6\n\35\3\35\3\35\3\35\3\35\3\35\5\35\u00ed\n\35\3\35\3"+
+		"\35\3\35\5\35\u00f2\n\35\3\36\3\36\3\36\6\36\u00f7\n\36\r\36\16\36\u00f8"+
+		"\3\37\3\37\3\37\3\37\7\37\u00ff\n\37\f\37\16\37\u0102\13\37\3\37\3\37"+
+		"\3 \6 \u0107\n \r \16 \u0108\3 \3 \7 \u010d\n \f \16 \u0110\13 \3 \3 "+
+		"\6 \u0114\n \r \16 \u0115\5 \u0118\n \3!\3!\5!\u011c\n!\3!\6!\u011f\n"+
+		"!\r!\16!\u0120\3\"\3\"\3#\3#\3$\6$\u0128\n$\r$\16$\u0129\3$\3$\3%\3%\2"+
+		"\2&\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35"+
+		"\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36"+
+		";\37= ?\2A\2C\2E\2G!I\"\3\2\t\4\2))^^\4\2$$^^\3\2bb\4\2--//\3\2\62;\3"+
+		"\2C\\\5\2\13\f\17\17\"\"\2\u014b\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2"+
+		"\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2"+
+		"\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2"+
+		"\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2"+
+		"\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2"+
+		"\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2"+
+		"\3K\3\2\2\2\5M\3\2\2\2\7O\3\2\2\2\tQ\3\2\2\2\13S\3\2\2\2\rW\3\2\2\2\17"+
+		"_\3\2\2\2\21e\3\2\2\2\23h\3\2\2\2\25k\3\2\2\2\27o\3\2\2\2\31t\3\2\2\2"+
+		"\33w\3\2\2\2\35|\3\2\2\2\37\u0082\3\2\2\2!\u0084\3\2\2\2#\u0086\3\2\2"+
+		"\2%\u0089\3\2\2\2\'\u008b\3\2\2\2)\u008e\3\2\2\2+\u00a4\3\2\2\2-\u00a7"+
+		"\3\2\2\2/\u00ae\3\2\2\2\61\u00b5\3\2\2\2\63\u00bc\3\2\2\2\65\u00cb\3\2"+
+		"\2\2\67\u00dd\3\2\2\29\u00f1\3\2\2\2;\u00f6\3\2\2\2=\u00fa\3\2\2\2?\u0117"+
+		"\3\2\2\2A\u0119\3\2\2\2C\u0122\3\2\2\2E\u0124\3\2\2\2G\u0127\3\2\2\2I"+
+		"\u012d\3\2\2\2KL\7*\2\2L\4\3\2\2\2MN\7+\2\2N\6\3\2\2\2OP\7.\2\2P\b\3\2"+
+		"\2\2QR\7\60\2\2R\n\3\2\2\2ST\7C\2\2TU\7P\2\2UV\7F\2\2V\f\3\2\2\2WX\7D"+
+		"\2\2XY\7G\2\2YZ\7V\2\2Z[\7Y\2\2[\\\7G\2\2\\]\7G\2\2]^\7P\2\2^\16\3\2\2"+
+		"\2_`\7H\2\2`a\7C\2\2ab\7N\2\2bc\7U\2\2cd\7G\2\2d\20\3\2\2\2ef\7K\2\2f"+
+		"g\7P\2\2g\22\3\2\2\2hi\7K\2\2ij\7U\2\2j\24\3\2\2\2kl\7P\2\2lm\7Q\2\2m"+
+		"n\7V\2\2n\26\3\2\2\2op\7P\2\2pq\7W\2\2qr\7N\2\2rs\7N\2\2s\30\3\2\2\2t"+
+		"u\7Q\2\2uv\7T\2\2v\32\3\2\2\2wx\7V\2\2xy\7T\2\2yz\7W\2\2z{\7G\2\2{\34"+
+		"\3\2\2\2|}\7?\2\2}\36\3\2\2\2~\177\7>\2\2\177\u0083\7@\2\2\u0080\u0081"+
+		"\7#\2\2\u0081\u0083\7?\2\2\u0082~\3\2\2\2\u0082\u0080\3\2\2\2\u0083 \3"+
+		"\2\2\2\u0084\u0085\7>\2\2\u0085\"\3\2\2\2\u0086\u0087\7>\2\2\u0087\u0088"+
+		"\7?\2\2\u0088$\3\2\2\2\u0089\u008a\7@\2\2\u008a&\3\2\2\2\u008b\u008c\7"+
+		"@\2\2\u008c\u008d\7?\2\2\u008d(\3\2\2\2\u008e\u008f\7/\2\2\u008f*\3\2"+
+		"\2\2\u0090\u0096\7)\2\2\u0091\u0095\n\2\2\2\u0092\u0093\7^\2\2\u0093\u0095"+
+		"\13\2\2\2\u0094\u0091\3\2\2\2\u0094\u0092\3\2\2\2\u0095\u0098\3\2\2\2"+
+		"\u0096\u0094\3\2\2\2\u0096\u0097\3\2\2\2\u0097\u0099\3\2\2\2\u0098\u0096"+
+		"\3\2\2\2\u0099\u00a5\7)\2\2\u009a\u00a0\7$\2\2\u009b\u009f\n\3\2\2\u009c"+
+		"\u009d\7^\2\2\u009d\u009f\13\2\2\2\u009e\u009b\3\2\2\2\u009e\u009c\3\2"+
+		"\2\2\u009f\u00a2\3\2\2\2\u00a0\u009e\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1"+
+		"\u00a3\3\2\2\2\u00a2\u00a0\3\2\2\2\u00a3\u00a5\7$\2\2\u00a4\u0090\3\2"+
+		"\2\2\u00a4\u009a\3\2\2\2\u00a5,\3\2\2\2\u00a6\u00a8\5C\"\2\u00a7\u00a6"+
+		"\3\2\2\2\u00a8\u00a9\3\2\2\2\u00a9\u00a7\3\2\2\2\u00a9\u00aa\3\2\2\2\u00aa"+
+		"\u00ab\3\2\2\2\u00ab\u00ac\7N\2\2\u00ac.\3\2\2\2\u00ad\u00af\5C\"\2\u00ae"+
+		"\u00ad\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0\u00ae\3\2\2\2\u00b0\u00b1\3\2"+
+		"\2\2\u00b1\u00b2\3\2\2\2\u00b2\u00b3\7U\2\2\u00b3\60\3\2\2\2\u00b4\u00b6"+
+		"\5C\"\2\u00b5\u00b4\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b7"+
+		"\u00b8\3\2\2\2\u00b8\u00b9\3\2\2\2\u00b9\u00ba\7[\2\2\u00ba\62\3\2\2\2"+
+		"\u00bb\u00bd\5C\"\2\u00bc\u00bb\3\2\2\2\u00bd\u00be\3\2\2\2\u00be\u00bc"+
+		"\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf\64\3\2\2\2\u00c0\u00c2\5C\"\2\u00c1"+
+		"\u00c0\3\2\2\2\u00c2\u00c3\3\2\2\2\u00c3\u00c1\3\2\2\2\u00c3\u00c4\3\2"+
+		"\2\2\u00c4\u00c5\3\2\2\2\u00c5\u00c6\5A!\2\u00c6\u00cc\3\2\2\2\u00c7\u00c9"+
+		"\5? \2\u00c8\u00ca\5A!\2\u00c9\u00c8\3\2\2\2\u00c9\u00ca\3\2\2\2\u00ca"+
+		"\u00cc\3\2\2\2\u00cb\u00c1\3\2\2\2\u00cb\u00c7\3\2\2\2\u00cc\66\3\2\2"+
+		"\2\u00cd\u00cf\5C\"\2\u00ce\u00cd\3\2\2\2\u00cf\u00d0\3\2\2\2\u00d0\u00ce"+
+		"\3\2\2\2\u00d0\u00d1\3\2\2\2\u00d1\u00d3\3\2\2\2\u00d2\u00d4\5A!\2\u00d3"+
+		"\u00d2\3\2\2\2\u00d3\u00d4\3\2\2\2\u00d4\u00d5\3\2\2\2\u00d5\u00d6\7F"+
+		"\2\2\u00d6\u00de\3\2\2\2\u00d7\u00d9\5? \2\u00d8\u00da\5A!\2\u00d9\u00d8"+
+		"\3\2\2\2\u00d9\u00da\3\2\2\2\u00da\u00db\3\2\2\2\u00db\u00dc\7F\2\2\u00dc"+
+		"\u00de\3\2\2\2\u00dd\u00ce\3\2\2\2\u00dd\u00d7\3\2\2\2\u00de8\3\2\2\2"+
+		"\u00df\u00e1\5C\"\2\u00e0\u00df\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e2\u00e0"+
+		"\3\2\2\2\u00e2\u00e3\3\2\2\2\u00e3\u00e5\3\2\2\2\u00e4\u00e6\5A!\2\u00e5"+
+		"\u00e4\3\2\2\2\u00e5\u00e6\3\2\2\2\u00e6\u00e7\3\2\2\2\u00e7\u00e8\7D"+
+		"\2\2\u00e8\u00e9\7F\2\2\u00e9\u00f2\3\2\2\2\u00ea\u00ec\5? \2\u00eb\u00ed"+
+		"\5A!\2\u00ec\u00eb\3\2\2\2\u00ec\u00ed\3\2\2\2\u00ed\u00ee\3\2\2\2\u00ee"+
+		"\u00ef\7D\2\2\u00ef\u00f0\7F\2\2\u00f0\u00f2\3\2\2\2\u00f1\u00e0\3\2\2"+
+		"\2\u00f1\u00ea\3\2\2\2\u00f2:\3\2\2\2\u00f3\u00f7\5E#\2\u00f4\u00f7\5"+
+		"C\"\2\u00f5\u00f7\7a\2\2\u00f6\u00f3\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f6"+
+		"\u00f5\3\2\2\2\u00f7\u00f8\3\2\2\2\u00f8\u00f6\3\2\2\2\u00f8\u00f9\3\2"+
+		"\2\2\u00f9<\3\2\2\2\u00fa\u0100\7b\2\2\u00fb\u00ff\n\4\2\2\u00fc\u00fd"+
+		"\7b\2\2\u00fd\u00ff\7b\2\2\u00fe\u00fb\3\2\2\2\u00fe\u00fc\3\2\2\2\u00ff"+
+		"\u0102\3\2\2\2\u0100\u00fe\3\2\2\2\u0100\u0101\3\2\2\2\u0101\u0103\3\2"+
+		"\2\2\u0102\u0100\3\2\2\2\u0103\u0104\7b\2\2\u0104>\3\2\2\2\u0105\u0107"+
+		"\5C\"\2\u0106\u0105\3\2\2\2\u0107\u0108\3\2\2\2\u0108\u0106\3\2\2\2\u0108"+
+		"\u0109\3\2\2\2\u0109\u010a\3\2\2\2\u010a\u010e\7\60\2\2\u010b\u010d\5"+
+		"C\"\2\u010c\u010b\3\2\2\2\u010d\u0110\3\2\2\2\u010e\u010c\3\2\2\2\u010e"+
+		"\u010f\3\2\2\2\u010f\u0118\3\2\2\2\u0110\u010e\3\2\2\2\u0111\u0113\7\60"+
+		"\2\2\u0112\u0114\5C\"\2\u0113\u0112\3\2\2\2\u0114\u0115\3\2\2\2\u0115"+
+		"\u0113\3\2\2\2\u0115\u0116\3\2\2\2\u0116\u0118\3\2\2\2\u0117\u0106\3\2"+
+		"\2\2\u0117\u0111\3\2\2\2\u0118@\3\2\2\2\u0119\u011b\7G\2\2\u011a\u011c"+
+		"\t\5\2\2\u011b\u011a\3\2\2\2\u011b\u011c\3\2\2\2\u011c\u011e\3\2\2\2\u011d"+
+		"\u011f\5C\"\2\u011e\u011d\3\2\2\2\u011f\u0120\3\2\2\2\u0120\u011e\3\2"+
+		"\2\2\u0120\u0121\3\2\2\2\u0121B\3\2\2\2\u0122\u0123\t\6\2\2\u0123D\3\2"+
+		"\2\2\u0124\u0125\t\7\2\2\u0125F\3\2\2\2\u0126\u0128\t\b\2\2\u0127\u0126"+
+		"\3\2\2\2\u0128\u0129\3\2\2\2\u0129\u0127\3\2\2\2\u0129\u012a\3\2\2\2\u012a"+
+		"\u012b\3\2\2\2\u012b\u012c\b$\2\2\u012cH\3\2\2\2\u012d\u012e\13\2\2\2"+
+		"\u012eJ\3\2\2\2#\2\u0082\u0094\u0096\u009e\u00a0\u00a4\u00a9\u00b0\u00b7"+
+		"\u00be\u00c3\u00c9\u00cb\u00d0\u00d3\u00d9\u00dd\u00e2\u00e5\u00ec\u00f1"+
+		"\u00f6\u00f8\u00fe\u0100\u0108\u010e\u0115\u0117\u011b\u0120\u0129\3\2"+
+		"\3\2";
+	public static final ATN _ATN =
+		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+	static {
+		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.tokens
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.tokens b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.tokens
new file mode 100644
index 0000000..0ba3c59
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionLexer.tokens
@@ -0,0 +1,51 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+AND=5
+BETWEEN=6
+FALSE=7
+IN=8
+IS=9
+NOT=10
+NULL=11
+OR=12
+TRUE=13
+EQ=14
+NEQ=15
+LT=16
+LTE=17
+GT=18
+GTE=19
+MINUS=20
+STRING=21
+BIGINT_LITERAL=22
+SMALLINT_LITERAL=23
+TINYINT_LITERAL=24
+INTEGER_VALUE=25
+DECIMAL_VALUE=26
+DOUBLE_LITERAL=27
+BIGDECIMAL_LITERAL=28
+IDENTIFIER=29
+BACKQUOTED_IDENTIFIER=30
+WS=31
+UNRECOGNIZED=32
+'('=1
+')'=2
+','=3
+'.'=4
+'AND'=5
+'BETWEEN'=6
+'FALSE'=7
+'IN'=8
+'IS'=9
+'NOT'=10
+'NULL'=11
+'OR'=12
+'TRUE'=13
+'='=14
+'<'=16
+'<='=17
+'>'=18
+'>='=19
+'-'=20

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionParser.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionParser.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionParser.java
new file mode 100644
index 0000000..08139eb
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionParser.java
@@ -0,0 +1,1117 @@
+// Generated from /home/david/Documents/code/carbondata/store/horizon/src/main/anltr/Expression.g4 by ANTLR 4.7
+package org.apache.carbondata.horizon.antlr.gen;
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.misc.*;
+import org.antlr.v4.runtime.tree.*;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
+public class ExpressionParser extends Parser {
+	static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }
+
+	protected static final DFA[] _decisionToDFA;
+	protected static final PredictionContextCache _sharedContextCache =
+		new PredictionContextCache();
+	public static final int
+		T__0=1, T__1=2, T__2=3, T__3=4, AND=5, BETWEEN=6, FALSE=7, IN=8, IS=9, 
+		NOT=10, NULL=11, OR=12, TRUE=13, EQ=14, NEQ=15, LT=16, LTE=17, GT=18, 
+		GTE=19, MINUS=20, STRING=21, BIGINT_LITERAL=22, SMALLINT_LITERAL=23, TINYINT_LITERAL=24, 
+		INTEGER_VALUE=25, DECIMAL_VALUE=26, DOUBLE_LITERAL=27, BIGDECIMAL_LITERAL=28, 
+		IDENTIFIER=29, BACKQUOTED_IDENTIFIER=30, WS=31, UNRECOGNIZED=32;
+	public static final int
+		RULE_parseFilter = 0, RULE_booleanExpression = 1, RULE_predicate = 2, 
+		RULE_primaryExpression = 3, RULE_constant = 4, RULE_identifier = 5, RULE_comparisonOperator = 6, 
+		RULE_booleanValue = 7, RULE_number = 8;
+	public static final String[] ruleNames = {
+		"parseFilter", "booleanExpression", "predicate", "primaryExpression", 
+		"constant", "identifier", "comparisonOperator", "booleanValue", "number"
+	};
+
+	private static final String[] _LITERAL_NAMES = {
+		null, "'('", "')'", "','", "'.'", "'AND'", "'BETWEEN'", "'FALSE'", "'IN'", 
+		"'IS'", "'NOT'", "'NULL'", "'OR'", "'TRUE'", "'='", null, "'<'", "'<='", 
+		"'>'", "'>='", "'-'"
+	};
+	private static final String[] _SYMBOLIC_NAMES = {
+		null, null, null, null, null, "AND", "BETWEEN", "FALSE", "IN", "IS", "NOT", 
+		"NULL", "OR", "TRUE", "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "MINUS", 
+		"STRING", "BIGINT_LITERAL", "SMALLINT_LITERAL", "TINYINT_LITERAL", "INTEGER_VALUE", 
+		"DECIMAL_VALUE", "DOUBLE_LITERAL", "BIGDECIMAL_LITERAL", "IDENTIFIER", 
+		"BACKQUOTED_IDENTIFIER", "WS", "UNRECOGNIZED"
+	};
+	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+	/**
+	 * @deprecated Use {@link #VOCABULARY} instead.
+	 */
+	@Deprecated
+	public static final String[] tokenNames;
+	static {
+		tokenNames = new String[_SYMBOLIC_NAMES.length];
+		for (int i = 0; i < tokenNames.length; i++) {
+			tokenNames[i] = VOCABULARY.getLiteralName(i);
+			if (tokenNames[i] == null) {
+				tokenNames[i] = VOCABULARY.getSymbolicName(i);
+			}
+
+			if (tokenNames[i] == null) {
+				tokenNames[i] = "<INVALID>";
+			}
+		}
+	}
+
+	@Override
+	@Deprecated
+	public String[] getTokenNames() {
+		return tokenNames;
+	}
+
+	@Override
+
+	public Vocabulary getVocabulary() {
+		return VOCABULARY;
+	}
+
+	@Override
+	public String getGrammarFileName() { return "Expression.g4"; }
+
+	@Override
+	public String[] getRuleNames() { return ruleNames; }
+
+	@Override
+	public String getSerializedATN() { return _serializedATN; }
+
+	@Override
+	public ATN getATN() { return _ATN; }
+
+	public ExpressionParser(TokenStream input) {
+		super(input);
+		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+	}
+	public static class ParseFilterContext extends ParserRuleContext {
+		public BooleanExpressionContext booleanExpression() {
+			return getRuleContext(BooleanExpressionContext.class,0);
+		}
+		public TerminalNode EOF() { return getToken(ExpressionParser.EOF, 0); }
+		public ParseFilterContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_parseFilter; }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitParseFilter(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final ParseFilterContext parseFilter() throws RecognitionException {
+		ParseFilterContext _localctx = new ParseFilterContext(_ctx, getState());
+		enterRule(_localctx, 0, RULE_parseFilter);
+		try {
+			enterOuterAlt(_localctx, 1);
+			{
+			setState(18);
+			booleanExpression(0);
+			setState(19);
+			match(EOF);
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class BooleanExpressionContext extends ParserRuleContext {
+		public BooleanExpressionContext left;
+		public Token operator;
+		public BooleanExpressionContext right;
+		public PredicateContext predicate() {
+			return getRuleContext(PredicateContext.class,0);
+		}
+		public List<BooleanExpressionContext> booleanExpression() {
+			return getRuleContexts(BooleanExpressionContext.class);
+		}
+		public BooleanExpressionContext booleanExpression(int i) {
+			return getRuleContext(BooleanExpressionContext.class,i);
+		}
+		public TerminalNode AND() { return getToken(ExpressionParser.AND, 0); }
+		public TerminalNode OR() { return getToken(ExpressionParser.OR, 0); }
+		public BooleanExpressionContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_booleanExpression; }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitBooleanExpression(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final BooleanExpressionContext booleanExpression() throws RecognitionException {
+		return booleanExpression(0);
+	}
+
+	private BooleanExpressionContext booleanExpression(int _p) throws RecognitionException {
+		ParserRuleContext _parentctx = _ctx;
+		int _parentState = getState();
+		BooleanExpressionContext _localctx = new BooleanExpressionContext(_ctx, _parentState);
+		BooleanExpressionContext _prevctx = _localctx;
+		int _startState = 2;
+		enterRecursionRule(_localctx, 2, RULE_booleanExpression, _p);
+		try {
+			int _alt;
+			enterOuterAlt(_localctx, 1);
+			{
+			setState(27);
+			_errHandler.sync(this);
+			switch ( getInterpreter().adaptivePredict(_input,0,_ctx) ) {
+			case 1:
+				{
+				setState(22);
+				predicate();
+				}
+				break;
+			case 2:
+				{
+				setState(23);
+				match(T__0);
+				setState(24);
+				booleanExpression(0);
+				setState(25);
+				match(T__1);
+				}
+				break;
+			}
+			_ctx.stop = _input.LT(-1);
+			setState(37);
+			_errHandler.sync(this);
+			_alt = getInterpreter().adaptivePredict(_input,2,_ctx);
+			while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+				if ( _alt==1 ) {
+					if ( _parseListeners!=null ) triggerExitRuleEvent();
+					_prevctx = _localctx;
+					{
+					setState(35);
+					_errHandler.sync(this);
+					switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
+					case 1:
+						{
+						_localctx = new BooleanExpressionContext(_parentctx, _parentState);
+						_localctx.left = _prevctx;
+						_localctx.left = _prevctx;
+						pushNewRecursionContext(_localctx, _startState, RULE_booleanExpression);
+						setState(29);
+						if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
+						setState(30);
+						((BooleanExpressionContext)_localctx).operator = match(AND);
+						setState(31);
+						((BooleanExpressionContext)_localctx).right = booleanExpression(4);
+						}
+						break;
+					case 2:
+						{
+						_localctx = new BooleanExpressionContext(_parentctx, _parentState);
+						_localctx.left = _prevctx;
+						_localctx.left = _prevctx;
+						pushNewRecursionContext(_localctx, _startState, RULE_booleanExpression);
+						setState(32);
+						if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
+						setState(33);
+						((BooleanExpressionContext)_localctx).operator = match(OR);
+						setState(34);
+						((BooleanExpressionContext)_localctx).right = booleanExpression(3);
+						}
+						break;
+					}
+					} 
+				}
+				setState(39);
+				_errHandler.sync(this);
+				_alt = getInterpreter().adaptivePredict(_input,2,_ctx);
+			}
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			unrollRecursionContexts(_parentctx);
+		}
+		return _localctx;
+	}
+
+	public static class PredicateContext extends ParserRuleContext {
+		public PrimaryExpressionContext left;
+		public PrimaryExpressionContext right;
+		public PrimaryExpressionContext lower;
+		public PrimaryExpressionContext upper;
+		public ComparisonOperatorContext comparisonOperator() {
+			return getRuleContext(ComparisonOperatorContext.class,0);
+		}
+		public List<PrimaryExpressionContext> primaryExpression() {
+			return getRuleContexts(PrimaryExpressionContext.class);
+		}
+		public PrimaryExpressionContext primaryExpression(int i) {
+			return getRuleContext(PrimaryExpressionContext.class,i);
+		}
+		public TerminalNode BETWEEN() { return getToken(ExpressionParser.BETWEEN, 0); }
+		public TerminalNode AND() { return getToken(ExpressionParser.AND, 0); }
+		public TerminalNode NOT() { return getToken(ExpressionParser.NOT, 0); }
+		public TerminalNode IN() { return getToken(ExpressionParser.IN, 0); }
+		public TerminalNode IS() { return getToken(ExpressionParser.IS, 0); }
+		public TerminalNode NULL() { return getToken(ExpressionParser.NULL, 0); }
+		public PredicateContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_predicate; }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitPredicate(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final PredicateContext predicate() throws RecognitionException {
+		PredicateContext _localctx = new PredicateContext(_ctx, getState());
+		enterRule(_localctx, 4, RULE_predicate);
+		int _la;
+		try {
+			setState(76);
+			_errHandler.sync(this);
+			switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
+			case 1:
+				enterOuterAlt(_localctx, 1);
+				{
+				setState(40);
+				((PredicateContext)_localctx).left = primaryExpression();
+				setState(41);
+				comparisonOperator();
+				setState(42);
+				((PredicateContext)_localctx).right = primaryExpression();
+				}
+				break;
+			case 2:
+				enterOuterAlt(_localctx, 2);
+				{
+				setState(44);
+				((PredicateContext)_localctx).left = primaryExpression();
+				setState(46);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==NOT) {
+					{
+					setState(45);
+					match(NOT);
+					}
+				}
+
+				setState(48);
+				match(BETWEEN);
+				setState(49);
+				((PredicateContext)_localctx).lower = primaryExpression();
+				setState(50);
+				match(AND);
+				setState(51);
+				((PredicateContext)_localctx).upper = primaryExpression();
+				}
+				break;
+			case 3:
+				enterOuterAlt(_localctx, 3);
+				{
+				setState(53);
+				((PredicateContext)_localctx).left = primaryExpression();
+				setState(55);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==NOT) {
+					{
+					setState(54);
+					match(NOT);
+					}
+				}
+
+				setState(57);
+				match(IN);
+				setState(58);
+				match(T__0);
+				setState(59);
+				primaryExpression();
+				setState(64);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				while (_la==T__2) {
+					{
+					{
+					setState(60);
+					match(T__2);
+					setState(61);
+					primaryExpression();
+					}
+					}
+					setState(66);
+					_errHandler.sync(this);
+					_la = _input.LA(1);
+				}
+				setState(67);
+				match(T__1);
+				}
+				break;
+			case 4:
+				enterOuterAlt(_localctx, 4);
+				{
+				setState(69);
+				((PredicateContext)_localctx).left = primaryExpression();
+				setState(70);
+				match(IS);
+				setState(72);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==NOT) {
+					{
+					setState(71);
+					match(NOT);
+					}
+				}
+
+				setState(74);
+				match(NULL);
+				}
+				break;
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class PrimaryExpressionContext extends ParserRuleContext {
+		public PrimaryExpressionContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_primaryExpression; }
+	 
+		public PrimaryExpressionContext() { }
+		public void copyFrom(PrimaryExpressionContext ctx) {
+			super.copyFrom(ctx);
+		}
+	}
+	public static class DereferenceContext extends PrimaryExpressionContext {
+		public IdentifierContext base;
+		public IdentifierContext fieldName;
+		public List<IdentifierContext> identifier() {
+			return getRuleContexts(IdentifierContext.class);
+		}
+		public IdentifierContext identifier(int i) {
+			return getRuleContext(IdentifierContext.class,i);
+		}
+		public DereferenceContext(PrimaryExpressionContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitDereference(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class ConstantDefaultContext extends PrimaryExpressionContext {
+		public ConstantContext constant() {
+			return getRuleContext(ConstantContext.class,0);
+		}
+		public ConstantDefaultContext(PrimaryExpressionContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitConstantDefault(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class ColumnReferenceContext extends PrimaryExpressionContext {
+		public IdentifierContext identifier() {
+			return getRuleContext(IdentifierContext.class,0);
+		}
+		public ColumnReferenceContext(PrimaryExpressionContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitColumnReference(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class ParenthesizedExpressionContext extends PrimaryExpressionContext {
+		public BooleanExpressionContext booleanExpression() {
+			return getRuleContext(BooleanExpressionContext.class,0);
+		}
+		public ParenthesizedExpressionContext(PrimaryExpressionContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitParenthesizedExpression(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final PrimaryExpressionContext primaryExpression() throws RecognitionException {
+		PrimaryExpressionContext _localctx = new PrimaryExpressionContext(_ctx, getState());
+		enterRule(_localctx, 6, RULE_primaryExpression);
+		try {
+			setState(88);
+			_errHandler.sync(this);
+			switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
+			case 1:
+				_localctx = new ConstantDefaultContext(_localctx);
+				enterOuterAlt(_localctx, 1);
+				{
+				setState(78);
+				constant();
+				}
+				break;
+			case 2:
+				_localctx = new ColumnReferenceContext(_localctx);
+				enterOuterAlt(_localctx, 2);
+				{
+				setState(79);
+				identifier();
+				}
+				break;
+			case 3:
+				_localctx = new DereferenceContext(_localctx);
+				enterOuterAlt(_localctx, 3);
+				{
+				setState(80);
+				((DereferenceContext)_localctx).base = identifier();
+				setState(81);
+				match(T__3);
+				setState(82);
+				((DereferenceContext)_localctx).fieldName = identifier();
+				}
+				break;
+			case 4:
+				_localctx = new ParenthesizedExpressionContext(_localctx);
+				enterOuterAlt(_localctx, 4);
+				{
+				setState(84);
+				match(T__0);
+				setState(85);
+				booleanExpression(0);
+				setState(86);
+				match(T__1);
+				}
+				break;
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class ConstantContext extends ParserRuleContext {
+		public ConstantContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_constant; }
+	 
+		public ConstantContext() { }
+		public void copyFrom(ConstantContext ctx) {
+			super.copyFrom(ctx);
+		}
+	}
+	public static class NullLiteralContext extends ConstantContext {
+		public TerminalNode NULL() { return getToken(ExpressionParser.NULL, 0); }
+		public NullLiteralContext(ConstantContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitNullLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class StringLiteralContext extends ConstantContext {
+		public List<TerminalNode> STRING() { return getTokens(ExpressionParser.STRING); }
+		public TerminalNode STRING(int i) {
+			return getToken(ExpressionParser.STRING, i);
+		}
+		public StringLiteralContext(ConstantContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitStringLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class NumericLiteralContext extends ConstantContext {
+		public NumberContext number() {
+			return getRuleContext(NumberContext.class,0);
+		}
+		public NumericLiteralContext(ConstantContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitNumericLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class BooleanLiteralContext extends ConstantContext {
+		public BooleanValueContext booleanValue() {
+			return getRuleContext(BooleanValueContext.class,0);
+		}
+		public BooleanLiteralContext(ConstantContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitBooleanLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final ConstantContext constant() throws RecognitionException {
+		ConstantContext _localctx = new ConstantContext(_ctx, getState());
+		enterRule(_localctx, 8, RULE_constant);
+		try {
+			int _alt;
+			setState(98);
+			_errHandler.sync(this);
+			switch (_input.LA(1)) {
+			case NULL:
+				_localctx = new NullLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 1);
+				{
+				setState(90);
+				match(NULL);
+				}
+				break;
+			case MINUS:
+			case BIGINT_LITERAL:
+			case SMALLINT_LITERAL:
+			case TINYINT_LITERAL:
+			case INTEGER_VALUE:
+			case DECIMAL_VALUE:
+			case DOUBLE_LITERAL:
+			case BIGDECIMAL_LITERAL:
+				_localctx = new NumericLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 2);
+				{
+				setState(91);
+				number();
+				}
+				break;
+			case FALSE:
+			case TRUE:
+				_localctx = new BooleanLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 3);
+				{
+				setState(92);
+				booleanValue();
+				}
+				break;
+			case STRING:
+				_localctx = new StringLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 4);
+				{
+				setState(94); 
+				_errHandler.sync(this);
+				_alt = 1;
+				do {
+					switch (_alt) {
+					case 1:
+						{
+						{
+						setState(93);
+						match(STRING);
+						}
+						}
+						break;
+					default:
+						throw new NoViableAltException(this);
+					}
+					setState(96); 
+					_errHandler.sync(this);
+					_alt = getInterpreter().adaptivePredict(_input,9,_ctx);
+				} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
+				}
+				break;
+			default:
+				throw new NoViableAltException(this);
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class IdentifierContext extends ParserRuleContext {
+		public IdentifierContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_identifier; }
+	 
+		public IdentifierContext() { }
+		public void copyFrom(IdentifierContext ctx) {
+			super.copyFrom(ctx);
+		}
+	}
+	public static class BackQuotedIdentifierContext extends IdentifierContext {
+		public TerminalNode BACKQUOTED_IDENTIFIER() { return getToken(ExpressionParser.BACKQUOTED_IDENTIFIER, 0); }
+		public BackQuotedIdentifierContext(IdentifierContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitBackQuotedIdentifier(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class UnquotedIdentifierContext extends IdentifierContext {
+		public TerminalNode IDENTIFIER() { return getToken(ExpressionParser.IDENTIFIER, 0); }
+		public UnquotedIdentifierContext(IdentifierContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitUnquotedIdentifier(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final IdentifierContext identifier() throws RecognitionException {
+		IdentifierContext _localctx = new IdentifierContext(_ctx, getState());
+		enterRule(_localctx, 10, RULE_identifier);
+		try {
+			setState(102);
+			_errHandler.sync(this);
+			switch (_input.LA(1)) {
+			case IDENTIFIER:
+				_localctx = new UnquotedIdentifierContext(_localctx);
+				enterOuterAlt(_localctx, 1);
+				{
+				setState(100);
+				match(IDENTIFIER);
+				}
+				break;
+			case BACKQUOTED_IDENTIFIER:
+				_localctx = new BackQuotedIdentifierContext(_localctx);
+				enterOuterAlt(_localctx, 2);
+				{
+				setState(101);
+				match(BACKQUOTED_IDENTIFIER);
+				}
+				break;
+			default:
+				throw new NoViableAltException(this);
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class ComparisonOperatorContext extends ParserRuleContext {
+		public TerminalNode EQ() { return getToken(ExpressionParser.EQ, 0); }
+		public TerminalNode NEQ() { return getToken(ExpressionParser.NEQ, 0); }
+		public TerminalNode LT() { return getToken(ExpressionParser.LT, 0); }
+		public TerminalNode LTE() { return getToken(ExpressionParser.LTE, 0); }
+		public TerminalNode GT() { return getToken(ExpressionParser.GT, 0); }
+		public TerminalNode GTE() { return getToken(ExpressionParser.GTE, 0); }
+		public ComparisonOperatorContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_comparisonOperator; }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitComparisonOperator(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final ComparisonOperatorContext comparisonOperator() throws RecognitionException {
+		ComparisonOperatorContext _localctx = new ComparisonOperatorContext(_ctx, getState());
+		enterRule(_localctx, 12, RULE_comparisonOperator);
+		int _la;
+		try {
+			enterOuterAlt(_localctx, 1);
+			{
+			setState(104);
+			_la = _input.LA(1);
+			if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << EQ) | (1L << NEQ) | (1L << LT) | (1L << LTE) | (1L << GT) | (1L << GTE))) != 0)) ) {
+			_errHandler.recoverInline(this);
+			}
+			else {
+				if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+				_errHandler.reportMatch(this);
+				consume();
+			}
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class BooleanValueContext extends ParserRuleContext {
+		public TerminalNode TRUE() { return getToken(ExpressionParser.TRUE, 0); }
+		public TerminalNode FALSE() { return getToken(ExpressionParser.FALSE, 0); }
+		public BooleanValueContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_booleanValue; }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitBooleanValue(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final BooleanValueContext booleanValue() throws RecognitionException {
+		BooleanValueContext _localctx = new BooleanValueContext(_ctx, getState());
+		enterRule(_localctx, 14, RULE_booleanValue);
+		int _la;
+		try {
+			enterOuterAlt(_localctx, 1);
+			{
+			setState(106);
+			_la = _input.LA(1);
+			if ( !(_la==FALSE || _la==TRUE) ) {
+			_errHandler.recoverInline(this);
+			}
+			else {
+				if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+				_errHandler.reportMatch(this);
+				consume();
+			}
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public static class NumberContext extends ParserRuleContext {
+		public NumberContext(ParserRuleContext parent, int invokingState) {
+			super(parent, invokingState);
+		}
+		@Override public int getRuleIndex() { return RULE_number; }
+	 
+		public NumberContext() { }
+		public void copyFrom(NumberContext ctx) {
+			super.copyFrom(ctx);
+		}
+	}
+	public static class DecimalLiteralContext extends NumberContext {
+		public TerminalNode DECIMAL_VALUE() { return getToken(ExpressionParser.DECIMAL_VALUE, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public DecimalLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitDecimalLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class BigIntLiteralContext extends NumberContext {
+		public TerminalNode BIGINT_LITERAL() { return getToken(ExpressionParser.BIGINT_LITERAL, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public BigIntLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitBigIntLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class TinyIntLiteralContext extends NumberContext {
+		public TerminalNode TINYINT_LITERAL() { return getToken(ExpressionParser.TINYINT_LITERAL, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public TinyIntLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitTinyIntLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class BigDecimalLiteralContext extends NumberContext {
+		public TerminalNode BIGDECIMAL_LITERAL() { return getToken(ExpressionParser.BIGDECIMAL_LITERAL, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public BigDecimalLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitBigDecimalLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class DoubleLiteralContext extends NumberContext {
+		public TerminalNode DOUBLE_LITERAL() { return getToken(ExpressionParser.DOUBLE_LITERAL, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public DoubleLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitDoubleLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class IntegerLiteralContext extends NumberContext {
+		public TerminalNode INTEGER_VALUE() { return getToken(ExpressionParser.INTEGER_VALUE, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public IntegerLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitIntegerLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+	public static class SmallIntLiteralContext extends NumberContext {
+		public TerminalNode SMALLINT_LITERAL() { return getToken(ExpressionParser.SMALLINT_LITERAL, 0); }
+		public TerminalNode MINUS() { return getToken(ExpressionParser.MINUS, 0); }
+		public SmallIntLiteralContext(NumberContext ctx) { copyFrom(ctx); }
+		@Override
+		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
+			if ( visitor instanceof ExpressionVisitor ) return ((ExpressionVisitor<? extends T>)visitor).visitSmallIntLiteral(this);
+			else return visitor.visitChildren(this);
+		}
+	}
+
+	public final NumberContext number() throws RecognitionException {
+		NumberContext _localctx = new NumberContext(_ctx, getState());
+		enterRule(_localctx, 16, RULE_number);
+		int _la;
+		try {
+			setState(136);
+			_errHandler.sync(this);
+			switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) {
+			case 1:
+				_localctx = new DecimalLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 1);
+				{
+				setState(109);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(108);
+					match(MINUS);
+					}
+				}
+
+				setState(111);
+				match(DECIMAL_VALUE);
+				}
+				break;
+			case 2:
+				_localctx = new IntegerLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 2);
+				{
+				setState(113);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(112);
+					match(MINUS);
+					}
+				}
+
+				setState(115);
+				match(INTEGER_VALUE);
+				}
+				break;
+			case 3:
+				_localctx = new BigIntLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 3);
+				{
+				setState(117);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(116);
+					match(MINUS);
+					}
+				}
+
+				setState(119);
+				match(BIGINT_LITERAL);
+				}
+				break;
+			case 4:
+				_localctx = new SmallIntLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 4);
+				{
+				setState(121);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(120);
+					match(MINUS);
+					}
+				}
+
+				setState(123);
+				match(SMALLINT_LITERAL);
+				}
+				break;
+			case 5:
+				_localctx = new TinyIntLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 5);
+				{
+				setState(125);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(124);
+					match(MINUS);
+					}
+				}
+
+				setState(127);
+				match(TINYINT_LITERAL);
+				}
+				break;
+			case 6:
+				_localctx = new DoubleLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 6);
+				{
+				setState(129);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(128);
+					match(MINUS);
+					}
+				}
+
+				setState(131);
+				match(DOUBLE_LITERAL);
+				}
+				break;
+			case 7:
+				_localctx = new BigDecimalLiteralContext(_localctx);
+				enterOuterAlt(_localctx, 7);
+				{
+				setState(133);
+				_errHandler.sync(this);
+				_la = _input.LA(1);
+				if (_la==MINUS) {
+					{
+					setState(132);
+					match(MINUS);
+					}
+				}
+
+				setState(135);
+				match(BIGDECIMAL_LITERAL);
+				}
+				break;
+			}
+		}
+		catch (RecognitionException re) {
+			_localctx.exception = re;
+			_errHandler.reportError(this, re);
+			_errHandler.recover(this, re);
+		}
+		finally {
+			exitRule();
+		}
+		return _localctx;
+	}
+
+	public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
+		switch (ruleIndex) {
+		case 1:
+			return booleanExpression_sempred((BooleanExpressionContext)_localctx, predIndex);
+		}
+		return true;
+	}
+	private boolean booleanExpression_sempred(BooleanExpressionContext _localctx, int predIndex) {
+		switch (predIndex) {
+		case 0:
+			return precpred(_ctx, 3);
+		case 1:
+			return precpred(_ctx, 2);
+		}
+		return true;
+	}
+
+	public static final String _serializedATN =
+		"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\"\u008d\4\2\t\2\4"+
+		"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\3\2\3\2"+
+		"\3\2\3\3\3\3\3\3\3\3\3\3\3\3\5\3\36\n\3\3\3\3\3\3\3\3\3\3\3\3\3\7\3&\n"+
+		"\3\f\3\16\3)\13\3\3\4\3\4\3\4\3\4\3\4\3\4\5\4\61\n\4\3\4\3\4\3\4\3\4\3"+
+		"\4\3\4\3\4\5\4:\n\4\3\4\3\4\3\4\3\4\3\4\7\4A\n\4\f\4\16\4D\13\4\3\4\3"+
+		"\4\3\4\3\4\3\4\5\4K\n\4\3\4\3\4\5\4O\n\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3"+
+		"\5\3\5\3\5\5\5[\n\5\3\6\3\6\3\6\3\6\6\6a\n\6\r\6\16\6b\5\6e\n\6\3\7\3"+
+		"\7\5\7i\n\7\3\b\3\b\3\t\3\t\3\n\5\np\n\n\3\n\3\n\5\nt\n\n\3\n\3\n\5\n"+
+		"x\n\n\3\n\3\n\5\n|\n\n\3\n\3\n\5\n\u0080\n\n\3\n\3\n\5\n\u0084\n\n\3\n"+
+		"\3\n\5\n\u0088\n\n\3\n\5\n\u008b\n\n\3\n\2\3\4\13\2\4\6\b\n\f\16\20\22"+
+		"\2\4\3\2\20\25\4\2\t\t\17\17\2\u00a2\2\24\3\2\2\2\4\35\3\2\2\2\6N\3\2"+
+		"\2\2\bZ\3\2\2\2\nd\3\2\2\2\fh\3\2\2\2\16j\3\2\2\2\20l\3\2\2\2\22\u008a"+
+		"\3\2\2\2\24\25\5\4\3\2\25\26\7\2\2\3\26\3\3\2\2\2\27\30\b\3\1\2\30\36"+
+		"\5\6\4\2\31\32\7\3\2\2\32\33\5\4\3\2\33\34\7\4\2\2\34\36\3\2\2\2\35\27"+
+		"\3\2\2\2\35\31\3\2\2\2\36\'\3\2\2\2\37 \f\5\2\2 !\7\7\2\2!&\5\4\3\6\""+
+		"#\f\4\2\2#$\7\16\2\2$&\5\4\3\5%\37\3\2\2\2%\"\3\2\2\2&)\3\2\2\2\'%\3\2"+
+		"\2\2\'(\3\2\2\2(\5\3\2\2\2)\'\3\2\2\2*+\5\b\5\2+,\5\16\b\2,-\5\b\5\2-"+
+		"O\3\2\2\2.\60\5\b\5\2/\61\7\f\2\2\60/\3\2\2\2\60\61\3\2\2\2\61\62\3\2"+
+		"\2\2\62\63\7\b\2\2\63\64\5\b\5\2\64\65\7\7\2\2\65\66\5\b\5\2\66O\3\2\2"+
+		"\2\679\5\b\5\28:\7\f\2\298\3\2\2\29:\3\2\2\2:;\3\2\2\2;<\7\n\2\2<=\7\3"+
+		"\2\2=B\5\b\5\2>?\7\5\2\2?A\5\b\5\2@>\3\2\2\2AD\3\2\2\2B@\3\2\2\2BC\3\2"+
+		"\2\2CE\3\2\2\2DB\3\2\2\2EF\7\4\2\2FO\3\2\2\2GH\5\b\5\2HJ\7\13\2\2IK\7"+
+		"\f\2\2JI\3\2\2\2JK\3\2\2\2KL\3\2\2\2LM\7\r\2\2MO\3\2\2\2N*\3\2\2\2N.\3"+
+		"\2\2\2N\67\3\2\2\2NG\3\2\2\2O\7\3\2\2\2P[\5\n\6\2Q[\5\f\7\2RS\5\f\7\2"+
+		"ST\7\6\2\2TU\5\f\7\2U[\3\2\2\2VW\7\3\2\2WX\5\4\3\2XY\7\4\2\2Y[\3\2\2\2"+
+		"ZP\3\2\2\2ZQ\3\2\2\2ZR\3\2\2\2ZV\3\2\2\2[\t\3\2\2\2\\e\7\r\2\2]e\5\22"+
+		"\n\2^e\5\20\t\2_a\7\27\2\2`_\3\2\2\2ab\3\2\2\2b`\3\2\2\2bc\3\2\2\2ce\3"+
+		"\2\2\2d\\\3\2\2\2d]\3\2\2\2d^\3\2\2\2d`\3\2\2\2e\13\3\2\2\2fi\7\37\2\2"+
+		"gi\7 \2\2hf\3\2\2\2hg\3\2\2\2i\r\3\2\2\2jk\t\2\2\2k\17\3\2\2\2lm\t\3\2"+
+		"\2m\21\3\2\2\2np\7\26\2\2on\3\2\2\2op\3\2\2\2pq\3\2\2\2q\u008b\7\34\2"+
+		"\2rt\7\26\2\2sr\3\2\2\2st\3\2\2\2tu\3\2\2\2u\u008b\7\33\2\2vx\7\26\2\2"+
+		"wv\3\2\2\2wx\3\2\2\2xy\3\2\2\2y\u008b\7\30\2\2z|\7\26\2\2{z\3\2\2\2{|"+
+		"\3\2\2\2|}\3\2\2\2}\u008b\7\31\2\2~\u0080\7\26\2\2\177~\3\2\2\2\177\u0080"+
+		"\3\2\2\2\u0080\u0081\3\2\2\2\u0081\u008b\7\32\2\2\u0082\u0084\7\26\2\2"+
+		"\u0083\u0082\3\2\2\2\u0083\u0084\3\2\2\2\u0084\u0085\3\2\2\2\u0085\u008b"+
+		"\7\35\2\2\u0086\u0088\7\26\2\2\u0087\u0086\3\2\2\2\u0087\u0088\3\2\2\2"+
+		"\u0088\u0089\3\2\2\2\u0089\u008b\7\36\2\2\u008ao\3\2\2\2\u008as\3\2\2"+
+		"\2\u008aw\3\2\2\2\u008a{\3\2\2\2\u008a\177\3\2\2\2\u008a\u0083\3\2\2\2"+
+		"\u008a\u0087\3\2\2\2\u008b\23\3\2\2\2\26\35%\'\609BJNZbdhosw{\177\u0083"+
+		"\u0087\u008a";
+	public static final ATN _ATN =
+		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+	static {
+		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionVisitor.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionVisitor.java
new file mode 100644
index 0000000..1c21781
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/antlr/gen/ExpressionVisitor.java
@@ -0,0 +1,162 @@
+// Generated from /home/david/Documents/code/carbondata/store/horizon/src/main/anltr/Expression.g4 by ANTLR 4.7
+package org.apache.carbondata.horizon.antlr.gen;
+import org.antlr.v4.runtime.tree.ParseTreeVisitor;
+
+/**
+ * This interface defines a complete generic visitor for a parse tree produced
+ * by {@link ExpressionParser}.
+ *
+ * @param <T> The return type of the visit operation. Use {@link Void} for
+ * operations with no return type.
+ */
+public interface ExpressionVisitor<T> extends ParseTreeVisitor<T> {
+	/**
+	 * Visit a parse tree produced by {@link ExpressionParser#parseFilter}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitParseFilter(ExpressionParser.ParseFilterContext ctx);
+	/**
+	 * Visit a parse tree produced by {@link ExpressionParser#booleanExpression}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitBooleanExpression(ExpressionParser.BooleanExpressionContext ctx);
+	/**
+	 * Visit a parse tree produced by {@link ExpressionParser#predicate}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitPredicate(ExpressionParser.PredicateContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code constantDefault}
+	 * labeled alternative in {@link ExpressionParser#primaryExpression}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitConstantDefault(ExpressionParser.ConstantDefaultContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code columnReference}
+	 * labeled alternative in {@link ExpressionParser#primaryExpression}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitColumnReference(ExpressionParser.ColumnReferenceContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code dereference}
+	 * labeled alternative in {@link ExpressionParser#primaryExpression}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitDereference(ExpressionParser.DereferenceContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code parenthesizedExpression}
+	 * labeled alternative in {@link ExpressionParser#primaryExpression}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitParenthesizedExpression(ExpressionParser.ParenthesizedExpressionContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code nullLiteral}
+	 * labeled alternative in {@link ExpressionParser#constant}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitNullLiteral(ExpressionParser.NullLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code numericLiteral}
+	 * labeled alternative in {@link ExpressionParser#constant}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitNumericLiteral(ExpressionParser.NumericLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code booleanLiteral}
+	 * labeled alternative in {@link ExpressionParser#constant}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitBooleanLiteral(ExpressionParser.BooleanLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code stringLiteral}
+	 * labeled alternative in {@link ExpressionParser#constant}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitStringLiteral(ExpressionParser.StringLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code unquotedIdentifier}
+	 * labeled alternative in {@link ExpressionParser#identifier}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitUnquotedIdentifier(ExpressionParser.UnquotedIdentifierContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code backQuotedIdentifier}
+	 * labeled alternative in {@link ExpressionParser#identifier}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitBackQuotedIdentifier(ExpressionParser.BackQuotedIdentifierContext ctx);
+	/**
+	 * Visit a parse tree produced by {@link ExpressionParser#comparisonOperator}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitComparisonOperator(ExpressionParser.ComparisonOperatorContext ctx);
+	/**
+	 * Visit a parse tree produced by {@link ExpressionParser#booleanValue}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitBooleanValue(ExpressionParser.BooleanValueContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code decimalLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitDecimalLiteral(ExpressionParser.DecimalLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code integerLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitIntegerLiteral(ExpressionParser.IntegerLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code bigIntLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitBigIntLiteral(ExpressionParser.BigIntLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code smallIntLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitSmallIntLiteral(ExpressionParser.SmallIntLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code tinyIntLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitTinyIntLiteral(ExpressionParser.TinyIntLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code doubleLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitDoubleLiteral(ExpressionParser.DoubleLiteralContext ctx);
+	/**
+	 * Visit a parse tree produced by the {@code bigDecimalLiteral}
+	 * labeled alternative in {@link ExpressionParser#number}.
+	 * @param ctx the parse tree
+	 * @return the visitor result
+	 */
+	T visitBigDecimalLiteral(ExpressionParser.BigDecimalLiteralContext ctx);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/Horizon.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/Horizon.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/Horizon.java
new file mode 100644
index 0000000..1f6f485
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/Horizon.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.controller;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ConfigurableApplicationContext;
+
+@SpringBootApplication
+public class Horizon {
+
+  private static ConfigurableApplicationContext context;
+
+  public static void main(String[] args) {
+    context = SpringApplication.run(Horizon.class, args);
+  }
+
+  public static void close() {
+    SpringApplication.exit(context);
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/HorizonController.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/HorizonController.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/HorizonController.java
new file mode 100644
index 0000000..2089c1a
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/controller/HorizonController.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.carbondata.horizon.rest.controller;
+
+import java.util.UUID;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.datastore.row.CarbonRow;
+import org.apache.carbondata.horizon.rest.model.descriptor.LoadDescriptor;
+import org.apache.carbondata.horizon.rest.model.descriptor.SelectDescriptor;
+import org.apache.carbondata.horizon.rest.model.descriptor.TableDescriptor;
+import org.apache.carbondata.horizon.rest.model.validate.RequestValidator;
+import org.apache.carbondata.horizon.rest.model.view.CreateTableRequest;
+import org.apache.carbondata.horizon.rest.model.view.LoadRequest;
+import org.apache.carbondata.horizon.rest.model.view.SelectRequest;
+import org.apache.carbondata.horizon.rest.model.view.SelectResponse;
+import org.apache.carbondata.horizon.rest.service.HorizonService;
+import org.apache.carbondata.store.exception.StoreException;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class HorizonController {
+
+  private static LogService LOGGER =
+      LogServiceFactory.getLogService(HorizonController.class.getName());
+
+  private HorizonService service;
+
+  public HorizonController() {
+    service = HorizonService.getInstance();
+  }
+
+  @RequestMapping(value = "/table/create", produces = MediaType.APPLICATION_JSON_VALUE)
+  public ResponseEntity<String> createTable(
+      @RequestBody CreateTableRequest request) throws StoreException {
+    RequestValidator.validateTable(request);
+    TableDescriptor tableDescriptor = request.convertToDto();
+    boolean result = service.createTable(tableDescriptor);
+    return new ResponseEntity<>(String.valueOf(result), HttpStatus.OK);
+  }
+
+  @RequestMapping(value = "/table/load", produces = MediaType.APPLICATION_JSON_VALUE)
+  public ResponseEntity<String> load(@RequestBody LoadRequest request) throws StoreException {
+    RequestValidator.validateLoad(request);
+    LoadDescriptor loadDescriptor = request.convertToDto();
+    boolean result = service.loadData(loadDescriptor);
+    return new ResponseEntity<>(String.valueOf(result), HttpStatus.OK);
+  }
+
+
+  @RequestMapping(value = "/table/select", produces = MediaType.APPLICATION_JSON_VALUE)
+  public ResponseEntity<SelectResponse> select(@RequestBody SelectRequest request)
+      throws StoreException {
+    long start = System.currentTimeMillis();
+    RequestValidator.validateSelect(request);
+    SelectDescriptor selectDescriptor = request.convertToDto();
+    selectDescriptor.setId(UUID.randomUUID().toString());
+    CarbonRow[] result = service.select(selectDescriptor);
+    Object[][] newResult = new Object[result.length][];
+    for (int i = newResult.length - 1; i >= 0; i--) {
+      newResult[i] = result[i].getData();
+    }
+    long end = System.currentTimeMillis();
+    LOGGER.audit("[" + selectDescriptor.getId() +  "] HorizonController select " +
+        request.getDatabaseName() + "." + request.getTableName() +
+        ", take time: " + (end - start) + " ms");
+    return new ResponseEntity<>(
+        new SelectResponse(selectDescriptor.getId(), newResult), HttpStatus.OK);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/LoadDescriptor.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/LoadDescriptor.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/LoadDescriptor.java
new file mode 100644
index 0000000..ec2c0f4
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/LoadDescriptor.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.model.descriptor;
+
+import java.util.Map;
+
+public class LoadDescriptor {
+
+  private String databaseName;
+  private String tableName;
+  private String inputPath;
+  private Map<String, String> options;
+  private boolean isOverwrite;
+
+  public LoadDescriptor() {
+  }
+
+  public LoadDescriptor(String databaseName, String tableName, String inputPaths,
+      Map<String, String> options, boolean isOverwrite) {
+    this.databaseName = databaseName;
+    this.tableName = tableName;
+    this.inputPath = inputPaths;
+    this.options = options;
+    this.isOverwrite = isOverwrite;
+  }
+
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  public void setDatabaseName(String databaseName) {
+    this.databaseName = databaseName;
+  }
+
+  public String getTableName() {
+    return tableName;
+  }
+
+  public void setTableName(String tableName) {
+    this.tableName = tableName;
+  }
+
+  public String getInputPath() {
+    return inputPath;
+  }
+
+  public void setInputPath(String inputPath) {
+    this.inputPath = inputPath;
+  }
+
+  public Map<String, String> getOptions() {
+    return options;
+  }
+
+  public void setOptions(Map<String, String> options) {
+    this.options = options;
+  }
+
+  public boolean isOverwrite() {
+    return isOverwrite;
+  }
+
+  public void setOverwrite(boolean overwrite) {
+    isOverwrite = overwrite;
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/SelectDescriptor.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/SelectDescriptor.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/SelectDescriptor.java
new file mode 100644
index 0000000..e10dc84
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/SelectDescriptor.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.model.descriptor;
+
+public class SelectDescriptor {
+
+  private String id;
+  private String databaseName;
+  private String tableName;
+  private String[] projection;
+  private String filter;
+  private int limit;
+
+  public SelectDescriptor() {
+  }
+
+  public SelectDescriptor(String databaseName, String tableName, String[] projection, String filter,
+      int limit) {
+    this.databaseName = databaseName;
+    this.tableName = tableName;
+    this.projection = projection;
+    this.filter = filter;
+    this.limit = limit;
+  }
+
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  public void setDatabaseName(String databaseName) {
+    this.databaseName = databaseName;
+  }
+
+  public String getTableName() {
+    return tableName;
+  }
+
+  public void setTableName(String tableName) {
+    this.tableName = tableName;
+  }
+
+  public String[] getProjection() {
+    return projection;
+  }
+
+  public void setProjection(String[] projection) {
+    this.projection = projection;
+  }
+
+  public String getFilter() {
+    return filter;
+  }
+
+  public void setFilter(String filter) {
+    this.filter = filter;
+  }
+
+  public int getLimit() {
+    return limit;
+  }
+
+  public void setLimit(int limit) {
+    this.limit = limit;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/TableDescriptor.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/TableDescriptor.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/TableDescriptor.java
new file mode 100644
index 0000000..db1ce98
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/descriptor/TableDescriptor.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.model.descriptor;
+
+import java.util.Map;
+
+import org.apache.carbondata.sdk.file.Schema;
+
+public class TableDescriptor {
+
+  private boolean ifNotExists;
+  private String database;
+  private String name;
+  private Schema schema;
+  private Map<String, String> properties;
+  private String comment;
+
+  public TableDescriptor(boolean ifNotExists, String database, String name, Schema schema,
+      Map<String, String> properties, String comment) {
+    this.ifNotExists = ifNotExists;
+    this.database = database;
+    this.name = name;
+    this.schema = schema;
+    this.properties = properties;
+    this.comment = comment;
+  }
+
+  public boolean isIfNotExists() {
+    return ifNotExists;
+  }
+
+  public void setIfNotExists(boolean ifNotExists) {
+    this.ifNotExists = ifNotExists;
+  }
+
+  public String getDatabase() {
+    return database;
+  }
+
+  public void setDatabase(String database) {
+    this.database = database;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Schema getSchema() {
+    return schema;
+  }
+
+  public void setSchema(Schema schema) {
+    this.schema = schema;
+  }
+
+  public Map<String, String> getProperties() {
+    return properties;
+  }
+
+  public void setProperties(Map<String, String> properties) {
+    this.properties = properties;
+  }
+
+  public String getComment() {
+    return comment;
+  }
+
+  public void setComment(String comment) {
+    this.comment = comment;
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/validate/RequestValidator.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/validate/RequestValidator.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/validate/RequestValidator.java
new file mode 100644
index 0000000..de82860
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/validate/RequestValidator.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.model.validate;
+
+import org.apache.carbondata.horizon.rest.model.view.CreateTableRequest;
+import org.apache.carbondata.horizon.rest.model.view.LoadRequest;
+import org.apache.carbondata.horizon.rest.model.view.SelectRequest;
+import org.apache.carbondata.store.exception.StoreException;
+
+import org.apache.commons.lang.StringUtils;
+
+public class RequestValidator {
+
+  public static void validateSelect(SelectRequest request) throws StoreException {
+    if (request == null) {
+      throw new StoreException("Select should not be null");
+    }
+    if (StringUtils.isEmpty(request.getDatabaseName())) {
+      throw new StoreException("database name is invalid");
+    }
+    if (StringUtils.isEmpty(request.getTableName())) {
+      throw new StoreException("table name is invalid");
+    }
+  }
+
+  public static void validateTable(CreateTableRequest request) throws StoreException {
+    if (request == null) {
+      throw new StoreException("TableDescriptor should not be null");
+    }
+    if (StringUtils.isEmpty(request.getDatabaseName())) {
+      throw new StoreException("database name is invalid");
+    }
+    if (StringUtils.isEmpty(request.getTableName())) {
+      throw new StoreException("table name is invalid");
+    }
+    if (request.getFields() == null || request.getFields().length == 0) {
+      throw new StoreException("fields should not be empty");
+    }
+  }
+
+  public static void validateLoad(LoadRequest request)  throws StoreException {
+    if (request == null) {
+      throw new StoreException("LoadDescriptor should not be null");
+    }
+    if (StringUtils.isEmpty(request.getDatabaseName())) {
+      throw new StoreException("database name is invalid");
+    }
+    if (StringUtils.isEmpty(request.getTableName())) {
+      throw new StoreException("table name is invalid");
+    }
+    if (StringUtils.isEmpty(request.getInputPath())) {
+      throw new StoreException("input path is invalid");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/CreateTableRequest.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/CreateTableRequest.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/CreateTableRequest.java
new file mode 100644
index 0000000..9c81bf0
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/CreateTableRequest.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.model.view;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.carbondata.horizon.rest.model.descriptor.TableDescriptor;
+import org.apache.carbondata.sdk.file.Field;
+import org.apache.carbondata.sdk.file.Schema;
+
+public class CreateTableRequest {
+
+  private boolean ifNotExists;
+  private String databaseName;
+  private String tableName;
+  private FieldRequest[] fields;
+  private Map<String, String> properties;
+  private String comment;
+
+  public CreateTableRequest() {
+
+  }
+
+  public CreateTableRequest(boolean ifNotExists, String databaseName, String tableName,
+      FieldRequest[] fields, Map<String, String> properties, String comment) {
+    this.databaseName = databaseName;
+    this.tableName = tableName;
+    this.ifNotExists = ifNotExists;
+    this.fields = fields;
+    this.properties = properties;
+    this.comment = comment;
+  }
+
+  public boolean isIfNotExists() {
+    return ifNotExists;
+  }
+
+  public void setIfNotExists(boolean ifNotExists) {
+    this.ifNotExists = ifNotExists;
+  }
+
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  public void setDatabaseName(String databaseName) {
+    this.databaseName = databaseName;
+  }
+
+  public String getTableName() {
+    return tableName;
+  }
+
+  public void setTableName(String tableName) {
+    this.tableName = tableName;
+  }
+
+  public FieldRequest[] getFields() {
+    return fields;
+  }
+
+  public void setFields(FieldRequest[] fields) {
+    this.fields = fields;
+  }
+
+  public Map<String, String> getProperties() {
+    return properties;
+  }
+
+  public void setProperties(Map<String, String> properties) {
+    this.properties = properties;
+  }
+
+  public String getComment() {
+    return comment;
+  }
+
+  public void setComment(String comment) {
+    this.comment = comment;
+  }
+
+  public TableDescriptor convertToDto() {
+    Field[] schemaFields = new Field[fields.length];
+    Schema schema = new Schema(schemaFields);
+    for (int i = 0; i < fields.length; i++) {
+      schemaFields[i] = fields[i].convertToDto();
+      schemaFields[i].setSchemaOrdinal(i);
+    }
+    return new TableDescriptor(ifNotExists, databaseName, tableName, schema, properties, comment);
+  }
+
+  public static class Builder {
+
+    private CreateTableRequest table;
+    private List<FieldRequest> fields;
+    private Map<String, String> tblProperties;
+
+    private Builder() {
+      table = new CreateTableRequest();
+      fields = new ArrayList<>();
+      tblProperties = new HashMap<>();
+    }
+
+    public Builder ifNotExists() {
+      table.setIfNotExists(true);
+      return this;
+    }
+
+    public Builder databaseName(String databaseName) {
+      table.setDatabaseName(databaseName);
+      return this;
+    }
+
+    public Builder tableName(String tableName) {
+      table.setTableName(tableName);
+      return this;
+    }
+
+    public Builder comment(String comment) {
+      table.setComment(comment);
+      return this;
+    }
+
+    public Builder column(String name, String dataType) {
+      fields.add(new FieldRequest(name, dataType));
+      return this;
+    }
+
+    public Builder column(String name, String dataType, String comment) {
+      fields.add(new FieldRequest(name, dataType, comment));
+      return this;
+    }
+
+    public Builder column(String name, String dataType, int precision, int scale, String comment) {
+      fields.add(new FieldRequest(name, dataType, precision, scale, comment));
+      return this;
+    }
+
+    public Builder tblProperties(String key, String value) {
+      tblProperties.put(key, value);
+      return this;
+    }
+
+    public CreateTableRequest create() {
+      FieldRequest[] fieldArray = new FieldRequest[fields.size()];
+      fieldArray = fields.toArray(fieldArray);
+      table.setFields(fieldArray);
+      table.setProperties(tblProperties);
+      return table;
+    }
+  }
+
+  public static Builder builder() {
+    return new Builder();
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/6fa86381/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/FieldRequest.java
----------------------------------------------------------------------
diff --git a/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/FieldRequest.java b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/FieldRequest.java
new file mode 100644
index 0000000..b809d9e
--- /dev/null
+++ b/store/horizon/src/main/java/org/apache/carbondata/horizon/rest/model/view/FieldRequest.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.horizon.rest.model.view;
+
+import java.util.LinkedList;
+
+import org.apache.carbondata.core.metadata.datatype.StructField;
+import org.apache.carbondata.core.util.DataTypeUtil;
+import org.apache.carbondata.sdk.file.Field;
+
+public class FieldRequest {
+
+  private String name;
+  private String dataType;
+  private int precision;
+  private int scale;
+  private String comment;
+
+  public FieldRequest() {
+
+  }
+
+  public FieldRequest(String name, String dataType) {
+    this.name = name;
+    this.dataType = dataType;
+  }
+
+  public FieldRequest(String name, String dataType, String comment) {
+    this.name = name;
+    this.dataType = dataType;
+    this.comment = comment;
+  }
+
+  public FieldRequest(String name, String dataType, int precision, int scale, String comment) {
+    this.name = name;
+    this.dataType = dataType;
+    this.precision = precision;
+    this.scale = scale;
+    this.comment = comment;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getDataType() {
+    return dataType;
+  }
+
+  public void setDataType(String dataType) {
+    this.dataType = dataType;
+  }
+
+  public int getPrecision() {
+    return precision;
+  }
+
+  public void setPrecision(int precision) {
+    this.precision = precision;
+  }
+
+  public int getScale() {
+    return scale;
+  }
+
+  public void setScale(int scale) {
+    this.scale = scale;
+  }
+
+  public String getComment() {
+    return comment;
+  }
+
+  public void setComment(String comment) {
+    this.comment = comment;
+  }
+
+  public Field convertToDto() {
+    if (dataType.equalsIgnoreCase("char") ||
+        dataType.equalsIgnoreCase("varchar") ||
+        dataType.matches("(varchar)\\(\\d+\\)") ||
+        dataType.matches("(char)\\(\\d+\\)")) {
+      dataType = "string";
+    } else if (dataType.equalsIgnoreCase("float")) {
+      dataType = "double";
+    }
+
+    Field field = new Field(name, DataTypeUtil.valueOf(dataType));
+    field.setPrecision(precision);
+    field.setScale(scale);
+    field.setColumnComment(comment);
+    field.setChildren(new LinkedList<StructField>());
+    return field;
+  }
+}


Mime
View raw message