[ 
https://issues.apache.org/jira/browse/FLINK-15677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17028938#comment-17028938
 ] 

hailong wang edited comment on FLINK-15677 at 2/4/20 2:19 PM:
--------------------------------------------------------------

Thanks [~lzljs3620320]. Sorry for the late reply. I found we can use 

DataTypeUtils.expandCompositeTypeToSchema to extract physical Schema, and 
getFieldNames from it, just like:
{code:java}
DataType producedDataType = getProducedDataType();              TableSchema 
physicalSchema;             if 
(LogicalTypeChecks.isCompositeType(producedDataType.getLogicalType())) {        
             physicalSchema = 
DataTypeUtils.expandCompositeTypeToSchema(getProducedDataType());              
} else {                        //if producedDataType is simple type, we use 
default name f0                    physicalSchema = 
TableSchema.builder().field("f0", producedDataType).build();           }        
       return TableConnectorUtils.generateRuntimeName(getClass(), 
physicalSchema.getFieldNames());
{code}
what do you think of it?

 


was (Author: hailong wang):
Thanks [~lzljs3620320]. Sorry for the late reply. I found we can use 

DataTypeUtils.expandCompositeTypeToSchema to extract physical Schema, and 
getFieldNames from it, just like:
{code:java}
TableSchema physicalSchema = 
DataTypeUtils.expandCompositeTypeToSchema(getProducedDataType());
return TableConnectorUtils.generateRuntimeName(getClass(), 
physicalSchema.getFieldNames());
{code}
what do you think of it?

As for the test, there is already test for 
DataTypeUtils.expandCompositeTypeToSchema method, so we can not add a test.

 

> TableSource#explainSource should return the field names from 
> getProducedDataType instead of getTableSchema
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-15677
>                 URL: https://issues.apache.org/jira/browse/FLINK-15677
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.10.0
>            Reporter: hailong wang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For the fields push down, the final fieldNames  of tablesource are not 
> consistent with FieldNames from TableSchema. So we should return the field 
> names from getProducedDataType instead of getTableSchema.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to