0

我已经为 Java 中的快速数据创建了一个程序。我无法在集群中获取表名。我也无法理解日志文件。有什么提示吗?

public static void main( String[] args )
{
    SparkSession spark = SparkSession
       .builder()
       .appName("SparkApp")
       .master("local[*]")
       .getOrCreate();
    JavaSparkContext jsc = new JavaSparkContext(spark.sparkContext());
    SnappySession snappy = new SnappySession(spark.sparkContext());
    snappy.dropTable("CUSTOMER",true);
    snappy.sql("CREATE TABLE CUSTOMER ( " +
            "C_CUSTKEY     INTEGER NOT NULL," +
            "C_NAME        VARCHAR(25) NOT NULL," +
            "C_ADDRESS     VARCHAR(40) NOT NULL," +
            "C_NATIONKEY   INTEGER NOT NULL," +
            "C_PHONE       VARCHAR(15) NOT NULL," +
            "C_ACCTBAL     DECIMAL(15,2)   NOT NULL," +
            "C_MKTSEGMENT  VARCHAR(10) NOT NULL," +
            "C_COMMENT     VARCHAR(117) NOT NULL)" +
            "USING COLUMN OPTIONS (PARTITION_BY 'C_CUSTKEY')");
}
4

1 回答 1

0

我认为你没有从这一行得到任何输出的原因是你没有在表 snappy.sql("select count() from CUSTOMER").collect() 中插入任何行。如果您将该行更改为 snappy.sql("select count() from CUSTOMER").show() 它将显示表的实际计数,在您的示例中为 0。

于 2017-04-14T04:06:47.553 回答