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

Mark Grey commented on CALCITE-4362:
------------------------------------

[Here is a very rough draft with a working test 
case|https://github.com/apache/calcite/compare/main...DeaconDesperado:calcite:CALCITE-4362]

The basic approach is:

* Following the example from {{SqlLibrary}}, adds a {{SystemColumns}} enum to 
{{SqlConformance}} that provides a {{RelDataType}} containing the system 
columns that should be added to all tables given the dialect being validated 
against.
* Changes the already existing (possibly stub?) implementations of 
{{SqlValidatorImpl.isSystemField}}, as well as the 
{{getRowTypeSansSystemColumns}} in {{IdentifierNamespace}} and 
{{TableNamespace}} to leverage this setting out of the {{SqlConformance}}
* Changes the default {{getRowType}} to include the system columns
* When expanding, call {{getRowTypeSansSystemColumns}} instead of {{getRowType}}

I think this approach might work around the concern [~julianhyde] raised when 
comparing with {{isRolledUp}}, insofar as it doesn't require changes to the 
underlying table implementation?

Presently the tests that rely on dynamic table creation via MockCatalogReader 
seem to be broken with this change.  Perhaps there's something wrong with the 
basic approach I'm taking?  If the idea shows promise I can look into what's 
causing those failures.



> Unable to parse queries that use BigQuery pseudo columns 
> _PARTITIONDATE/_PARTITIONTIME
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4362
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4362
>             Project: Calcite
>          Issue Type: Bug
>          Components: babel
>            Reporter: Justin Swett
>            Assignee: Julian Hyde
>            Priority: Major
>
> BigQuery supports partitioned tables using pseudo columns "_PARTITIONDATE"
> e.g. The following table has two columns you can select from but also 
> partitions the data by creation date
> {code:java}
> CREATE or REPLACE TABLE #{table} (            
>   transaction_id STRING, 
>   order_date DATE )
> PARTITION BY _PARTITIONDATE
> {code}
>  
> The following queries cannot be validated 
> {code:java}
> select * from #{table} where _PARTITIONDATE = '2020-11-03' ;
> -- OR
> select * from #{table} where _PARTITIONTIME = '2020-11-03' ;{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to