Skip to content

Commit bfff90a

Browse files
committed
chore: Minor refactor
Signed-off-by: Hai Nguyen <quanghai.ng1512@gmail.com>
1 parent 3505bb2 commit bfff90a

File tree

1 file changed

+16
-14
lines changed
  • sdk/python/feast/infra/online_stores/contrib/hbase_online_store

1 file changed

+16
-14
lines changed

sdk/python/feast/infra/online_stores/contrib/hbase_online_store/hbase.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def online_write_batch(
104104

105105
hbase = HbaseUtils(self._get_conn(config))
106106
project = config.project
107-
table_name = _table_id(project, table)
107+
table_name = self._table_id(project, table)
108108

109109
b = hbase.batch(table_name)
110110
for entity_key, values, timestamp, created_ts in data:
@@ -134,6 +134,9 @@ def online_write_batch(
134134
b.put(row_key, values_dict)
135135
b.send()
136136

137+
if progress:
138+
progress(len(data))
139+
137140
@log_exceptions_and_usage(online_store="hbase")
138141
def online_read(
139142
self,
@@ -153,7 +156,7 @@ def online_read(
153156
"""
154157
hbase = HbaseUtils(self._get_conn(config))
155158
project = config.project
156-
table_name = _table_id(project, table)
159+
table_name = self._table_id(project, table)
157160

158161
result: List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]] = []
159162

@@ -208,12 +211,12 @@ def update(
208211

209212
# We don't create any special state for the entites in this implementation.
210213
for table in tables_to_keep:
211-
table_name = _table_id(project, table)
214+
table_name = self._table_id(project, table)
212215
if not hbase.check_if_table_exist(table_name):
213216
hbase.create_table_with_default_cf(table_name)
214217

215218
for table in tables_to_delete:
216-
table_name = _table_id(project, table)
219+
table_name = self._table_id(project, table)
217220
hbase.delete_table(table_name)
218221

219222
def teardown(
@@ -233,7 +236,7 @@ def teardown(
233236
project = config.project
234237

235238
for table in tables:
236-
table_name = _table_id(project, table)
239+
table_name = self._table_id(project, table)
237240
hbase.delete_table(table_name)
238241

239242
def _hbase_row_key(
@@ -264,13 +267,12 @@ def _hbase_row_key(
264267
# colocated.
265268
return f"{entity_id}#{feature_view_name}".encode()
266269

270+
def _table_id(self, project: str, table: FeatureView) -> str:
271+
"""
272+
Returns table name given the project_name and the feature_view.
267273
268-
def _table_id(project: str, table: FeatureView) -> str:
269-
"""
270-
Returns table name given the project_name and the feature_view.
271-
272-
Args:
273-
project: Name of the feast project.
274-
table: Feast FeatureView.
275-
"""
276-
return f"{project}_{table.name}"
274+
Args:
275+
project: Name of the feast project.
276+
table: Feast FeatureView.
277+
"""
278+
return f"{project}_{table.name}"

0 commit comments

Comments
 (0)