@@ -427,185 +427,157 @@ static String overrideableQuery(
427427 }
428428
429429 enum TimeSeriesView {
430- WAREHOUSE_EVENTS_HISTORY {
430+ WAREHOUSE_EVENTS_HISTORY ( WarehouseEventsHistoryFormat . Header . class ) {
431431 @ Override
432432 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
433+ ConnectorProperty property =
434+ SnowflakeLogConnectorProperties .WAREHOUSE_EVENTS_HISTORY_OVERRIDE_QUERY ;
433435 return new TaskDescription (
434436 WarehouseEventsHistoryFormat .ZIP_ENTRY_PREFIX ,
435- overrideableQuery (
436- arguments .getDefinition (
437- SnowflakeLogConnectorProperties .WAREHOUSE_EVENTS_HISTORY_OVERRIDE_QUERY ),
438- formatPrefix (WarehouseEventsHistoryFormat .Header .class , "WAREHOUSE_EVENTS_HISTORY" ),
439- "TIMESTAMP" ),
440- WarehouseEventsHistoryFormat .Header .class );
437+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "TIMESTAMP" ),
438+ headerClass );
441439 }
442440 },
443- AUTOMATIC_CLUSTERING_HISTORY {
441+ AUTOMATIC_CLUSTERING_HISTORY ( AutomaticClusteringHistoryFormat . Header . class ) {
444442 @ Override
445443 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
444+ ConnectorProperty property =
445+ SnowflakeLogConnectorProperties .AUTOMATIC_CLUSTERING_HISTORY_OVERRIDE_QUERY ;
446446 return new TaskDescription (
447447 AutomaticClusteringHistoryFormat .ZIP_ENTRY_PREFIX ,
448- overrideableQuery (
449- arguments .getDefinition (
450- SnowflakeLogConnectorProperties .AUTOMATIC_CLUSTERING_HISTORY_OVERRIDE_QUERY ),
451- formatPrefix (
452- AutomaticClusteringHistoryFormat .Header .class , "AUTOMATIC_CLUSTERING_HISTORY" ),
453- "END_TIME" ),
454- AutomaticClusteringHistoryFormat .Header .class );
448+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
449+ headerClass );
455450 }
456451 },
457- COPY_HISTORY {
452+ COPY_HISTORY ( CopyHistoryFormat . Header . class ) {
458453 @ Override
459454 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
455+ ConnectorProperty property = SnowflakeLogConnectorProperties .COPY_HISTORY_OVERRIDE_QUERY ;
460456 return new TaskDescription (
461457 CopyHistoryFormat .ZIP_ENTRY_PREFIX ,
462- overrideableQuery (
463- arguments .getDefinition (
464- SnowflakeLogConnectorProperties .COPY_HISTORY_OVERRIDE_QUERY ),
465- formatPrefix (CopyHistoryFormat .Header .class , "COPY_HISTORY" ),
466- "LAST_LOAD_TIME" ),
467- CopyHistoryFormat .Header .class );
458+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "LAST_LOAD_TIME" ),
459+ headerClass );
468460 }
469461 },
470- DATABASE_REPLICATION_USAGE_HISTORY {
462+ DATABASE_REPLICATION_USAGE_HISTORY ( DatabaseReplicationUsageHistoryFormat . Header . class ) {
471463 @ Override
472464 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
465+ ConnectorProperty property =
466+ SnowflakeLogConnectorProperties .DATABASE_REPLICATION_USAGE_HISTORY_OVERRIDE_QUERY ;
473467 return new TaskDescription (
474468 DatabaseReplicationUsageHistoryFormat .ZIP_ENTRY_PREFIX ,
475- overrideableQuery (
476- arguments .getDefinition (
477- SnowflakeLogConnectorProperties
478- .DATABASE_REPLICATION_USAGE_HISTORY_OVERRIDE_QUERY ),
479- formatPrefix (
480- DatabaseReplicationUsageHistoryFormat .Header .class ,
481- "DATABASE_REPLICATION_USAGE_HISTORY" ),
482- "END_TIME" ),
483- DatabaseReplicationUsageHistoryFormat .Header .class );
469+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
470+ headerClass );
484471 }
485472 },
486- LOGIN_HISTORY {
473+ LOGIN_HISTORY ( LoginHistoryFormat . Header . class ) {
487474 @ Override
488475 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
476+ ConnectorProperty property = SnowflakeLogConnectorProperties .LOGIN_HISTORY_OVERRIDE_QUERY ;
489477 return new TaskDescription (
490478 LoginHistoryFormat .ZIP_ENTRY_PREFIX ,
491- overrideableQuery (
492- arguments .getDefinition (
493- SnowflakeLogConnectorProperties .LOGIN_HISTORY_OVERRIDE_QUERY ),
494- formatPrefix (LoginHistoryFormat .Header .class , "LOGIN_HISTORY" ),
495- "EVENT_TIMESTAMP" ),
496- LoginHistoryFormat .Header .class );
479+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "EVENT_TIMESTAMP" ),
480+ headerClass );
497481 }
498482 },
499- METERING_DAILY_HISTORY {
483+ METERING_DAILY_HISTORY ( MeteringDailyHistoryFormat . Header . class ) {
500484 @ Override
501485 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
486+ ConnectorProperty property =
487+ SnowflakeLogConnectorProperties .METERING_DAILY_HISTORY_OVERRIDE_QUERY ;
502488 return new TaskDescription (
503489 MeteringDailyHistoryFormat .ZIP_ENTRY_PREFIX ,
504- overrideableQuery (
505- arguments .getDefinition (
506- SnowflakeLogConnectorProperties .METERING_DAILY_HISTORY_OVERRIDE_QUERY ),
507- formatPrefix (MeteringDailyHistoryFormat .Header .class , "METERING_DAILY_HISTORY" ),
508- "USAGE_DATE" ),
509- MeteringDailyHistoryFormat .Header .class );
490+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "USAGE_DATE" ),
491+ headerClass );
510492 }
511493 },
512- PIPE_USAGE_HISTORY {
494+ PIPE_USAGE_HISTORY ( PipeUsageHistoryFormat . Header . class ) {
513495 @ Override
514496 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
497+ ConnectorProperty property =
498+ SnowflakeLogConnectorProperties .PIPE_USAGE_HISTORY_OVERRIDE_QUERY ;
515499 return new TaskDescription (
516500 PipeUsageHistoryFormat .ZIP_ENTRY_PREFIX ,
517- overrideableQuery (
518- arguments .getDefinition (
519- SnowflakeLogConnectorProperties .PIPE_USAGE_HISTORY_OVERRIDE_QUERY ),
520- formatPrefix (PipeUsageHistoryFormat .Header .class , "PIPE_USAGE_HISTORY" ),
521- "END_TIME" ),
522- PipeUsageHistoryFormat .Header .class );
501+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
502+ headerClass );
523503 }
524504 },
525- QUERY_ACCELERATION_HISTORY {
505+ QUERY_ACCELERATION_HISTORY ( QueryAccelerationHistoryFormat . Header . class ) {
526506 @ Override
527507 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
508+ ConnectorProperty property =
509+ SnowflakeLogConnectorProperties .QUERY_ACCELERATION_HISTORY_OVERRIDE_QUERY ;
528510 return new TaskDescription (
529511 QueryAccelerationHistoryFormat .ZIP_ENTRY_PREFIX ,
530- overrideableQuery (
531- arguments .getDefinition (
532- SnowflakeLogConnectorProperties .QUERY_ACCELERATION_HISTORY_OVERRIDE_QUERY ),
533- formatPrefix (
534- QueryAccelerationHistoryFormat .Header .class , "QUERY_ACCELERATION_HISTORY" ),
535- "END_TIME" ),
536- QueryAccelerationHistoryFormat .Header .class ,
512+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
513+ headerClass ,
537514 TaskCategory .OPTIONAL );
538515 }
539516 },
540- REPLICATION_GROUP_USAGE_HISTORY {
517+ REPLICATION_GROUP_USAGE_HISTORY ( ReplicationGroupUsageHistoryFormat . Header . class ) {
541518 @ Override
542519 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
520+ ConnectorProperty property =
521+ SnowflakeLogConnectorProperties .REPLICATION_GROUP_USAGE_HISTORY_OVERRIDE_QUERY ;
543522 return new TaskDescription (
544523 QueryAccelerationHistoryFormat .ZIP_ENTRY_PREFIX ,
545- overrideableQuery (
546- arguments .getDefinition (
547- SnowflakeLogConnectorProperties .QUERY_ACCELERATION_HISTORY_OVERRIDE_QUERY ),
548- formatPrefix (
549- QueryAccelerationHistoryFormat .Header .class , "QUERY_ACCELERATION_HISTORY" ),
550- "END_TIME" ),
551- QueryAccelerationHistoryFormat .Header .class ,
524+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
525+ headerClass ,
552526 TaskCategory .OPTIONAL );
553527 }
554528 },
555- SERVERLESS_TASK_HISTORY {
529+ SERVERLESS_TASK_HISTORY ( ServerlessTaskHistoryFormat . Header . class ) {
556530 @ Override
557531 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
532+ ConnectorProperty property =
533+ SnowflakeLogConnectorProperties .SERVERLESS_TASK_HISTORY_OVERRIDE_QUERY ;
558534 return new TaskDescription (
559535 ServerlessTaskHistoryFormat .ZIP_ENTRY_PREFIX ,
560- overrideableQuery (
561- arguments .getDefinition (
562- SnowflakeLogConnectorProperties .SERVERLESS_TASK_HISTORY_OVERRIDE_QUERY ),
563- formatPrefix (ServerlessTaskHistoryFormat .Header .class , "SERVERLESS_TASK_HISTORY" ),
564- "END_TIME" ),
565- ServerlessTaskHistoryFormat .Header .class );
536+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
537+ headerClass );
566538 }
567539 },
568- TASK_HISTORY {
540+ TASK_HISTORY ( TaskHistoryFormat . Header . class ) {
569541 @ Override
570542 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
543+ ConnectorProperty property = SnowflakeLogConnectorProperties .TASK_HISTORY_OVERRIDE_QUERY ;
571544 return new TaskDescription (
572545 TaskHistoryFormat .ZIP_ENTRY_PREFIX ,
573- overrideableQuery (
574- arguments .getDefinition (
575- SnowflakeLogConnectorProperties .TASK_HISTORY_OVERRIDE_QUERY ),
576- formatPrefix (TaskHistoryFormat .Header .class , "TASK_HISTORY" ),
577- "COMPLETED_TIME" ),
578- TaskHistoryFormat .Header .class );
546+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "COMPLETED_TIME" ),
547+ headerClass );
579548 }
580549 },
581- WAREHOUSE_LOAD_HISTORY {
550+ WAREHOUSE_LOAD_HISTORY ( WarehouseLoadHistoryFormat . Header . class ) {
582551 @ Override
583552 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
553+ ConnectorProperty property =
554+ SnowflakeLogConnectorProperties .WAREHOUSE_LOAD_HISTORY_OVERRIDE_QUERY ;
584555 return new TaskDescription (
585556 WarehouseLoadHistoryFormat .ZIP_ENTRY_PREFIX ,
586- overrideableQuery (
587- arguments .getDefinition (
588- SnowflakeLogConnectorProperties .WAREHOUSE_LOAD_HISTORY_OVERRIDE_QUERY ),
589- formatPrefix (WarehouseLoadHistoryFormat .Header .class , "WAREHOUSE_LOAD_HISTORY" ),
590- "END_TIME" ),
591- WarehouseLoadHistoryFormat .Header .class );
557+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
558+ headerClass );
592559 }
593560 },
594- WAREHOUSE_METERING_HISTORY {
561+ WAREHOUSE_METERING_HISTORY ( WarehouseMeteringHistoryFormat . Header . class ) {
595562 @ Override
596563 TaskDescription taskDescription (@ Nonnull ConnectorArguments arguments ) {
564+ ConnectorProperty property =
565+ SnowflakeLogConnectorProperties .WAREHOUSE_METERING_HISTORY_OVERRIDE_QUERY ;
597566 return new TaskDescription (
598567 WarehouseMeteringHistoryFormat .ZIP_ENTRY_PREFIX ,
599- overrideableQuery (
600- arguments .getDefinition (
601- SnowflakeLogConnectorProperties .WAREHOUSE_METERING_HISTORY_OVERRIDE_QUERY ),
602- formatPrefix (
603- WarehouseMeteringHistoryFormat .Header .class , "WAREHOUSE_METERING_HISTORY" ),
604- "END_TIME" ),
605- WarehouseMeteringHistoryFormat .Header .class );
568+ overrideableQuery (arguments .getDefinition (property ), queryPrefix , "END_TIME" ),
569+ headerClass );
606570 }
607571 };
608572
573+ final Class <? extends Enum <?>> headerClass ;
574+ final String queryPrefix ;
575+
576+ TimeSeriesView (Class <? extends Enum <?>> headerClass ) {
577+ this .headerClass = headerClass ;
578+ this .queryPrefix = formatPrefix (headerClass , name ());
579+ }
580+
609581 static final ImmutableList <TimeSeriesView > valuesInOrder =
610582 ImmutableList .of (
611583 WAREHOUSE_EVENTS_HISTORY ,
@@ -626,8 +598,7 @@ TaskDescription taskDescription(@Nonnull ConnectorArguments arguments) {
626598 }
627599
628600 @ Nonnull
629- static <T extends Enum <T >> String formatPrefix (
630- @ Nonnull Class <T > enumClass , @ Nonnull String view ) {
601+ static String formatPrefix (@ Nonnull Class <? extends Enum <?>> enumClass , @ Nonnull String view ) {
631602 String selectList =
632603 stream (enumClass .getEnumConstants ())
633604 .map (AbstractSnowflakeConnector ::columnOf )
0 commit comments