Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2810#discussion_r226227374
--- Diff:
examples/spark2/src/main/java/org/apache/carbondata/examples/sql/CarbonSessionExample.java
---
@@ -0,0 +1,137 @@
+/*
+ * 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.examples.sql;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.examples.util.ExampleUtils;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.spark.sql.SparkSession;
+
+import java.io.File;
+import java.io.IOException;
+
+public class CarbonSessionExample {
+
+ public static void main(String[] args) {
+ File file = new
File(CarbonSessionExample.class.getResource("/").getPath() + "../..");
+ try {
+ String rootPath = file.getCanonicalPath();
+ System.setProperty("path.target", rootPath +
"/examples/spark2/target");
+ PropertyConfigurator.configure(rootPath +
"/examples/spark2/src/main/resources/log4j.properties");
+
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.ENABLE_QUERY_STATISTICS,
"true");
+ SparkSession spark =
ExampleUtils.createCarbonSession("JavaCarbonSessionExample", 1);
+ spark.sparkContext().setLogLevel("INFO");
+
+ spark.sql("DROP TABLE IF EXISTS carbonsession_table");
+ spark.sql("DROP TABLE IF EXISTS stored_as_carbondata_table");
+
+ spark.sql(
+ "CREATE TABLE carbonsession_table( " +
+ "shortField SHORT, " +
+ "intField INT, " +
+ "bigintField LONG, " +
+ "doubleField DOUBLE, " +
+ "stringField STRING, " +
+ "timestampField TIMESTAMP, " +
+ "decimalField DECIMAL(18,2), " +
+ "dateField DATE, " +
+ "charField CHAR(5), " +
+ "floatField FLOAT " +
+ ") " +
+ "STORED BY 'carbondata' " +
--- End diff --
use `STORED AS carbondata` instead
---