⚡ Sangsakala Proxy 🏠 Home
Skip to content

Athena V3 compatibility issue with condition on the timestamp field #5935

Open

Description

@dym-ok

Expected Behavior

I can run materialization of feature views with Athena V3 as offline store.

Current Behavior

Getting an error like this
feast.infra.utils.aws_utils.AthenaQueryError: Athena SQL Query failed to finish. Details: {'QueryExecution': {'QueryExecutionId': 'b5444c28-41d0-4992-81cc-6d524750161a', 'Query': 'CREATE TABLE _a8a21947682843c598b8340d0ac02738\n WITH (\n external_location = \'s3://re-ds-feature-store-test-bkt/reco/athena_staging/unload/50b466e7-6cfe-40f7-8f21-a615ca3e0243\',\n format = \'parquet\',\n write_compression = \'snappy\'\n )\n as\n \n SELECT property_reference_id, listing_id, is_active, offer_type, country, canton, postalcode, locality, street, geo_latitude, geo_longitude, platforms, subcategory_main_code_hgrets, category_idx, price_gross_normalized, size_sqm_normalized_cleaned, number_of_rooms_cleaned, floor, year_built, year_lastrenovated, are_pets_allowed, has_elevator, has_parking, has_garage, has_niceview, has_steamer, has_washingmachine, has_tumbledryer, has_cabletv, has_flatsharingcommunity, has_attic, has_balcony, has_gardenshed, has_swimmingpool, has_fireplace, is_childfriendly, is_wheelchairaccessible, is_minergiegeneral, is_minergiecertified, is_newbuilding, is_groundfloor, is_oldbuilding, timestamp\n FROM "AwsDataCatalog"."feature_store_reco"."listings"\n WHERE timestamp BETWEEN \'2026-02-01 01:00:00.000\' AND \'2026-02-01 02:00:00.000\'', 'StatementType': 'DDL', 'ResultReuseConfiguration': {'ResultReuseByAgeConfiguration': {'Enabled': False}}, 'QueryExecutionContext': {'Database': 'feature_store_reco', 'Catalog': 'awsdatacatalog'}, 'Status': {'State': 'FAILED', 'StateChangeReason': 'TYPE_MISMATCH: line 52:18: Cannot check if timestamp(3) is BETWEEN varchar(23) and varchar(23). You may need to manually clean the data before retrying. Athena will not delete data in your account.', 'SubmissionDateTime': datetime.datetime(2026, 2, 2, 16, 2, 54, 362000, tzinfo=tzlocal()), 'CompletionDateTime': datetime.datetime(2026, 2, 2, 16, 2, 55, 164000, tzinfo=tzlocal()), 'AthenaError': {'ErrorCategory': 2, 'ErrorType': 1002, 'Retryable': False, 'ErrorMessage': 'TYPE_MISMATCH: line 52:18: Cannot check if timestamp(3) is BETWEEN varchar(23) and varchar(23). You may need to manually clean the data before retrying. Athena will not delete data in your account.'}}, 'Statistics': {'EngineExecutionTimeInMillis': 395, 'DataScannedInBytes': 0, 'TotalExecutionTimeInMillis': 802, 'QueryQueueTimeInMillis': 55, 'ServicePreProcessingTimeInMillis': 172, 'ServiceProcessingTimeInMillis': 180, 'ResultReuseInformation': {'ReusedPreviousResult': False}}, 'WorkGroup': 'wg_re-data-services-feature-store-stk-test', 'EngineVersion': {'SelectedEngineVersion': 'AUTO', 'EffectiveEngineVersion': 'Athena engine version 3'}, 'SubstatementType': 'CREATE_TABLE_AS_SELECT'}, 'ResponseMetadata': {'RequestId': 'd3f31624-2219-44a0-8eb7-47a4223eac49', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Mon, 02 Feb 2026 15:02:55 GMT', 'content-type': 'application/x-amz-json-1.1', 'content-length': '4887', 'connection': 'keep-alive', 'x-amzn-requestid': 'd3f31624-2219-44a0-8eb7-47a4223eac49'}, 'RetryAttempts': 0}}

Steps to reproduce

Specifications

  • Version: >=v0.55.0
  • Platform: macOS/Linux
  • Subsystem:

Possible Solution

Change cast_style="raw" to cast_style="timestamp" in feast/infra/offline_stores/contrib/athena_offline_store/athena.py line 112:

timestamp_filter = get_timestamp_filter_sql(
    start_date_str,
    end_date_str,
    timestamp_field,
    date_partition_column,
    cast_style="timestamp",  # <-- Fix: use "timestamp" instead of "raw"
    quote_fields=False,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions