
Answer-first summary for fast verification
Answer: feature_client.create_table(name=‘new_feature_table‘,primary_keys=‘customer_id‘,df=feature_set,schema=feature_set.schema,description=‘Client features‘)
Option B is correct because it properly uses the `create_table` method of the `feature_client`, specifying all necessary parameters: the table name (`name`), the primary keys (`primary_keys`), the DataFrame (`df`), the schema (`schema`), and a description. This approach is standard for creating and populating a new feature table in a Feature Store. Option A and C incorrectly use the `write` method, which is not directly related to Feature Store operations. Option D lacks the DataFrame and table name, and Option E misses the DataFrame parameter. Thus, Option B is the most accurate and complete solution.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A data scientist has developed a Python function titled ‘generate_features‘ that produces a Spark DataFrame with two columns: ‘Customer INT‘ and ‘Region STRING‘. The output DataFrame is stored in a variable called ‘feature_set‘. The next step is to create a Feature Store table using ‘feature_set‘ with the Feature Store Client ‘feature_client‘. Which code snippet correctly initiates and populates the Feature Store table?
A
feature_set.write(‘fs‘).saveAs(‘new_feature_table‘)
B
feature_client.create_table(name=‘new_feature_table‘,primary_keys=‘customer_id‘,df=feature_set,schema=feature_set.schema,description=‘Client features‘)
C
feature_set.write.mode(‘feature‘).saveAsTable(‘new_feature_table‘)
D
feature_client.create_table(function=‘generate_features‘,schema=feature_set.schema,description=‘Client features‘)
E
feature_client.create_table(name=‘new_feature_table‘,primary_keys=‘customer_id‘,schema=feature_set.schema,description=‘Client features‘)