笔记1:carbondata的流式操作

笔记1:carbondata的流式操作

更新流
sparkSession.sql("UPDATE test_streaming_2 SET (id) = (22) WHERE name = 'cb'").show();
报错如下:
org.apache.carbondata.common.exceptions.sql.MalformedCarbonCommandException: Data update is not allowed for streaming table
但是关闭流字段就可以了
sparkSession.sql("ALTER TABLE test_streaming_2 COMPACT 'close_streaming'")
结束流
sparkSession.sql("ALTER TABLE test_streaming_2 FINISH STREAMING")

报错如下:
Failed to finish streaming, because streaming is locked for table carbondata.test_streaming_2
显示表属性
sparkSession.sql("DESC FORMATTED test_streaming_2")

删除表
sparkSession.sql("drop table test_streaming_2")

查询表
sparkSession.sql("select * from test_streaming_2").show(10);

普通表转流式
sparkSession.sql("ALTER TABLE test_streaming_2 SET TBLPROPERTIES('streaming'='true')")

sparkSession.sql("ALTER TABLE pd_cl_txjl SET TBLPROPERTIES('streaming'='true')")
显示表属性
sparkSession.sql("DESC FORMATTED test_streaming_2")

删除表
sparkSession.sql("drop table test_streaming_2")

查询表
sparkSession.sql("select * from test_streaming_2").show(10);

普通表转流式
sparkSession.sql("ALTER TABLE test_streaming_2 SET TBLPROPERTIES('streaming'='true')")

sparkSession.sql("ALTER TABLE pd_cl_txjl SET TBLPROPERTIES('streaming'='true')")
发布了11 篇原创文章 · 获赞 4 · 访问量 690

猜你喜欢

转载自blog.csdn.net/qq_38740498/article/details/103820191