You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2013/07/02 16:16:12 UTC
[18/51] [partial] TAJO-22: The package prefix should be
org.apache.tajo. (DaeMyung Kang via hyunsik)
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinDouble.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinDouble.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinDouble.java
deleted file mode 100644
index 920a83a..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinDouble.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.storage.Tuple;
-
-public class MinDouble extends AggFunction<Datum> {
-
- public MinDouble() {
- super(new Column[] {
- new Column("val", Type.FLOAT8)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new MinContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- MinContext minCtx = (MinContext) ctx;
- minCtx.min = Math.min(minCtx.min, params.get(0).asFloat8());
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createFloat8(((MinContext) ctx).min);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.FLOAT8);
- }
-
- @Override
- public Datum terminate(FunctionContext ctx) {
- return DatumFactory.createFloat8(((MinContext) ctx).min);
- }
-
- private class MinContext implements FunctionContext {
- double min = Double.MAX_VALUE;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinFloat.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinFloat.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinFloat.java
deleted file mode 100644
index 3ddde2e..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinFloat.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.datum.Float4Datum;
-import tajo.storage.Tuple;
-
-public class MinFloat extends AggFunction<Float4Datum> {
-
- public MinFloat() {
- super(new Column[] {
- new Column("val", Type.FLOAT4)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new MinContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- MinContext minCtx = (MinContext) ctx;
- minCtx.min = Math.min(minCtx.min, params.get(0).asFloat4());
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createFloat4(((MinContext) ctx).min);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.FLOAT4);
- }
-
- @Override
- public Float4Datum terminate(FunctionContext ctx) {
- return DatumFactory.createFloat4(((MinContext) ctx).min);
- }
-
- private class MinContext implements FunctionContext {
- float min = Float.MAX_VALUE;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinInt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinInt.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinInt.java
deleted file mode 100644
index 98300c7..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinInt.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.storage.Tuple;
-
-public class MinInt extends AggFunction<Datum> {
-
- public MinInt() {
- super(new Column[] {
- new Column("val", Type.INT8)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new MinContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- MinContext minCtx = (MinContext) ctx;
- minCtx.min = Math.min(minCtx.min, params.get(0).asInt4());
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createInt4(((MinContext) ctx).min);
- }
-
- @Override
- public DataType[] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.INT4);
- }
-
- @Override
- public Datum terminate(FunctionContext ctx) {
- return DatumFactory.createInt4(((MinContext) ctx).min);
- }
-
- private class MinContext implements FunctionContext {
- int min = Integer.MAX_VALUE;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinLong.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinLong.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinLong.java
deleted file mode 100644
index 8813eb5..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinLong.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.datum.Int8Datum;
-import tajo.storage.Tuple;
-
-public class MinLong extends AggFunction<Datum> {
-
- public MinLong() {
- super(new Column[] {
- new Column("val", Type.INT8)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new MinContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- MinContext minCtx = (MinContext)ctx;
- minCtx.min = Math.min(minCtx.min, params.get(0).asInt8());
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createInt8(((MinContext) ctx).min);
- }
-
- @Override
- public DataType[] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.INT8);
- }
-
- @Override
- public Int8Datum terminate(FunctionContext ctx) {
- return DatumFactory.createInt8(((MinContext) ctx).min);
- }
-
- private class MinContext implements FunctionContext {
- long min = Long.MAX_VALUE;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinString.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinString.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinString.java
deleted file mode 100644
index e3b0b38..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/MinString.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.datum.TextDatum;
-import tajo.storage.Tuple;
-
-public class MinString extends AggFunction<Datum> {
-
- public MinString() {
- super(new Column[] {
- new Column("val", Type.TEXT)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new MinContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- MinContext minCtx = (MinContext) ctx;
- if (minCtx.min == null) {
- minCtx.min = params.get(0).asChars();
- } else if (params.get(0).asChars().compareTo(minCtx.min) < 0) {
- minCtx.min = params.get(0).asChars();
- }
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createText(((MinContext) ctx).min);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.TEXT);
- }
-
- @Override
- public TextDatum terminate(FunctionContext ctx) {
- return DatumFactory.createText(((MinContext) ctx).min);
- }
-
- private class MinContext implements FunctionContext {
- String min;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/RandomInt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/RandomInt.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/RandomInt.java
deleted file mode 100644
index 7143af9..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/RandomInt.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.Column;
-import tajo.catalog.function.GeneralFunction;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.storage.Tuple;
-
-import java.util.Random;
-
-import static tajo.common.TajoDataTypes.Type.INT4;
-
-public class RandomInt extends GeneralFunction<Datum> {
- private Random random;
-
- public RandomInt() {
- super(new Column[] {
- new Column("val", INT4)
- });
- random = new Random(System.nanoTime());
- }
-
- @Override
- public Datum eval(Tuple params) {
- return DatumFactory.createInt4(random.nextInt(params.get(0).asInt4()));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumDouble.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumDouble.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumDouble.java
deleted file mode 100644
index 7089fb3..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumDouble.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.datum.Float8Datum;
-import tajo.storage.Tuple;
-
-public class SumDouble extends AggFunction<Datum> {
-
- public SumDouble() {
- super(new Column[] {
- new Column("val", Type.FLOAT8)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new SumContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- ((SumContext)ctx).sum += params.get(0).asFloat8();
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createFloat8(((SumContext) ctx).sum);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.FLOAT8);
- }
-
- @Override
- public Float8Datum terminate(FunctionContext ctx) {
- return DatumFactory.createFloat8(((SumContext) ctx).sum);
- }
-
- private class SumContext implements FunctionContext {
- double sum;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumFloat.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumFloat.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumFloat.java
deleted file mode 100644
index 8c06c03..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumFloat.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.storage.Tuple;
-
-public class SumFloat extends AggFunction<Datum> {
- public SumFloat() {
- super(new Column[] {
- new Column("val", Type.FLOAT4)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new SumContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- ((SumContext)ctx).sum += params.get(0).asFloat4();
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createFloat4(((SumContext) ctx).sum);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.FLOAT4);
- }
-
- @Override
- public Datum terminate(FunctionContext ctx) {
- return DatumFactory.createFloat4(((SumContext) ctx).sum);
- }
-
- private class SumContext implements FunctionContext {
- private float sum;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumInt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumInt.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumInt.java
deleted file mode 100644
index f80f7e0..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumInt.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.storage.Tuple;
-
-public class SumInt extends AggFunction<Datum> {
-
- public SumInt() {
- super(new Column[] {
- new Column("val", Type.INT4)
- });
- }
-
- @Override
- public SumIntContext newContext() {
- return new SumIntContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- SumIntContext sumCtx = (SumIntContext) ctx;
- sumCtx.sum += params.get(0).asInt8();
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createInt4(((SumIntContext) ctx).sum);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.INT4);
- }
-
- @Override
- public Datum terminate(FunctionContext ctx) {
- return DatumFactory.createInt4(((SumIntContext) ctx).sum);
- }
-
- private class SumIntContext implements FunctionContext {
- int sum;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumLong.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumLong.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumLong.java
deleted file mode 100644
index 9dcceb2..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/SumLong.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.CatalogUtil;
-import tajo.catalog.Column;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.FunctionContext;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.datum.Int8Datum;
-import tajo.storage.Tuple;
-
-public class SumLong extends AggFunction<Datum> {
-
- public SumLong() {
- super(new Column[] {
- new Column("val", Type.INT8)
- });
- }
-
- @Override
- public FunctionContext newContext() {
- return new SumContext();
- }
-
- @Override
- public void eval(FunctionContext ctx, Tuple params) {
- ((SumContext)ctx).sum += params.get(0).asInt8();
- }
-
- @Override
- public Datum getPartialResult(FunctionContext ctx) {
- return DatumFactory.createInt8(((SumContext) ctx).sum);
- }
-
- @Override
- public DataType [] getPartialResultType() {
- return CatalogUtil.newDataTypesWithoutLen(Type.INT8);
- }
-
- @Override
- public Int8Datum terminate(FunctionContext ctx) {
- return DatumFactory.createInt8(((SumContext) ctx).sum);
- }
-
- private class SumContext implements FunctionContext {
- long sum;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/Today.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/Today.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/Today.java
deleted file mode 100644
index d9b1a92..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/function/builtin/Today.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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 tajo.engine.function.builtin;
-
-import tajo.catalog.Column;
-import tajo.catalog.function.GeneralFunction;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.datum.Int8Datum;
-import tajo.storage.Tuple;
-
-public class Today extends GeneralFunction<Int8Datum> {
-
- public Today() {
- super(new Column[] {});
- }
-
- @Override
- public Datum eval(Tuple params) {
- return DatumFactory.createInt8(System.currentTimeMillis());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/EvalNodeAdapter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/EvalNodeAdapter.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/EvalNodeAdapter.java
deleted file mode 100644
index 3f03a8a..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/EvalNodeAdapter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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 tajo.engine.json;
-
-import com.google.gson.*;
-import tajo.engine.eval.EvalNode;
-
-import java.lang.reflect.Type;
-
-public class EvalNodeAdapter implements JsonSerializer<EvalNode>, JsonDeserializer<EvalNode> {
-
- @Override
- public EvalNode deserialize(JsonElement json, Type type,
- JsonDeserializationContext ctx) throws JsonParseException {
- JsonObject jsonObj = json.getAsJsonObject();
- String className = jsonObj.get("type").getAsString();
- JsonElement elem = jsonObj.get("properties");
-
- try {
- return ctx.deserialize(elem, Class.forName(className));
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- @Override
- public JsonElement serialize(EvalNode evalNode, Type type,
- JsonSerializationContext ctx) {
- JsonObject json = new JsonObject();
- json.add("type", new JsonPrimitive(evalNode.getClass().getName()));
- json.add("properties", ctx.serialize(evalNode, evalNode.getClass()));
- return json;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FragmentDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FragmentDeserializer.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FragmentDeserializer.java
deleted file mode 100644
index 46bd134..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FragmentDeserializer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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 tajo.engine.json;
-
-import com.google.gson.*;
-import org.apache.hadoop.fs.Path;
-import tajo.catalog.Options;
-import tajo.catalog.Schema;
-import tajo.catalog.TableMetaImpl;
-import tajo.catalog.proto.CatalogProtos.StoreType;
-import tajo.storage.Fragment;
-
-import java.lang.reflect.Type;
-
-public class FragmentDeserializer implements JsonDeserializer<Fragment> {
-
- @Override
- public Fragment deserialize(JsonElement json, Type type,
- JsonDeserializationContext ctx) throws JsonParseException {
- Gson gson = GsonCreator.getInstance();
- JsonObject fragObj = json.getAsJsonObject();
- JsonObject metaObj = fragObj.get("meta").getAsJsonObject();
- TableMetaImpl meta = new TableMetaImpl(
- gson.fromJson(metaObj.get("schema"), Schema.class),
- gson.fromJson(metaObj.get("storeType"), StoreType.class),
- gson.fromJson(metaObj.get("options"), Options.class));
- Fragment fragment = new Fragment(fragObj.get("tabletId").getAsString(),
- gson.fromJson(fragObj.get("path"), Path.class),
- meta,
- fragObj.get("startOffset").getAsLong(),
- fragObj.get("length").getAsLong(), null);
- return fragment;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FromTableDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FromTableDeserializer.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FromTableDeserializer.java
deleted file mode 100644
index f2c3908..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/FromTableDeserializer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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 tajo.engine.json;
-
-import com.google.gson.*;
-import tajo.catalog.TableDesc;
-import tajo.catalog.TableDescImpl;
-import tajo.engine.parser.QueryBlock.FromTable;
-import tajo.storage.Fragment;
-
-import java.lang.reflect.Type;
-
-public class FromTableDeserializer implements JsonDeserializer<FromTable> {
-
- @Override
- public FromTable deserialize(JsonElement json, Type type,
- JsonDeserializationContext ctx) throws JsonParseException {
- Gson gson = GsonCreator.getInstance();
- JsonObject fromTableObj = json.getAsJsonObject();
- boolean isFragment = fromTableObj.get("isFragment").getAsBoolean();
- TableDesc desc;
- if (isFragment) {
- desc = gson.fromJson(fromTableObj.get("desc"), Fragment.class);
- } else {
- desc = gson.fromJson(fromTableObj.get("desc"), TableDescImpl.class);
- }
-
- return new FromTable(desc, fromTableObj.get("alias").getAsString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/GsonCreator.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/GsonCreator.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/GsonCreator.java
deleted file mode 100644
index ebcd5eb..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/GsonCreator.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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 tajo.engine.json;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.hadoop.fs.Path;
-import tajo.catalog.TableDesc;
-import tajo.catalog.TableMeta;
-import tajo.catalog.function.AggFunction;
-import tajo.catalog.function.Function;
-import tajo.catalog.function.GeneralFunction;
-import tajo.catalog.json.FunctionAdapter;
-import tajo.catalog.json.TableDescAdapter;
-import tajo.catalog.json.TableMetaAdapter;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.datum.Datum;
-import tajo.datum.json.DatumAdapter;
-import tajo.engine.eval.EvalNode;
-import tajo.engine.planner.logical.LogicalNode;
-import tajo.gson.*;
-
-public class GsonCreator {
- private static GsonBuilder builder;
- private static Gson gson;
-
- private static void init() {
- if (builder == null) {
- builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
- builder.registerTypeAdapter(Path.class, new PathSerializer());
- builder.registerTypeAdapter(Path.class, new PathDeserializer());
- builder.registerTypeAdapter(TableDesc.class, new TableDescAdapter());
- builder.registerTypeAdapter(Class.class, new ClassNameSerializer());
- builder.registerTypeAdapter(Class.class, new ClassNameDeserializer());
- builder.registerTypeAdapter(LogicalNode.class, new LogicalNodeAdapter());
- builder.registerTypeAdapter(EvalNode.class, new EvalNodeAdapter());
- builder.registerTypeAdapter(TableMeta.class, new TableMetaAdapter());
- builder.registerTypeAdapter(Datum.class, new DatumTypeAdapter());
- builder.registerTypeAdapter(Function.class, new FunctionAdapter());
- builder.registerTypeAdapter(GeneralFunction.class, new FunctionAdapter());
- builder.registerTypeAdapter(AggFunction.class, new FunctionAdapter());
- builder.registerTypeAdapter(Datum.class, new DatumAdapter());
- builder.registerTypeAdapter(DataType.class, new DataTypeAdapter());
- }
- }
-
- public static Gson getInstance() {
- init();
- if (gson == null ) {
- gson = builder.create();
- }
- return gson;
- }
-
- public static Gson getPrettyInstance() {
- init();
- if (gson == null ) {
- gson = builder.setPrettyPrinting().create();
- }
- return gson;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/LogicalNodeAdapter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/LogicalNodeAdapter.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/LogicalNodeAdapter.java
deleted file mode 100644
index 8649002..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/json/LogicalNodeAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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 tajo.engine.json;
-
-import com.google.gson.*;
-import tajo.engine.planner.logical.LogicalNode;
-
-import java.lang.reflect.Type;
-
-public class LogicalNodeAdapter implements JsonSerializer<LogicalNode>, JsonDeserializer<LogicalNode> {
-
- @Override
- public LogicalNode deserialize(JsonElement json, Type type,
- JsonDeserializationContext ctx) throws JsonParseException {
- JsonObject jsonObject = json.getAsJsonObject();
- String className = jsonObject.get("classname").getAsJsonPrimitive().getAsString();
-
- Class clazz;
- try {
- clazz = Class.forName(className);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- throw new JsonParseException(e);
- }
- return ctx.deserialize(jsonObject.get("property"), clazz);
- }
-
- @Override
- public JsonElement serialize(LogicalNode src, Type typeOfSrc,
- JsonSerializationContext context) {
- JsonObject jsonObj = new JsonObject();
- String className = src.getClass().getCanonicalName();
- jsonObj.addProperty("classname", className);
- JsonElement jsonElem = context.serialize(src);
- jsonObj.add("property", jsonElem);
- return jsonObj;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CommandType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CommandType.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CommandType.java
deleted file mode 100644
index 049171f..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CommandType.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-public enum CommandType {
- // Select
- SELECT,
-
- // Update
- INSERT,
- UPDATE,
- DELETE,
-
- // Schema
- CREATE_TABLE,
- DROP_TABLE,
-
- // Control
- SHOW_TABLES,
- DESC_TABLE,
- SHOW_FUNCTION;
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CopyStmt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CopyStmt.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CopyStmt.java
deleted file mode 100644
index 0ef4c10..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CopyStmt.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-import org.apache.hadoop.fs.Path;
-import tajo.catalog.Options;
-import tajo.engine.planner.PlanningContext;
-
-import static tajo.catalog.proto.CatalogProtos.StoreType;
-
-public class CopyStmt extends ParseTree {
- private String tableName;
- private Path path;
- private StoreType storeType;
- private Options params = null;
-
- public CopyStmt(PlanningContext context) {
- super(context, StatementType.COPY);
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- public String getTableName() {
- return this.tableName;
- }
-
- public void setPath(Path path) {
- this.path = path;
- }
-
- public Path getPath() {
- return this.path;
- }
-
- public void setStoreType(StoreType storeType) {
- this.storeType = storeType;
- }
-
- public StoreType getStoreType() {
- return this.storeType;
- }
-
- public boolean hasParams() {
- return this.params != null;
- }
-
- public void setParams(Options params) {
- this.params = params;
- }
-
- public Options getParams() {
- return this.params;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateIndexStmt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateIndexStmt.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateIndexStmt.java
deleted file mode 100644
index 0c63c3d..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateIndexStmt.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-import com.google.common.base.Preconditions;
-import tajo.catalog.Options;
-import tajo.catalog.SortSpec;
-import tajo.catalog.proto.CatalogProtos.IndexMethod;
-import tajo.engine.planner.PlanningContext;
-
-public class CreateIndexStmt extends ParseTree {
- private String idxName;
- private boolean unique = false;
- private String tableName;
- private IndexMethod method = IndexMethod.TWO_LEVEL_BIN_TREE;
- private SortSpec[] sortSpecs;
- private Options params = null;
-
- public CreateIndexStmt(final PlanningContext context) {
- super(context, StatementType.CREATE_INDEX);
- }
-
- public CreateIndexStmt(final PlanningContext context, String idxName,
- boolean unique, String tableName,
- SortSpec [] sortSpecs) {
- this(context);
- this.idxName = idxName;
- this.unique = unique;
- this.tableName = tableName;
- this.sortSpecs = sortSpecs;
- }
-
- public void setIndexName(String name) {
- this.idxName = name;
- }
-
- public String getIndexName() {
- return this.idxName;
- }
-
- public boolean isUnique() {
- return this.unique;
- }
-
- public void setUnique() {
- this.unique = true;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- addTableRef(tableName, tableName);
- }
-
- public String getTableName() {
- return this.tableName;
- }
-
- public void setMethod(IndexMethod method) {
- this.method = method;
- }
-
- public IndexMethod getMethod() {
- return this.method;
- }
-
- public void setSortSpecs(SortSpec[] sortSpecs) {
- Preconditions.checkNotNull(sortSpecs);
- Preconditions.checkArgument(sortSpecs.length > 0,
- "Sort specifiers must be at least one");
- this.sortSpecs = sortSpecs;
- }
-
- public SortSpec[] getSortSpecs() {
- return this.sortSpecs;
- }
-
- public boolean hasParams() {
- return this.params != null;
- }
-
- public void setParams(Options params) {
- this.params = params;
- }
-
- public Options getParams() {
- return this.params;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateTableStmt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateTableStmt.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateTableStmt.java
deleted file mode 100644
index 816a7f7..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/CreateTableStmt.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-import org.apache.hadoop.fs.Path;
-import tajo.catalog.Options;
-import tajo.catalog.Schema;
-import tajo.catalog.proto.CatalogProtos.StoreType;
-import tajo.engine.planner.PlanningContext;
-import tajo.engine.planner.PlanningContextImpl;
-
-public class CreateTableStmt extends ParseTree {
- private final String tableName;
- private Schema schema;
- private StoreType storeType;
- private Path path;
- private QueryBlock selectStmt;
- private Options options;
-
- public CreateTableStmt(final PlanningContext context,
- final String tableName) {
- super(context, StatementType.CREATE_TABLE);
- this.tableName = tableName;
- }
-
- public CreateTableStmt(final PlanningContext context,
- final String tableName, final Schema schema,
- StoreType storeType) {
- super(context, StatementType.CREATE_TABLE);
- addTableRef(tableName, tableName);
- this.tableName = tableName;
- this.schema = schema;
- this.storeType = storeType;
- }
-
- public CreateTableStmt(final PlanningContextImpl context,
- final String tableName, final QueryBlock selectStmt) {
- super(context, StatementType.CREATE_TABLE_AS);
- context.setOutputTableName(tableName);
- addTableRef(tableName, tableName);
- this.tableName = tableName;
- this.selectStmt = selectStmt;
- }
-
- public final String getTableName() {
- return this.tableName;
- }
-
- public final boolean hasQueryBlock() {
- return this.selectStmt != null;
- }
-
- public final QueryBlock getSelectStmt() {
- return this.selectStmt;
- }
-
- public final boolean hasDefinition() {
- return this.schema != null;
- }
-
- public boolean hasTableDef() {
- return this.schema != null;
- }
-
- public void setTableDef(Schema schema) {
- this.schema = schema;
- }
-
- public final Schema getTableDef() {
- return this.schema;
- }
-
- public boolean hasStoreType() {
- return this.storeType != null;
- }
-
- public void setStoreType(StoreType type) {
- this.storeType = type;
- }
-
- public final StoreType getStoreType() {
- return this.storeType;
- }
-
- public boolean hasOptions() {
- return this.options != null;
- }
-
- public void setOptions(Options opt) {
- this.options = opt;
- }
-
- public Options getOptions() {
- return this.options;
- }
-
-
- public boolean hasPath() {
- return this.path != null;
- }
-
- public void setPath(Path path) {
- this.path = path;
- }
-
- public final Path getPath() {
- return this.path;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseTree.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseTree.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseTree.java
deleted file mode 100644
index 2ac52d5..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseTree.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-import tajo.engine.parser.QueryBlock.FromTable;
-import tajo.engine.planner.PlanningContext;
-
-import java.util.Map.Entry;
-
-public abstract class ParseTree {
- protected final PlanningContext context;
- protected final StatementType type;
- private final TableMap tableMap = new TableMap();
-
- public ParseTree(final PlanningContext context, final StatementType type) {
- this.context = context;
- this.type = type;
- }
-
- public StatementType getStatementType() {
- return this.type;
- }
-
- protected void addTableRef(FromTable table) {
- tableMap.addFromTable(table);
- }
-
- protected void addTableRef(String tableName, String alias) {
- tableMap.addFromTable(tableName, alias);
- }
-
- public StatementType getType() {
- return this.type;
- }
-
- public String getTableNameByAlias(String alias) {
- return tableMap.getTableNameByAlias(alias);
- }
-
- public Iterable<String> getAllTableNames() {
- return tableMap.getAllTableNames();
- }
-
- public Iterable<Entry<String, String>> getAliasToNames() {
- return tableMap.getAliasToNames();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseUtil.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseUtil.java
deleted file mode 100644
index 482d02d..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParseUtil.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-import org.antlr.runtime.tree.Tree;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import tajo.engine.eval.EvalNode;
-import tajo.engine.eval.InvalidEvalException;
-
-public class ParseUtil {
- private static final Log LOG = LogFactory.getLog(ParseUtil.class);
-
- public static boolean isConstant(final Tree tree) {
- switch (tree.getType()) {
- case SQLParser.NUMBER:
- case SQLParser.REAL:
- case SQLParser.Character_String_Literal:
- return true;
- default:
- return false;
- }
- }
-
- public static EvalNode.Type getTypeByParseCode(int parseCode) {
- switch(parseCode) {
- case SQLParser.AND:
- return EvalNode.Type.AND;
- case SQLParser.OR:
- return EvalNode.Type.OR;
- case SQLParser.LIKE:
- return EvalNode.Type.LIKE;
- case SQLParser.EQUAL:
- return EvalNode.Type.EQUAL;
- case SQLParser.NOT_EQUAL:
- return EvalNode.Type.NOT_EQUAL;
- case SQLParser.LTH:
- return EvalNode.Type.LTH;
- case SQLParser.LEQ:
- return EvalNode.Type.LEQ;
- case SQLParser.GTH:
- return EvalNode.Type.GTH;
- case SQLParser.GEQ:
- return EvalNode.Type.GEQ;
- case SQLParser.NOT:
- return EvalNode.Type.NOT;
- case SQLParser.PLUS:
- return EvalNode.Type.PLUS;
- case SQLParser.MINUS:
- return EvalNode.Type.MINUS;
- case SQLParser.MULTIPLY:
- return EvalNode.Type.MULTIPLY;
- case SQLParser.DIVIDE:
- return EvalNode.Type.DIVIDE;
- case SQLParser.MODULAR:
- return EvalNode.Type.MODULAR;
- default: throw new InvalidEvalException("We does not support " + parseCode + " type AST yet");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParserException.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParserException.java b/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParserException.java
deleted file mode 100644
index 634716e..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/tajo/engine/parser/ParserException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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 tajo.engine.parser;
-
-public class ParserException extends RuntimeException {
- private static final long serialVersionUID = -4392842405539056555L;
-
- /**
- *
- */
- public ParserException() {
- }
-
- /**
- * @param message
- */
- public ParserException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public ParserException(Throwable cause) {
- super(cause);
- }
-
- /**
- * @param message
- * @param cause
- */
- public ParserException(String message, Throwable cause) {
- super(message, cause);
- }
-}