zhangjun888 commented on a change in pull request #11457: 
[FLINK-14255][WIP][table] Introduce FileSystemStreamingSinkV2
URL: https://github.com/apache/flink/pull/11457#discussion_r402139052
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveTableSink.java
 ##########
 @@ -82,59 +95,134 @@ public HiveTableSink(JobConf jobConf, ObjectPath 
tablePath, CatalogTable table)
                tableSchema = 
TableSchemaUtils.getPhysicalSchema(table.getSchema());
        }
 
+       private boolean isStreaming() {
+               return Boolean.parseBoolean(catalogTable.getProperties()
+                               
.get(FileSystemValidator.CONNECTOR_SINK_STREAMING_ENABLE));
+       }
+
        @Override
-       public OutputFormat<Row> getOutputFormat() {
+       public final DataStreamSink consumeDataStream(DataStream dataStream) {
+               int parallelism = dataStream.getParallelism();
+               String sinkParallelism = catalogTable.getProperties()
+                               
.get(ConnectorDescriptorValidator.CONNECTOR_SINK_PARALLELISM);
+               if (sinkParallelism != null) {
+                       parallelism = Integer.parseInt(sinkParallelism);
+               }
+
                String[] partitionColumns = 
getPartitionFieldNames().toArray(new String[0]);
                String dbName = tablePath.getDatabaseName();
                String tableName = tablePath.getObjectName();
                try (HiveMetastoreClientWrapper client = 
HiveMetastoreClientFactory.create(
                                new HiveConf(jobConf, HiveConf.class), 
hiveVersion)) {
                        Table table = client.getTable(dbName, tableName);
                        StorageDescriptor sd = table.getSd();
+                       HiveTableMetaStoreFactory msFactory = new 
HiveTableMetaStoreFactory(
+                                       jobConf, hiveVersion, dbName, 
tableName);
+
+                       String defaultPartName = jobConf.get(
+                                       
HiveConf.ConfVars.DEFAULTPARTITIONNAME.varname,
+                                       
HiveConf.ConfVars.DEFAULTPARTITIONNAME.defaultStrVal);
+
+                       if (isStreaming()) {
+                               if (overwrite) {
+                                       throw new 
IllegalStateException("Streaming mode not support overwrite.");
+                               }
+
+                               if (!isParquet(sd)) {
 
 Review comment:
   only parquet ? no ORC ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to